Displaying 7 results from an estimated 7 matches for "cmovae".
2008 May 27
3
[LLVMdev] Float compare-for-equality and select optimization opportunity
Hi all,
I'm trying to generate code containing an ordered float compare for
equality, and select. The resulting code however has an unordered compare
and some Boolean logic that I think could be eliminated. In C syntax the
code looks like this:
float x, y;
int a, b, c
if(x == y) // Rotate the integers
{
int t;
t = a;
a = b;
2008 May 27
1
[LLVMdev] Float compare-for-equality and select optimizationopportunity
Both ZF and PF will be set if unordered, so the code below is IEEE
correct...you want to generate 'fcmp ueq' instead of 'fcmp oqe'
This is the resulting x86 assembly code:
movss xmm0,dword ptr [ecx+4]
ucomiss xmm0,dword ptr [ecx+8]
sete al
setnp dl
test dl,al
mov edx,edi
cmovne edx,ecx
cmovne ecx,esi
cmovne
2008 May 27
0
[LLVMdev] Float compare-for-equality and select optimizationopportunity
Hi Marc,
I'm a bit confused. Isn't the standard compare (i.e. the one for a language
like C) an ordered one? I tried converting some C code to LLVM C++ API code
with the online demo, and it uses FCMP_OEQ.
Cheers,
Nicolas
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Marc B. Reynolds
Sent: Tuesday, 27 May, 2008 14:07
To: 'LLVM
2008 May 27
1
[LLVMdev] Float compare-for-equality andselect optimizationopportunity
Hi Marc,
I'm a bit confused. Isn't the standard compare (i.e. the one for a language
like C) an ordered one? I tried converting some C code to LLVM C++ API code
with the online demo, and it uses FCMP_OEQ.
No, if you have:
x = NaN
y = NaN
then the comparison:
(x == y) is false.
Which is what your seeing from your first post and is the standard IEEE
expected behavior.
2017 Apr 19
3
[cfe-dev] FE_INEXACT being set for an exact conversion from float to unsigned long long
...ero
>> movaps xmm2, xmm0
>> subss xmm2, xmm1
>> cvttss2si rax, xmm2
>> movabs rcx, -9223372036854775808
>> xor rcx, rax
>> cvttss2si rax, xmm0
>> ucomiss xmm0, xmm1
>> cmovae rax, rcx
>> ret
>>
>> GCC lowering (sets flags correctly):
>>
>> fcvt_lu(float):
>> ucomiss xmm0, DWORD PTR .LC0[rip]
>> jnb .L4
>> cvttss2si rax, xmm0
>> ret
>> .L4:
>> su...
2017 Apr 20
4
[cfe-dev] FE_INEXACT being set for an exact conversion from float to unsigned long long
...movss xmm1, dword ptr [rip + .LCPI1_0] # xmm1 = mem[0],zero,zero,zero
movaps xmm2, xmm0
subss xmm2, xmm1
cvttss2si rax, xmm2
movabs rcx, -9223372036854775808
xor rcx, rax
cvttss2si rax, xmm0
ucomiss xmm0, xmm1
cmovae rax, rcx
ret
GCC lowering (sets flags correctly):
fcvt_lu(float):
ucomiss xmm0, DWORD PTR .LC0[rip]
jnb .L4
cvttss2si rax, xmm0
ret
.L4:
subss xmm0, DWORD PTR .LC0[rip]
movabs rdx, -9223372036854775808
cvttss2si r...
2017 Apr 21
2
[cfe-dev] FE_INEXACT being set for an exact conversion from float to unsigned long long
...movss xmm1, dword ptr [rip + .LCPI1_0] # xmm1 = mem[0],zero,zero,zero
movaps xmm2, xmm0
subss xmm2, xmm1
cvttss2si rax, xmm2
movabs rcx, -9223372036854775808
xor rcx, rax
cvttss2si rax, xmm0
ucomiss xmm0, xmm1
cmovae rax, rcx
ret
GCC lowering (sets flags correctly):
fcvt_lu(float):
ucomiss xmm0, DWORD PTR .LC0[rip]
jnb .L4
cvttss2si rax, xmm0
ret
.L4:
subss xmm0, DWORD PTR .LC0[rip]
movabs rdx, -9223372036854775808
cvttss2si r...