[LLVMbugs] [Bug 5739] New: _mm_alignr_epi8 sets immediate wrong in llvm-gcc, clang

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Dec 9 14:26:29 PST 2009


           Summary: _mm_alignr_epi8 sets immediate wrong in llvm-gcc, clang
           Product: new-bugs
           Version: 2.6
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: llvm at shiftleft.org
                CC: llvmbugs at cs.uiuc.edu

The SSE3 function _mm_alignr_epi8, which lowers to palignr, is given the wrong
immediate by both llvm-gcc and clang.

Version numbers:

llvm-gcc (GCC) 4.2.1 (Based on Apple Inc. build 5649) (LLVM build)

clang version 1.1 (trunk 85640)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.7svn
  DEBUG build with assertions.
  Built Oct 30 2009 (18:06:39).
  Host: x86_64-unknown-linux-gnu

gcc (Ubuntu 4.4.1-4ubuntu8) 4.4.1

Linux distro:
Ubuntu 8.10 "Karmic"
Linux peppercorn 2.6.31-16-generic #52-Ubuntu SMP Thu Dec 3 22:07:16 UTC 2009
x86_64 GNU/Linux

Test case:
#include <tmmintrin.h>

int main(int argc, char **argv) {
  __m128i x = _mm_setzero_si128(), y = _mm_alignr_epi8(x, x, 1);

  return 0;

$ llvm-gcc -S -mssse3 test.c -o - | grep palignr
        palignr $8, %xmm1, %xmm1

$ clang -S -mssse3 test.c -o - | grep palignr
        palignr $0, %xmm1, %xmm1

$ gcc -S -mssse3 test.c -o - | grep palignr
        palignr $1, %xmm1, %xmm0

gcc is correct, but clang and llvm-gcc give different wrong results.  From
other testing, it appears that llvm-gcc always sets the immediate too high by a
factor of 8.  Clang sometimes sets it to 0 and sometimes sets it to 1.

The code in the test case is obviously dead, but the optimizer is off here and
the bug occurs in real code as well.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list