From f29267bea11539c27bcaa6ebe540407f37ec9d3d Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 11 Sep 2019 14:18:48 +0000 Subject: [PATCH] [ConstProp] add tests for fma that produce NaN; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371621 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/ConstProp/fma.ll | 133 +++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/test/Transforms/ConstProp/fma.ll b/test/Transforms/ConstProp/fma.ll index f7d172fc482..7428676ac8d 100644 --- a/test/Transforms/ConstProp/fma.ll +++ b/test/Transforms/ConstProp/fma.ll @@ -124,3 +124,136 @@ define double @test_Inf_4() { %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF0000000000000, double 0.0) ret double %1 } + +; -inf + inf --> NaN + +define double @inf_product_opposite_inf_addend_1() { +; CHECK-LABEL: @inf_product_opposite_inf_addend_1( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 7.000000e+00, double 0xFFF0000000000000, double 0x7FF0000000000000) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF0000000000000, double 0x7FF0000000000000) + ret double %1 +} + +; inf + -inf --> NaN + +define double @inf_product_opposite_inf_addend_2() { +; CHECK-LABEL: @inf_product_opposite_inf_addend_2( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 7.000000e+00, double 0x7FF0000000000000, double 0xFFF0000000000000) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 7.0, double 0x7FF0000000000000, double 0xFFF0000000000000) + ret double %1 +} + +; -inf + inf --> NaN + +define double @inf_product_opposite_inf_addend_3() { +; CHECK-LABEL: @inf_product_opposite_inf_addend_3( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0xFFF0000000000000, double 4.200000e+01, double 0x7FF0000000000000) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double 42.0, double 0x7FF0000000000000) + ret double %1 +} + +; inf + -inf --> NaN + +define double @inf_product_opposite_inf_addend_4() { +; CHECK-LABEL: @inf_product_opposite_inf_addend_4( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0x7FF0000000000000, double 4.200000e+01, double 0xFFF0000000000000) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double 42.0, double 0xFFF0000000000000) + ret double %1 +} + +; 0 * -inf --> NaN + +define double @inf_times_zero_1() { +; CHECK-LABEL: @inf_times_zero_1( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0.000000e+00, double 0xFFF0000000000000, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0.0, double 0xFFF0000000000000, double 42.0) + ret double %1 +} + +; 0 * inf --> NaN + +define double @inf_times_zero_2() { +; CHECK-LABEL: @inf_times_zero_2( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0.000000e+00, double 0x7FF0000000000000, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0.0, double 0x7FF0000000000000, double 42.0) + ret double %1 +} + +; -inf * 0 --> NaN + +define double @inf_times_zero_3() { +; CHECK-LABEL: @inf_times_zero_3( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0xFFF0000000000000, double 0.000000e+00, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double 0.0, double 42.0) + ret double %1 +} + +; inf * 0 --> NaN + +define double @inf_times_zero_4() { +; CHECK-LABEL: @inf_times_zero_4( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0x7FF0000000000000, double 0.000000e+00, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double 0.0, double 42.0) + ret double %1 +} + +; -0 * -inf --> NaN + +define double @inf_times_zero_5() { +; CHECK-LABEL: @inf_times_zero_5( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double -0.000000e+00, double 0xFFF0000000000000, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double -0.0, double 0xFFF0000000000000, double 42.0) + ret double %1 +} + +; -0 * inf --> NaN + +define double @inf_times_zero_6() { +; CHECK-LABEL: @inf_times_zero_6( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double -0.000000e+00, double 0x7FF0000000000000, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double -0.0, double 0x7FF0000000000000, double 42.0) + ret double %1 +} + +; -inf * -0 --> NaN + +define double @inf_times_zero_7() { +; CHECK-LABEL: @inf_times_zero_7( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0xFFF0000000000000, double -0.000000e+00, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double -0.0, double 42.0) + ret double %1 +} + +; inf * -0 --> NaN + +define double @inf_times_zero_8() { +; CHECK-LABEL: @inf_times_zero_8( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fma.f64(double 0x7FF0000000000000, double -0.000000e+00, double 4.200000e+01) +; CHECK-NEXT: ret double [[TMP1]] +; + %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double -0.0, double 42.0) + ret double %1 +} + -- 2.40.0