[llvm] [Transforms] Let amdgcn take advantage of sin(-x) --> -sin(x) (PR #79700)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 31 12:45:31 PST 2024
================
@@ -1023,6 +1023,50 @@ define float @cos_fabs_unary_fneg_f32(float %x) {
ret float %cos
}
+
+; --------------------------------------------------------------------
+; llvm.amdgcn.sin
+; --------------------------------------------------------------------
+declare float @llvm.amdgcn.sin.f32(float) nounwind readnone
+
+; CHECK-NEXT: ret float %cos
+define float @sin_fneg_f32(float %x) {
+; CHECK-LABEL: @sin_fneg_f32(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.amdgcn.sin.f32(float [[X:%.*]])
+; CHECK-NEXT: [[SIN:%.*]] = fneg float [[TMP1]]
+; CHECK-NEXT: ret float [[SIN]]
+;
+ %x.fneg = fsub float -0.0, %x
----------------
AtariDreams wrote:
Other test has that.
https://github.com/llvm/llvm-project/pull/79700
More information about the llvm-commits
mailing list