[llvm-commits] _mm_srli_si128 and __builtin_ia32_psrldqi128

Stuart Hastings stuart at apple.com
Wed Oct 1 16:33:06 PDT 2008


Right after I committed my fix for this Apple bug into Apple's GCC...

	<rdar://problem/5919583> macro troubles in sse land

...Apple's GCC got merged into llvm-gcc, and this broke LLVM.

(Here is one reversion arising from the debacle: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080929/067729.html)

The original bug was a complaint that _mm_srli_si128 mis-compiled when  
passed a constant vector ("{0x123, 0x456}" syntax).  The fix is to  
simplify the _mm_srli_si128 macro, and  move the "* 8" from the macro  
into the compiler back-end.  I can't change the existing __builtins  
because so many people are using them :-(.  Since I'm adding a new  
__builtin_XX, LLVM needs to know about this.

I think this fix should go into llvm and llvm-gcc before I patch  
Apple's GCC; this will "inoculate" LLVM when a subsequent GCC merge  
arrives.

As this is my first posting to llvm-commits, I'm not certain of the  
protocol.  I wrote a GCC-style ChangeLog in case somebody finds it  
useful:

2008-10-01  Stuart Hastings  <stuart at apple.com>

	Radar 5919583
	* llvm/include/llvm/IntrinsicsX86.td (int_x86_sse2_psll_dq_bs,  
int_x86_sse2_psrl_dq_bs): New.
	* llvm/lib/Target/X86/X86InstrSSE.td (int_x86_sse2_psll_dq_bs,  
int_x86_sse2_psrl_dq_bs): New.
	* llvm-gcc/gcc/config/i386/i386.h (IX86_BUILTIN_PSLLDQI128_BYTESHIFT,  
IX86_BUILTIN_PSRLDQI128_BYTESHIFT): New.
	* llvm-gcc/gcc/config/i386/emmintrin.h (_mm_srli_si128,  
_mm_slli_si128): Use xx_byteshift builtins.
	* llvm-gcc/gcc/config/i386.c (__builtin_ia32_pslldq128_byteshift,  
__builtin_ia32_psrldq128_byteshift): New.
	  (ix86_expand_builtin): Support for IX86_BUILTIN_PSLLDQI128 and  
IX86_BUILTIN_PSRLDQI128.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: llvm-gcc.test.diffs.txt
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081001/4e43e447/attachment.txt>
-------------- next part --------------


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: llvm.test.diffs.txt
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081001/4e43e447/attachment-0001.txt>
-------------- next part --------------



I have no commit privileges in LLVM.  Would some gracious person  
please review these patches, and if they're O.K., please apply them?

Thank you in advance,

stuart


More information about the llvm-commits mailing list