[LLVMbugs] [Bug 23993] New: clang-cl /arch:IA32 generates CMOV instructions not supported by selected arch
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jun 30 06:08:56 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23993
Bug ID: 23993
Summary: clang-cl /arch:IA32 generates CMOV instructions not
supported by selected arch
Product: clang
Version: 3.6
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: amadvance at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Using clang-cl /arch:IA32 should not generate CMOV instructions that are not
supported by a generic i686.
Visual Studio documentation is clear about that. CMOV instructions should be
generated only with /arch:SSE2.
See: https://msdn.microsoft.com/en-us/library/7t5yh4fd.aspx
"In addition to using the SSE and SSE2 instructions, the compiler also uses
other instructions that are present on the processor revisions that support SSE
and SSE2. An example is the CMOV instruction that first appeared on the Pentium
Pro revision of the Intel processors."
The problem seems to be the "-target-cpu pentium4" selection. A "i686" would
work.
A workaround is to add in the command line: -Xclang -target-cpu -Xclang i686
Here an example with clang 3.6.0:
...> type test.c
extern int i;
extern int j;
int f(int g) {
i++;
if (g)
return j;
else
return 1;
}
...> clang-cl -O2 /arch:IA32 -v -c test.c -o test.obj
clang version 3.6.0 (tags/RELEASE_360/final)
Target: i686-pc-windows-msvc
Thread model: posix
"D:\\compiler\\clang-3.6\\bin\\clang-cl.exe" -cc1 -triple i686-pc-windows-msvc
-emit-obj -disable-free -main-file-name
test.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-relaxed-aliasing -fmath-errno -masm-verbose -mc
onstructor-aliases -target-cpu pentium4 -D_MT --dependent-lib=libcmt
--dependent-lib=oldnames -fdiagnostics-format msvc
-v -dwarf-column-info -coverage-file
"C:\\Users\\am\\Desktop\\clangtest\\test.c" -resource-dir
"D:\\compiler\\clang-3.6\
\bin\\..\\lib\\clang\\3.6.0" -internal-isystem
"D:\\compiler\\clang-3.6\\bin\\..\\lib\\clang\\3.6.0\\include" -internal-
isystem "d:\\compiler\\msvc71\\vc7\\include" -internal-isystem
"d:\\compiler\\msvc71\\vc7\\atlmfc\\include" -internal-is
ystem "d:\\compiler\\msvc71\\vc7\\PlatformSDK\\include" -O2
-fdebug-compilation-dir "C:\\Users\\am\\Desktop\\clangtest"
-ferror-limit 19 -fmessage-length 120 -mstackrealign -fms-extensions
-fms-compatibility -fms-compatibility-version=17.00
-fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize
-slp -o test.obj -x c test.c
clang -cc1 version 3.6.0 based upon LLVM 3.6.0 default target
i686-pc-windows-gnu
#include "..." search starts here:
#include <...> search starts here:
D:\compiler\clang-3.6\bin\..\lib\clang\3.6.0\include
d:\compiler\msvc71\vc7\include
d:\compiler\msvc71\vc7\atlmfc\include
d:\compiler\msvc71\vc7\PlatformSDK\include
End of search list.
...> dumpbin /DISASM test.obj
Dump of file test.obj
File Type: COFF OBJECT
_f:
00000000: 55 push ebp
00000001: 89 E5 mov ebp,esp
00000003: FF 05 00 00 00 00 inc dword ptr [_i]
00000009: 83 7D 08 00 cmp dword ptr [ebp+8],0
0000000D: B8 01 00 00 00 mov eax,1
00000012: 0F 45 05 00 00 00 cmovne eax,dword ptr [_j]
00
00000019: 5D pop ebp
0000001A: C3 ret
--
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/20150630/4ac10330/attachment.html>
More information about the llvm-bugs
mailing list