[llvm] r241398 - Add missing builtins to the PPC back end for ABI compliance (vol. 2)
Nemanja Ivanovic
nemanja.i.ibm at gmail.com
Sat Jul 4 23:03:52 PDT 2015
Author: nemanjai
Date: Sun Jul 5 01:03:51 2015
New Revision: 241398
URL: http://llvm.org/viewvc/llvm-project?rev=241398&view=rev
Log:
Add missing builtins to the PPC back end for ABI compliance (vol. 2)
This patch corresponds to review:
http://reviews.llvm.org/D10874
Back end portion of the second round of additions to altivec.h.
Modified:
llvm/trunk/include/llvm/IR/IntrinsicsPowerPC.td
llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td
llvm/trunk/test/CodeGen/PowerPC/vsx-elementary-arith.ll
Modified: llvm/trunk/include/llvm/IR/IntrinsicsPowerPC.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IntrinsicsPowerPC.td?rev=241398&r1=241397&r2=241398&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IntrinsicsPowerPC.td (original)
+++ llvm/trunk/include/llvm/IR/IntrinsicsPowerPC.td Sun Jul 5 01:03:51 2015
@@ -694,6 +694,12 @@ def int_ppc_vsx_xvrspip :
def int_ppc_vsx_xvrdpip :
Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
+// Vector rsqrte
+def int_ppc_vsx_xvrsqrtesp : GCCBuiltin<"__builtin_vsx_xvrsqrtesp">,
+ Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
+def int_ppc_vsx_xvrsqrtedp : GCCBuiltin<"__builtin_vsx_xvrsqrtedp">,
+ Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
+
// Vector compare
def int_ppc_vsx_xvcmpeqdp :
PowerPC_VSX_Intrinsic<"xvcmpeqdp", [llvm_v2i64_ty],
Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td?rev=241398&r1=241397&r2=241398&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrVSX.td Sun Jul 5 01:03:51 2015
@@ -989,6 +989,12 @@ def : Pat<(int_ppc_vsx_xvdivsp v4f32:$A,
def : Pat<(int_ppc_vsx_xvdivdp v2f64:$A, v2f64:$B),
(XVDIVDP $A, $B)>;
+// Recip. square root estimate
+def : Pat<(int_ppc_vsx_xvrsqrtesp v4f32:$A),
+ (XVRSQRTESP $A)>;
+def : Pat<(int_ppc_vsx_xvrsqrtedp v2f64:$A),
+ (XVRSQRTEDP $A)>;
+
} // AddedComplexity
} // HasVSX
Modified: llvm/trunk/test/CodeGen/PowerPC/vsx-elementary-arith.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/vsx-elementary-arith.ll?rev=241398&r1=241397&r2=241398&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/vsx-elementary-arith.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/vsx-elementary-arith.ll Sun Jul 5 01:03:51 2015
@@ -116,5 +116,36 @@ entry:
; CHECK: xssqrtdp {{[0-9]+}}
}
+; Vector forms
+; Function Attrs: nounwind
+define <4 x float> @emit_xvrsqrtesp() {
+entry:
+; CHECK-LABEL: @emit_xvrsqrtesp
+ %vf = alloca <4 x float>, align 16
+ %vfr = alloca <4 x float>, align 16
+ %0 = load <4 x float>, <4 x float>* %vf, align 16
+ %call = call <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float> %0)
+; CHECK: xvrsqrtesp {{[0-9]+}}, {{[0-9]+}}
+ ret <4 x float> %call
+}
+
+; Function Attrs: nounwind
+define <2 x double> @emit_xvrsqrtedp() {
+entry:
+; CHECK-LABEL: @emit_xvrsqrtedp
+ %vd = alloca <2 x double>, align 16
+ %vdr = alloca <2 x double>, align 16
+ %0 = load <2 x double>, <2 x double>* %vd, align 16
+ %call = call <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double> %0)
+ ret <2 x double> %call
+; CHECK: xvrsqrtedp {{[0-9]+}}, {{[0-9]+}}
+}
+
; Function Attrs: nounwind
declare double @sqrt(double)
+
+; Function Attrs: nounwind readnone
+declare <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float>)
+
+; Function Attrs: nounwind readnone
+declare <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double>)
More information about the llvm-commits
mailing list