[llvm] [InstSimplify] Add basic constant folding for `llvm.sincos` (PR #114527)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 07:41:29 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
+}
+
----------------
MacDue wrote:
I've added some normal value tests using matching the result values (and checking they're used consistently). I avoided this initially as the result for most normal values is displayed in hexadecimal (like `0x3FED18F6E0000000`), which didn't seem that helpful.
https://github.com/llvm/llvm-project/pull/114527
More information about the llvm-commits
mailing list