[llvm] [InstSimplify] Add basic constant folding for `llvm.sincos` (PR #114527)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 12:10:04 PST 2024


================
@@ -0,0 +1,125 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
+; RUN: opt -S -passes=instsimplify %s | FileCheck %s
+
+define { float, float } @sincos_zero() {
+; CHECK-LABEL: define { float, float } @sincos_zero() {
+; CHECK-NEXT:    ret { float, float } { float 0.000000e+00, float 1.000000e+00 }
+;
+  %ret = call { float, float } @llvm.sincos.f32(float zeroinitializer)
+  ret { float, float } %ret
+}
+
+define { float, float } @sincos_neg_zero() {
+; CHECK-LABEL: define { float, float } @sincos_neg_zero() {
+; CHECK-NEXT:    ret { float, float } { float -0.000000e+00, float 1.000000e+00 }
+;
+  %ret = call { float, float } @llvm.sincos.f32(float -0.0)
+  ret { float, float } %ret
+}
+
----------------
arsenm wrote:

No tests for normal values? 

https://github.com/llvm/llvm-project/pull/114527


More information about the llvm-commits mailing list