[PATCH] D84962: [PowerPC] Correct cpsgn's behaviour on PowerPC to match that of the ABI

Albion Fung via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 12:25:00 PDT 2020


Conanap updated this revision to Diff 292589.
Conanap added a comment.
Herald added a subscriber: kbarton.

Added extra test case to demonstrate that the arguments will be reversed


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84962/new/

https://reviews.llvm.org/D84962

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-ppc-vsx.c


Index: clang/test/CodeGen/builtins-ppc-vsx.c
===================================================================
--- clang/test/CodeGen/builtins-ppc-vsx.c
+++ clang/test/CodeGen/builtins-ppc-vsx.c
@@ -1832,3 +1832,10 @@
 // CHECK-NEXT-LE: %{{[0-9]+}} = extractelement <2 x i64> %[[V1]], i32 0
 
 }
+
+void testVectorCpsgn(vector float a, vector float b) {
+// CHECK-LABEL: testVectorCpsgn
+// %5 is b, %4 is a
+// CHECK: %6 = call <4 x float> @llvm.copysign.v4f32(<4 x float> %5, <4 x float> %4) 
+  vec_cpsgn(a, b);
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -14236,7 +14236,7 @@
     Value *Y = EmitScalarExpr(E->getArg(1));
     ID = Intrinsic::copysign;
     llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
-    return Builder.CreateCall(F, {X, Y});
+    return Builder.CreateCall(F, {Y, X});
   }
   // Rounding/truncation
   case PPC::BI__builtin_vsx_xvrspip:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84962.292589.patch
Type: text/x-patch
Size: 1014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200917/3477ac89/attachment.bin>


More information about the llvm-commits mailing list