From d748e759d56c50c0d5e2a166c65047785b397adc Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 12 Mar 2020 08:08:36 -0400 Subject: [PATCH] [InstSimplify] add tests for FP poison; NFC Adapted from codegen tests seen in D75576. --- llvm/test/Transforms/InstSimplify/fp-undef.ll | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/llvm/test/Transforms/InstSimplify/fp-undef.ll b/llvm/test/Transforms/InstSimplify/fp-undef.ll index 32d219c..1319c2e 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 +} -- 2.7.4