[LLVMdev] how to disable sse and avx

1,359 views
Skip to first unread message

zhi chen

unread,
May 14, 2015, 1:17:14 PM5/14/15
to LLVM Dev
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

mats petersson

unread,
May 14, 2015, 1:55:49 PM5/14/15
to zhi chen, LLVM Dev
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?

--
Mats

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


Zhi Chen

unread,
May 14, 2015, 2:07:25 PM5/14/15
to mats petersson, zhi chen, LLVM Dev
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.

--
Zhi

--
PhD Student
Department of Computer Science
University of California, Irvine

Michael Zolotukhin

unread,
May 14, 2015, 2:16:18 PM5/14/15
to Zhi Chen, zhi chen, LLVM Dev
On May 14, 2015, at 11:03 AM, Zhi Chen <zhich...@gmail.com> wrote:

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

Eric Christopher

unread,
May 14, 2015, 2:17:41 PM5/14/15
to Zhi Chen, mats petersson, zhi chen, LLVM Dev
Probably just issues in our intel syntax generation.

Why are you using that?

-eric

Reid Kleckner

unread,
May 14, 2015, 2:20:19 PM5/14/15
to Zhi Chen, zhi chen, LLVM Dev
Try not using intel assembly syntax, it is the less supported dialect.

Zhi Chen

unread,
May 14, 2015, 2:32:45 PM5/14/15
to Reid Kleckner, zhi chen, LLVM Dev
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
Reply all
Reply to author
Forward
0 new messages