Skip to content

Instantly share code, notes, and snippets.

@xianyi
Created June 20, 2012 14:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xianyi/2960279 to your computer and use it in GitHub Desktop.
Save xianyi/2960279 to your computer and use it in GitHub Desktop.
Test the binary code of Clang and GCC
.text
.globl test
test:
vaddpd 2*8(%rbx,%r10,1),%xmm13,%xmm13
ret
@xianyi
Copy link
Author

xianyi commented Jun 20, 2012

On Linux, gcc will generate "c4 21 11 58 6c 13 10 vaddpd 0x10(%rbx,%r10,1),%xmm13,%xmm13" .

However, Clang 3.0 on Mac OSX will generate "c4 01 11 58 6c 13 10 vaddpd 0x10(%r11,%r10,1),%xmm13,%xmm13". It's the wrong register!

Apple clang version 3.0 (tags/Apple/clang-211.12) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix

Then, I used Clang 3.1 from LLVM website. It works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment