The future of Int128 support in D language
Iain Buclaw
ibuclaw at gdcproject.org
Mon Jan 9 20:53:03 UTC 2023
On Monday, 9 January 2023 at 18:10:43 UTC, Patrick Schluter wrote:
> On Monday, 9 January 2023 at 16:51:45 UTC, Iain Buclaw wrote:
>> On Sunday, 8 January 2023 at 17:36:07 UTC, Johan wrote:
>>> [...]
>>
>> Actually, I had implemented core.int128 as compiler-recognized
>> intrinsics that do the necessary conversion to/from native on
>> the fly.
>>
>> I ran into some problems when testing this on SPARC though (to
>> name one non-x86 target that I use for sanity checking new
>> code-gen features). Never found the time to get to the bottom
>> of what was causing it to crash, so left it as a TBD patch set.
>>
>> I suspect I am going wrong somewhere with all the concatenated
>> `*cast(cent*)&c` and `*cast(core.int128.Cent*)&c` going on all
>> around the place when you chain these functions together with
>> UFCS. Maybe should investigate using a `union` instead, but
>> not enough bandwidth to do that at the moment.
>
> SPARC is big endian. Probably somewhere an intermediate value
> that is truncated to 64 bits which passes in LE but not in BE.
> Talking completely out of my a.s. :-)
Endianess is already covered.
https://github.com/dlang/dmd/blob/ee1acbb62dc4a65e72d7bf27e61761fb34d497e2/druntime/src/core/int128.d#L24-L36
At some point the backend dies on receiving invalid code, or
something it cannot reasonably expand/lower. So I must be doing
something wrong. :-)
More information about the Digitalmars-d
mailing list