[Mono-dev] mono on PPC - casting issue

M Jam mjam.mono at gmail.com
Mon Oct 10 20:32:12 UTC 2016

Hi Taloth,

Sorry, I have overlooked this message by mistake. Thanks for your response.

The is the exact issue we have. We don't have this issue for real PPC 64
QorIQ processors i.e. T1040
But we have this issue on P1020 processors which is 32-bit processors.

I did the regression tests and this is what they look like.

When you ran into this issue, how did you work around? Did you end up
finding a fix?

I did try and put a break point at  OP_FCONV_TO_I4 in mini-ppc.c and it was
never getting hit. It could as well be my GDB. not sure.

I am new to mono project. The documentations is wild and big for me to go
though. Even then I tried and I am little clueless on
how this whole things is tied together. So, not sure how to debug this.

Anyways, I see 2 cases being handled.
Thought I am not sure if this is real code that's
A type case of unit does NOT work while typecast of int works fine.

The switch case
                case OP_FCONV_TO_I4:                                <<<<<
this is one that's fine.
                case OP_FCONV_TO_I:
                        code = emit_float_to_int (cfg, code, ins->dreg,
ins->sreg1, 4, TRUE);
                case OP_FCONV_TO_U4:
 <<<<<< this is the one that fails
                case OP_FCONV_TO_U:
                        code = emit_float_to_int (cfg, code, ins->dreg,
ins->sreg1, 4, FALSE);

> But I recommend you get those regression tests compiled first, and then
lookup your CPU datasheet to find out what instruction set it supports.
You mean, what instruction set it supported to convert from FLOAT to UNIT?

M Jam

On Fri, Sep 16, 2016 at 3:21 PM, Taloth Saldono <talothsaldono at gmail.com>

> Hey M Jam,
> I'm not involved in PPC or mono development at all, but I've seen a
> similar case over 2 years ago, that was on a Qoriq-based Synology NAS. For
> that device it was that the mono jitter emitted powerpc extended 64-bit
> instructions which were unsupported by that specific CPU. But of course I
> don't know if it's related to your issue, also, there have been changes to
> the ppc jitter since then.
> Running the mono basic regression tests was particularly telling, you
> could see all the specific cases going wrong. (
> https://github.com/mono/mono/blob/mono-3.10.0-branch/mono/m
> ini/Makefile.am.in#L438-L458)
> The Jitter for PPC is here: https://github.com/mono/
> mono/blob/mono-3.10.0-branch/mono/mini/mini-ppc.c
> search for OP_FCONV_TO_I4.
> But I recommend you get those regression tests compiled first, and then
> lookup your CPU datasheet to find out what instruction set it supports.
> Cheers,
> Taloth
> On Fri, Sep 16, 2016 at 11:45 PM, M Jam <mjam.mono at gmail.com> wrote:
>> Hi all,
>> I am trying to get mono working on ppc.
>> Apparently, on one else is using it. even debian.
>> I did a lot of debugging and finally at a point where I know the problem
>> is in mono runtime.
>> The even generated the CIL code on both x86 and ppc and compared them.
>> They are exactly identical.
>> problem area is as simple as this:
>> int x = (int) 2.0
>> If I print x, I get 0.
>> other broken things: Also math.ceiling() is broken and may be more are
>> broken.
>> At this point, I am not sure what is the best route to debug other than
>> disassembling the code for which I need some preparation as I don't has
>> 'as' and 'ld' on my ppc platform.
>> I need to build them.
>> In the mean time, if anyone has an advice on debugging this issue, I
>> highly appreciate it.
>> Also, lastly CIL code between a cast of int and uint is
>> <       IL_0015:  conv.i4
>> ---
>> >       IL_0015:  conv.u4
>> Where is it in the JIT this code gets handled.
>> Thanks,
>> M Jam
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.dot.net
>> http://lists.dot.net/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20161010/d8c2d336/attachment.html>

More information about the Mono-devel-list mailing list