[llvm-branch-commits] [cfe-branch] r242692 - Merging r242678:

Hans Wennborg hans at hanshq.net
Mon Jul 20 11:12:14 PDT 2015


Author: hans
Date: Mon Jul 20 13:12:14 2015
New Revision: 242692

URL: http://llvm.org/viewvc/llvm-project?rev=242692&view=rev
Log:
Merging r242678:
------------------------------------------------------------------------
r242678 | d0k | 2015-07-20 08:31:17 -0700 (Mon, 20 Jul 2015) | 4 lines

[CodeGen] Flip lanes when lowering __builtin_palignr with one lane

Otherwise we'd pick the wrong lane for the resulting shuffle and
miscompile code. PR24187.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_37/   (props changed)
    cfe/branches/release_37/lib/CodeGen/CGBuiltin.cpp
    cfe/branches/release_37/test/CodeGen/palignr.c

Propchange: cfe/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 20 13:12:14 2015
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:242244,242285,242293,242297,242313,242382,242422,242499,242574
+/cfe/trunk:242244,242285,242293,242297,242313,242382,242422,242499,242574,242678
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_37/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/lib/CodeGen/CGBuiltin.cpp?rev=242692&r1=242691&r2=242692&view=diff
==============================================================================
--- cfe/branches/release_37/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/branches/release_37/lib/CodeGen/CGBuiltin.cpp Mon Jul 20 13:12:14 2015
@@ -6238,6 +6238,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
     // but less than two lanes, convert to shifting in zeroes.
     if (ShiftVal > NumLaneElts) {
       ShiftVal -= NumLaneElts;
+      Ops[1] = Ops[0];
       Ops[0] = llvm::Constant::getNullValue(Ops[0]->getType());
     }
 

Modified: cfe/branches/release_37/test/CodeGen/palignr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_37/test/CodeGen/palignr.c?rev=242692&r1=242691&r2=242692&view=diff
==============================================================================
--- cfe/branches/release_37/test/CodeGen/palignr.c (original)
+++ cfe/branches/release_37/test/CodeGen/palignr.c Mon Jul 20 13:12:14 2015
@@ -4,13 +4,13 @@
 #define _mm_alignr_epi8(a, b, n) (__builtin_ia32_palignr128((a), (b), (n)))
 typedef __attribute__((vector_size(16))) int int4;
 
-// CHECK: palignr
+// CHECK: palignr $15, %xmm1, %xmm0
 int4 align1(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 15); }
 // CHECK: ret
 // CHECK: ret
 // CHECK-NOT: palignr
 int4 align2(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 16); }
-// CHECK: psrldq
+// CHECK: psrldq $1, %xmm0
 int4 align3(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 17); }
 // CHECK: xor
 int4 align4(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 32); }





More information about the llvm-branch-commits mailing list