[llvm-bugs] [Bug 37340] New: /fp in CL-compat does not produce OrderedCompares
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri May 4 09:39:39 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37340
Bug ID: 37340
Summary: /fp in CL-compat does not produce OrderedCompares
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: alexandre.ganea at ubisoft.com
CC: llvm-bugs at lists.llvm.org
The behavior between MSVC cl.exe and clang, in regards to the /fp flag, seems
to be different when comparing NaNs.
Consider:
// a.cpp
int main() {
unsigned long a = 0xffc00000; // -Nan
float f = *(float*)&a;
if (f <= -1.f)
return 1;
return 0;
}
(MSVC) cl.exe a.cpp /arch:AVX2 /Z7 /fp:fast
if (f <= -1.f)
00007FF6EA036586 vmovss xmm0,dword ptr [f]
00007FF6EA03658C vcomiss xmm0,dword ptr [__real at bf800000 (07FF6EA094F10h)]
00007FF6EA036594 ja main+2Dh (07FF6EA03659Dh)
(MSVC) cl.exe a.cpp /arch:AVX2 /Z7 /fp:precise
if (f <= -1.f)
00007FF70AF06586 vmovss xmm0,dword ptr [__real at bf800000 (07FF70AF64F10h)]
00007FF70AF0658E vcomiss xmm0,dword ptr [f]
00007FF70AF06594 jb main+2Dh (07FF70AF0659Dh)
(Clang) clang-cl.exe a.cpp /arch:AVX2 /Z7 /fp:fast
if (f <= -1.f)
00007FF7DAAF6598 vucomiss xmm0,dword ptr [f]
00007FF7DAAF659E jb main+41h (07FF7DAAF65B1h)
(Clang) clang-cl.exe a.cpp /arch:AVX2 /Z7 /fp:precise
if (f <= -1.f)
00007FF7DAAF6598 vucomiss xmm0,dword ptr [f]
00007FF7DAAF659E jb main+41h (07FF7DAAF65B1h)
(same as above)
Actually, no matter which /fp: or -f*math* you pass to clang, the result is the
same (when using the clang-cl driver). As you can see, Clang generates
'ucomiss' instructions in all cases, instead of 'comiss' as in cl.exe. Omiting
/arch:AVX2 gives the same result.
I am at r331502.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180504/698ab3c7/attachment.html>
More information about the llvm-bugs
mailing list