[LLVMdev] llvm 2.8 fixes?

Roland Scheidegger sroland at vmware.com
Thu Oct 28 07:30:56 PDT 2010


Hi,

hit by a bug in llvm 2.8, I was wondering if there are any stable
release branches? The bug is only present in the release branch, and I
have a fix for it (see attachment). IMHO the bug is quite bad, and
workarounds are actually ugly and generate inefficient code (couldn't
really come up with anything which actually generated correct code which
didn't require at least a pshufb).

For reference, this is the bug in question:
http://llvm.org/bugs/show_bug.cgi?id=8381

Here's also a short example:

define <8 x i16> @broadcast_16(<8 x i16> %var1, <8 x i16> %var2) {
entry:
  %0 = shufflevector <8 x i16> %var2, <8 x i16> undef, <8 x i32>
zeroinitializer
  ret <8 x i16> %0
}

Which miscompiles badly to

punpcklwd       %xmm0, %xmm1
pshufd  $0, %xmm1, %xmm0
ret

(This happens for all similar broadcast shuffles, except if the reg
containing the vector to shuffle happens to be xmm0 just by luck).

Roland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shuf_fix.diff
Type: text/x-patch
Size: 837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101028/67112e04/attachment.bin>


More information about the llvm-dev mailing list