DMD Issue with Asm Generation?

user001 via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 13 12:39:32 PST 2016


There seems to be some invalid code generation for std.format for 
type of "real". Relavant links:

https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1713
https://github.com/D-Programming-Language/phobos/blob/master/std/math.d#L5118


movabs rbx,7FF0000000000000                | <-- problem, should 
be 0x7FFF
and rax,rbx                                |
cmp rax,rbx                                |
jne test.7FF6FF4762E4                      |
mov rdx,qword ptr ss:[rbp-230]             |
movabs rcx,FFFFFFFFFFFFF                   |
test rdx,rcx                               |
je test.7FF6FF4762E4                       |
lea rax,qword ptr ds:[7FF6FF4C5C02]        | ;7FF6FF4C5C02:"nan"
mov qword ptr ss:[rbp-2C8],rax             |
mov qword ptr ss:[rbp-2D0],3               |
jmp test.7FF6FF476335                      |
mov rsi,qword ptr ss:[rbp-230]             |
movabs rax,7FFFFFFFFFFFFFFF                |
and rsi,rax                                |
cmp rsi,rbx                                |
jne test.7FF6FF476335                      |
fld tword ptr ss:[rbp-228]                 |
fldz                                       |
fcompi st1                                 |
fstp st0                                   |
ja test.7FF6FF47631B                       |
jp test.7FF6FF47631B                       |
lea rdx,qword ptr ds:[7FF6FF4C5C06]        | ;7FF6FF4C5C06:"inf"
mov ebx,3                                  |
jmp test.7FF6FF476327                      | ;format.d:1495
lea rdx,qword ptr ds:[7FF6FF4C5C0A]        | ;7FF6FF4C5C0A:"-inf"

Seems to compile fine with DMD at least with simpler code with 
just an if statement. Also this issue doesn't exist for 32-bit 
x86.


More information about the Digitalmars-d mailing list