Bug 23418 – double argument is passed on stack, but assumed to be in XMM0 register
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2022-10-16T02:05:54Z
Last change time
2022-10-16T19:55:46Z
Keywords
pull, SIMD
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2022-10-16T02:05:54Z
bool test_eqz(double x) { return x == 0; }
int abc(int i)
{
test_eqz(123);
return 2;
}
compiled with -m32 -O yields:
_D5test38test_eqzFfZb:
xorps XMM1,XMM1
ucomiss XMM1,XMM0 <--- XMM0 should be loaded from stack!
jp LA
je LE
LA: xor EAX,EAX
jmp short L13
LE: mov EAX,1
L13: ret 4 <--- correctly popped from stack
add [EAX],AL
_D5test33abcFiZi:
sub ESP,018h
movss XMM0,_D5test312__ModuleInfoZ@SYM32[03h]
sub ESP,4
movss [ESP],XMM0 <--- XMMO passed on stack!
call _D5test38test_eqzFfZb@PC32
add ESP,0Ch
add ESP,0Ch
mov EAX,2
ret
Comment #1 by dlang-bot — 2022-10-16T03:34:52Z
@WalterBright created dlang/dmd pull request #14568 "fix Issue 23418 - double argument is passed on stack, but assumed to …" fixing this issue:
- fix Issue 23418 - double argument is passed on stack, but assumed to be in XMM0 register
https://github.com/dlang/dmd/pull/14568
Comment #2 by dlang-bot — 2022-10-16T19:55:46Z
dlang/dmd pull request #14568 "fix Issue 23418 - double argument is passed on stack, but assumed to …" was merged into master:
- 88d6d5b784ea267098c43ed123226b11af1798eb by Walter Bright:
fix Issue 23418 - double argument is passed on stack, but assumed to be in XMM0 register
https://github.com/dlang/dmd/pull/14568