[llvm] [PowerPC] Mark llvm.tan on vectors as expand (PR #95507)

Qiu Chaofan via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 23:04:50 PDT 2024


https://github.com/ecnelises created https://github.com/llvm/llvm-project/pull/95507

None

>From d40c52d22d647c2c034df60ad24aaa2d469e8dad Mon Sep 17 00:00:00 2001
From: Qiu Chaofan <qiucofan at cn.ibm.com>
Date: Fri, 14 Jun 2024 14:00:14 +0800
Subject: [PATCH] [PowerPC] Mark llvm.tan on vectors as expand

---
 llvm/lib/Target/PowerPC/PPCISelLowering.cpp              | 1 +
 .../test/CodeGen/PowerPC/lower-intrinsics-nofast-mass.ll | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 12e33ddb8eb53..e922b5d445e68 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -860,6 +860,7 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
       setOperationAction(ISD::FEXP2, VT, Expand);
       setOperationAction(ISD::FSIN, VT, Expand);
       setOperationAction(ISD::FCOS, VT, Expand);
+      setOperationAction(ISD::FTAN, VT, Expand);
       setOperationAction(ISD::FABS, VT, Expand);
       setOperationAction(ISD::FFLOOR, VT, Expand);
       setOperationAction(ISD::FCEIL,  VT, Expand);
diff --git a/llvm/test/CodeGen/PowerPC/lower-intrinsics-nofast-mass.ll b/llvm/test/CodeGen/PowerPC/lower-intrinsics-nofast-mass.ll
index 3d6e6da3b66d9..0c49d10e675a7 100644
--- a/llvm/test/CodeGen/PowerPC/lower-intrinsics-nofast-mass.ll
+++ b/llvm/test/CodeGen/PowerPC/lower-intrinsics-nofast-mass.ll
@@ -145,3 +145,12 @@ entry:
   %0 = tail call double @llvm.sin.f64(double %a)
   ret double %0
 }
+
+define <2 x double> @tan_v2f64_nofast(<2 x double> %a) {
+; CHECK-LABEL: tan_v2f64_nofast
+; CHECK-NOT: bl __xl_tan
+; CHECK: blr
+entry:
+  %0 = tail call <2 x double> @llvm.tan.v2f64(<2 x double> %a)
+  ret <2 x double> %0
+}



More information about the llvm-commits mailing list