how to disable sse and avx

Hello,

I want to disable LLVM to use any SIMD registers like sse and avx. I tried -mno-sse and -mno-avx on my Core i7 machine. It seems that the generated assembly still uses xmm registers. Is there any way for LLVM to only use scalar registers?

Thanks,
Zhi

Sounds like a bug, as far as I can tell, -mno-sse should disable all use of SSE instructions (and thus all uses of xmm registers). Exactly what version of LLVM, and what instructions from what LLVM IR or C source?

Thanks, Mats. Actually, it is able to generate the assembly now if I use the follow command: clang++ -O3 -S -mllvm --x86-asm-syntax=intel -mno-sse -o test_nosee.s test.cpp
However, when I use g++ -O3 -o test_nosse test_nosse.s -lm to generate the executable, if gives me the following errors:

Error: too many memory references for sub' Error: too many memory references for mov’
Error: too many memory references for mov' Error: too many memory references for mov’
Error: too many memory references for mov' Error: junk ptr [rsp+112]’ after expression
Error: junk ptr [rsp+128]' after expression Error: junk (1)’ after expression
Error: operand size mismatch for `fsubrp’

Any idea? Thanks.

Thanks, Mats. Actually, it is able to generate the assembly now if I use the follow command: clang++ -O3 -S -mllvm --x86-asm-syntax=intel -mno-sse -o test_nosee.s test.cpp
However, when I use g++ -O3 -o test_nosse test_nosse.s -lm to generate the executable, if gives me the following errors:

Error: too many memory references for sub' Error: too many memory references for mov’
Error: too many memory references for mov' Error: too many memory references for mov’
Error: too many memory references for mov' Error: junk ptr [rsp+112]’ after expression
Error: junk ptr [rsp+128]' after expression Error: junk (1)’ after expression
Error: operand size mismatch for `fsubrp’

Any idea? Thanks.

I guess the problem is that g++ might expect AT&T syntax in asm files. Could you try changing ‘–x86-asm-syntax=intel’ to ‘–x86-asm-syntax=att’?

Michael

Probably just issues in our intel syntax generation.

Why are you using that?

-eric

Try not using intel assembly syntax, it is the less supported dialect.

Thanks for all your replies. Yes, it was the because I specified “–x86-asm-syntax=intel”. I just wanted to see the performance difference between the code w/ and w/o using SSE/AVX registers.

Best,
Zhi