[llvm] d748e75 - [InstSimplify] add tests for FP poison; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 12 05:32:11 PDT 2020
Author: Sanjay Patel
Date: 2020-03-12T08:32:04-04:00
New Revision: d748e759d56c50c0d5e2a166c65047785b397adc
URL: https://github.com/llvm/llvm-project/commit/d748e759d56c50c0d5e2a166c65047785b397adc
DIFF: https://github.com/llvm/llvm-project/commit/d748e759d56c50c0d5e2a166c65047785b397adc.diff
LOG: [InstSimplify] add tests for FP poison; NFC
Adapted from codegen tests seen in D75576.
Added:
Modified:
llvm/test/Transforms/InstSimplify/fp-undef.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/fp-undef.ll b/llvm/test/Transforms/InstSimplify/fp-undef.ll
index 32d219c1835f..1319c2e17624 100644
--- a/llvm/test/Transforms/InstSimplify/fp-undef.ll
+++ b/llvm/test/Transforms/InstSimplify/fp-undef.ll
@@ -162,3 +162,63 @@ define float @frem_undef_op1_fast(float %x) {
%r = frem fast float %x, undef
ret float %r
}
+
+define double @fdiv_ninf_nan_op0(double %x) {
+; CHECK-LABEL: @fdiv_ninf_nan_op0(
+; CHECK-NEXT: ret double 0xFFF8000000000000
+;
+ %r = fdiv ninf double 0xfff8000000000000, %x
+ ret double %r
+}
+
+define double @fadd_ninf_nan_op1(double %x) {
+; CHECK-LABEL: @fadd_ninf_nan_op1(
+; CHECK-NEXT: ret double 0x7FF8000000000000
+;
+ %r = fadd ninf double %x, 0x7ff8000000000000
+ ret double %r
+}
+
+; TODO: Should simplify to undef.
+
+define double @fdiv_ninf_inf_op0(double %x) {
+; CHECK-LABEL: @fdiv_ninf_inf_op0(
+; CHECK-NEXT: [[R:%.*]] = fdiv ninf double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fdiv ninf double 0x7ff0000000000000, %x
+ ret double %r
+}
+
+; TODO: Should simplify to undef.
+
+define double @fadd_ninf_inf_op1(double %x) {
+; CHECK-LABEL: @fadd_ninf_inf_op1(
+; CHECK-NEXT: [[R:%.*]] = fadd ninf double [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fadd ninf double %x, 0xfff0000000000000
+ ret double %r
+}
+
+; TODO: Should simplify to inf.
+
+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
+}
+
+; TODO: Should simplify to -inf.
+
+define double @fmul_nnan_inf_op1(double %x) {
+; CHECK-LABEL: @fmul_nnan_inf_op1(
+; CHECK-NEXT: [[R:%.*]] = fmul nnan double [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT: ret double [[R]]
+;
+ %r = fmul nnan double %x, 0xfff0000000000000
+ ret double %r
+}
More information about the llvm-commits
mailing list