[PowerPC] Implement vec_insert_exp builtins - llvm portion
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Wed, 26 Oct 2016 19:03:40 +0000 (19:03 +0000)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Wed, 26 Oct 2016 19:03:40 +0000 (19:03 +0000)
This revision corresponds to review: https://reviews.llvm.org/D25957.
Committing on behalf of Zaara Syeda.

llvm-svn: 285225

llvm/include/llvm/IR/IntrinsicsPowerPC.td
llvm/lib/Target/PowerPC/PPCInstrVSX.td
llvm/test/CodeGen/PowerPC/vsx-p9.ll

index 7f2633e..61f2c6e 100644 (file)
@@ -782,6 +782,12 @@ def int_ppc_vsx_xvcmpgtsp_p : GCCBuiltin<"__builtin_vsx_xvcmpgtsp_p">,
 def int_ppc_vsx_xxleqv :
       PowerPC_VSX_Intrinsic<"xxleqv", [llvm_v4i32_ty],
                             [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
+def int_ppc_vsx_xviexpdp :
+      PowerPC_VSX_Intrinsic<"xviexpdp",[llvm_v2f64_ty],
+                            [llvm_v2i64_ty, llvm_v2i64_ty],[IntrNoMem]>;
+def int_ppc_vsx_xviexpsp :
+      PowerPC_VSX_Intrinsic<"xviexpsp",[llvm_v4f32_ty],
+                            [llvm_v4i32_ty, llvm_v4i32_ty],[IntrNoMem]>;
 }
 
 //===----------------------------------------------------------------------===//
index 24411cb..b929e6d 100644 (file)
@@ -2191,9 +2191,9 @@ let AddedComplexity = 400, Predicates = [HasP9Vector] in {
 
   // Vector Insert Exponent DP/SP
   def XVIEXPDP : XX3_XT5_XA5_XB5<60, 248, "xviexpdp", vsrc, vsrc, vsrc,
-                                 IIC_VecFP, []>;
+    IIC_VecFP, [(set v2f64: $XT,(int_ppc_vsx_xviexpdp v2i64:$XA, v2i64:$XB))]>;
   def XVIEXPSP : XX3_XT5_XA5_XB5<60, 216, "xviexpsp", vsrc, vsrc, vsrc,
-                                 IIC_VecFP, []>;
+    IIC_VecFP, [(set v4f32: $XT,(int_ppc_vsx_xviexpsp v4i32:$XA, v4i32:$XB))]>;
 
   // Vector Extract Exponent/Significand DP/SP
   def XVXEXPDP : XX2_XT6_XO5_XB6<60,  0, 475, "xvxexpdp", vsrc, []>;
index 4b2dc77..1b092cf 100644 (file)
@@ -143,4 +143,28 @@ entry:
   ret void
 }
 
+; Function Attrs: nounwind readnone
+define <4 x float> @testXVIEXPSP(<4 x i32> %a, <4 x i32> %b) {
+entry:
+  %0 = tail call <4 x float> @llvm.ppc.vsx.xviexpsp(<4 x i32> %a, <4 x i32> %b)
+  ret <4 x float> %0
+; CHECK-LABEL: testXVIEXPSP
+; CHECK: xviexpsp 34, 34, 35
+; CHECK: blr
+}
+; Function Attrs: nounwind readnone
+declare <4 x float> @llvm.ppc.vsx.xviexpsp(<4 x i32>, <4 x i32>)
+
+; Function Attrs: nounwind readnone
+define <2 x double> @testXVIEXPDP(<2 x i64> %a, <2 x i64> %b) {
+entry:
+  %0 = tail call <2 x double> @llvm.ppc.vsx.xviexpdp(<2 x i64> %a, <2 x i64> %b)
+  ret <2 x double> %0
+; CHECK-LABEL: testXVIEXPDP
+; CHECK: xviexpdp 34, 34, 35
+; CHECK: blr
+}
+; Function Attrs: nounwind readnone
+declare <2 x double> @llvm.ppc.vsx.xviexpdp(<2 x i64>, <2 x i64>)
+
 declare void @sink(...)