[llvm] 67cb38c - [HIPSTDPAR] Add `sincos` support (#224620)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 04:20:46 PDT 2026
Author: Alex Voicu
Date: 2026-09-20T12:20:39+01:00
New Revision: 67cb38c384b5e4a3a75b436259a6e20c8d9fbffd
URL: https://github.com/llvm/llvm-project/commit/67cb38c384b5e4a3a75b436259a6e20c8d9fbffd
DIFF: https://github.com/llvm/llvm-project/commit/67cb38c384b5e4a3a75b436259a6e20c8d9fbffd.diff
LOG: [HIPSTDPAR] Add `sincos` support (#224620)
The math fixup pass for `hipstdpar` only supported standard library math
functions. Due to #194616, combining `sin` + `cos` into `sincos` becomes
possible, so whilst `sincos` itself is not (yet) a standard library
interface, it has to be handled as well. This extends the set of covered
intrinsics to include it.
Added:
Modified:
llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
llvm/test/Transforms/HipStdPar/math-fixup.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
index d895cd7d78bf6..17ca146f6a024 100644
--- a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
+++ b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
@@ -601,6 +601,7 @@ PreservedAnalyses HipStdParMathFixupPass::run(Module &M,
case Intrinsic::atan2:
case Intrinsic::cosh:
case Intrinsic::modf:
+ case Intrinsic::sincos:
case Intrinsic::sinh:
case Intrinsic::tan:
case Intrinsic::tanh:
diff --git a/llvm/test/Transforms/HipStdPar/math-fixup.ll b/llvm/test/Transforms/HipStdPar/math-fixup.ll
index 2c4622cb1f603..f634f247406ed 100644
--- a/llvm/test/Transforms/HipStdPar/math-fixup.ll
+++ b/llvm/test/Transforms/HipStdPar/math-fixup.ll
@@ -375,6 +375,21 @@ entry:
ret void
}
+define void @test_sincos(float %flt, double %dbl, ptr %psflt, ptr %pcflt,
+; CHECK-LABEL: define void @test_sincos(
+; CHECK-SAME: float [[FLT:%.*]], double [[DBL:%.*]], ptr [[PSFLT:%.*]], ptr [[PCFLT:%.*]], ptr [[PSDBL:%.*]], ptr [[PCDBL:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[TMP0:%.*]] = call { float, float } @__hipstdpar_sincos_f32(float [[FLT]])
+; CHECK-NEXT: [[TMP1:%.*]] = call { double, double } @__hipstdpar_sincos_f64(double [[DBL]])
+; CHECK-NEXT: ret void
+;
+ ptr %psdbl, ptr %pcdbl) {
+entry:
+ %0 = call {float, float} @llvm.sincos.f32(float %flt)
+ %1 = call {double, double} @llvm.sincos.f64(double %dbl)
+ ret void
+}
+
define void @test_sinh(double %dbl, float %flt) {
; CHECK-LABEL: define void @test_sinh(
; CHECK-SAME: double [[DBL:%.*]], float [[FLT:%.*]]) {
More information about the llvm-commits
mailing list