[llvm] 58167f6 - [InstSimplify] add tests for fadd/fsub with inf constant operand; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 14:15:04 PST 2022
Author: Sanjay Patel
Date: 2022-11-10T17:13:26-05:00
New Revision: 58167f67dc813e09ebd06e09a79f6ec2b8773ce3
URL: https://github.com/llvm/llvm-project/commit/58167f67dc813e09ebd06e09a79f6ec2b8773ce3
DIFF: https://github.com/llvm/llvm-project/commit/58167f67dc813e09ebd06e09a79f6ec2b8773ce3.diff
LOG: [InstSimplify] add tests for fadd/fsub with inf constant operand; NFC
Added:
Modified:
llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
index d82e3bc3fada3..10a709e6f1b24 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
@@ -815,3 +815,93 @@ define float @maxnum_with_pos_one_op(float %a) {
%fabs = call float @llvm.fabs.f32(float %max)
ret float %fabs
}
+
+define double @fadd_nnan_inf_op0(double %x) {
+; CHECK-LABEL: @fadd_nnan_inf_op0(
+; CHECK-NEXT: [[R:%.*]] = fadd nnan double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fadd nnan double 0x7ff0000000000000, %x
+ ret double %r
+}
+
+define double @fadd_nnan_inf_op1(double %x) {
+; CHECK-LABEL: @fadd_nnan_inf_op1(
+; CHECK-NEXT: [[R:%.*]] = fadd nnan double [[X:%.*]], 0x7FF0000000000000
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fadd nnan double %x, 0x7ff0000000000000
+ ret double %r
+}
+
+define <2 x double> @fadd_nnan_neginf_op1(<2 x double> %x) {
+; CHECK-LABEL: @fadd_nnan_neginf_op1(
+; CHECK-NEXT: [[R:%.*]] = fadd nnan <2 x double> [[X:%.*]], <double 0xFFF0000000000000, double poison>
+; CHECK-NEXT: ret <2 x double> [[R]]
+;
+ %r = fadd nnan <2 x double> %x, <double 0xfff0000000000000, double poison>
+ ret <2 x double> %r
+}
+
+define double @fadd_nnan_neginf_op0(double %x) {
+; CHECK-LABEL: @fadd_nnan_neginf_op0(
+; CHECK-NEXT: [[R:%.*]] = fadd nnan double 0xFFF0000000000000, [[X:%.*]]
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fadd nnan double 0xfff0000000000000, %x
+ ret double %r
+}
+
+define double @fadd_inf_op0(double %x) {
+; CHECK-LABEL: @fadd_inf_op0(
+; CHECK-NEXT: [[R:%.*]] = fadd double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fadd double 0x7ff0000000000000, %x
+ ret double %r
+}
+
+define double @fsub_nnan_inf_op0(double %x) {
+; CHECK-LABEL: @fsub_nnan_inf_op0(
+; CHECK-NEXT: [[R:%.*]] = fsub nnan double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fsub nnan double 0x7ff0000000000000, %x
+ ret double %r
+}
+
+define double @fsub_nnan_inf_op1(double %x) {
+; CHECK-LABEL: @fsub_nnan_inf_op1(
+; CHECK-NEXT: [[R:%.*]] = fsub nnan double [[X:%.*]], 0x7FF0000000000000
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fsub nnan double %x, 0x7ff0000000000000
+ ret double %r
+}
+
+define <2 x double> @fsub_nnan_neginf_op0(<2 x double> %x) {
+; CHECK-LABEL: @fsub_nnan_neginf_op0(
+; CHECK-NEXT: [[R:%.*]] = fsub nnan <2 x double> <double 0xFFF0000000000000, double poison>, [[X:%.*]]
+; CHECK-NEXT: ret <2 x double> [[R]]
+;
+ %r = fsub nnan <2 x double> <double 0xfff0000000000000, double poison>, %x
+ ret <2 x double> %r
+}
+
+define double @fsub_nnan_neginf_op1(double %x) {
+; CHECK-LABEL: @fsub_nnan_neginf_op1(
+; CHECK-NEXT: [[R:%.*]] = fsub nnan double [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fsub nnan double %x, 0xfff0000000000000
+ ret double %r
+}
+
+define double @fsub_inf_op0(double %x) {
+; CHECK-LABEL: @fsub_inf_op0(
+; CHECK-NEXT: [[R:%.*]] = fsub double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fsub double 0x7ff0000000000000, %x
+ ret double %r
+}
More information about the llvm-commits
mailing list