r353969 - Re-enable the test disabled in r353836 and hopefully make it pass in gcc builds

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 11:04:26 PST 2019


Author: nico
Date: Wed Feb 13 11:04:26 2019
New Revision: 353969

URL: http://llvm.org/viewvc/llvm-project?rev=353969&view=rev
Log:
Re-enable the test disabled in r353836 and hopefully make it pass in gcc builds

Argument evaluation order is different between gcc and clang, so pull out
the Builder calls to make the generated IR independent of the host compiler's
argument evaluation order.  Thanks to rnk for reminding me of this clang/gcc
difference.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/test/CodeGen/ms-x86-intrinsics.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=353969&r1=353968&r2=353969&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Feb 13 11:04:26 2019
@@ -11854,9 +11854,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
     // Ops[2] = Builder.CreateZExt(Ops[2], Int64Ty);
     // return Builder.CreateCall(F, Ops);
     llvm::Type *Int128Ty = Builder.getInt128Ty();
-    Value *Val = Builder.CreateOr(
-        Builder.CreateShl(Builder.CreateZExt(Ops[1], Int128Ty), 64),
-        Builder.CreateZExt(Ops[0], Int128Ty));
+    Value *HighPart128 =
+        Builder.CreateShl(Builder.CreateZExt(Ops[1], Int128Ty), 64);
+    Value *LowPart128 = Builder.CreateZExt(Ops[0], Int128Ty);
+    Value *Val = Builder.CreateOr(HighPart128, LowPart128);
     Value *Amt = Builder.CreateAnd(Builder.CreateZExt(Ops[2], Int128Ty),
                                    llvm::ConstantInt::get(Int128Ty, 0x3f));
     Value *Res;

Modified: cfe/trunk/test/CodeGen/ms-x86-intrinsics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-x86-intrinsics.c?rev=353969&r1=353968&r2=353969&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-x86-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-x86-intrinsics.c Wed Feb 13 11:04:26 2019
@@ -143,33 +143,29 @@ unsigned __int64 test__shiftleft128(unsi
                                     unsigned char d) {
   return __shiftleft128(l, h, d);
 }
-// FIXME: Add ':' after all the CHECK-X64 lines here once it's understood
-// why the order of the output is different when using clang or gcc as host cc.
 // CHECK-X64-LABEL: define dso_local i64 @test__shiftleft128(i64 %l, i64 %h, i8 %d)
 // CHECK-X64:  = zext i64 %{{.*}} to i128
-// CHECK-X64  = shl nuw i128 %{{.*}}, 64
-// CHECK-X64  = zext i64 %{{.*}} to i128
-// CHECK-X64  = or i128 %
-// CHECK-X64  = and i8 %{{.*}}, 63
-// CHECK-X64  = shl i128 %
-// CHECK-X64  = lshr i128 %
-// CHECK-X64  = trunc i128 %
+// CHECK-X64: = shl nuw i128 %{{.*}}, 64
+// CHECK-X64: = zext i64 %{{.*}} to i128
+// CHECK-X64: = or i128 %
+// CHECK-X64: = and i8 %{{.*}}, 63
+// CHECK-X64: = shl i128 %
+// CHECK-X64: = lshr i128 %
+// CHECK-X64: = trunc i128 %
 // CHECK-X64:  ret i64 %
 
 unsigned __int64 test__shiftright128(unsigned __int64 l, unsigned __int64 h,
                                      unsigned char d) {
   return __shiftright128(l, h, d);
 }
-// FIXME: Add ':' after all the CHECK-X64 lines here once it's understood
-// why the order of the output is different when using clang or gcc as host cc.
 // CHECK-X64-LABEL: define dso_local i64 @test__shiftright128(i64 %l, i64 %h, i8 %d)
 // CHECK-X64:  = zext i64 %{{.*}} to i128
-// CHECK-X64  = shl nuw i128 %{{.*}}, 64
-// CHECK-X64  = zext i64 %{{.*}} to i128
-// CHECK-X64  = or i128 %
-// CHECK-X64  = and i8 %{{.*}}, 63
-// CHECK-X64  = lshr i128 %
-// CHECK-X64  = trunc i128 %
+// CHECK-X64: = shl nuw i128 %{{.*}}, 64
+// CHECK-X64: = zext i64 %{{.*}} to i128
+// CHECK-X64: = or i128 %
+// CHECK-X64: = and i8 %{{.*}}, 63
+// CHECK-X64: = lshr i128 %
+// CHECK-X64: = trunc i128 %
 // CHECK-X64:  ret i64 %
 
 #endif // defined(__x86_64__)




More information about the cfe-commits mailing list