[InstCombine] Remove insertRangeTest code that handles the equality case.
[llvm-complete.git] / test / Transforms / InstSimplify / fold-builtin-fma.ll
blob6331b8c2dd43ec15004f69b7fe6c661d91d20900
1 ; RUN: opt -instsimplify -S < %s | FileCheck %s
3 ; Fixes PR20832
4 ; Make sure that we correctly fold a fused multiply-add where operands
5 ; are all finite constants and addend is zero.
7 declare double @llvm.fma.f64(double, double, double)
10 define double @PR20832()  {
11   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
12   ret double %1
14 ; CHECK-LABEL: @PR20832(
15 ; CHECK: ret double 5.600000e+01
17 ; Test builtin fma with all finite non-zero constants.
18 define double @test_all_finite()  {
19   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 5.0)
20   ret double %1
22 ; CHECK-LABEL: @test_all_finite(
23 ; CHECK: ret double 6.100000e+01
25 ; Test builtin fma with a +/-NaN addend.
26 define double @test_NaN_addend()  {
27   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0x7FF8000000000000)
28   ret double %1
30 ; CHECK-LABEL: @test_NaN_addend(
31 ; CHECK: ret double 0x7FF8000000000000
33 define double @test_NaN_addend_2()  {
34   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0xFFF8000000000000)
35   ret double %1
37 ; CHECK-LABEL: @test_NaN_addend_2(
38 ; CHECK: ret double 0xFFF8000000000000
40 ; Test builtin fma with a +/-Inf addend.
41 define double @test_Inf_addend()  {
42   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0x7FF0000000000000)
43   ret double %1
45 ; CHECK-LABEL: @test_Inf_addend(
46 ; CHECK: ret double 0x7FF0000000000000
48 define double @test_Inf_addend_2()  {
49   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0xFFF0000000000000)
50   ret double %1
52 ; CHECK-LABEL: @test_Inf_addend_2(
53 ; CHECK: ret double 0xFFF0000000000000
55 ; Test builtin fma with one of the operands to the multiply being +/-NaN.
56 define double @test_NaN_1()  {
57   %1 = call double @llvm.fma.f64(double 0x7FF8000000000000, double 8.0, double 0.0)
58   ret double %1
60 ; CHECK-LABEL: @test_NaN_1(
61 ; CHECK: ret double 0x7FF8000000000000
64 define double @test_NaN_2()  {
65   %1 = call double @llvm.fma.f64(double 7.0, double 0x7FF8000000000000, double 0.0)
66   ret double %1
68 ; CHECK-LABEL: @test_NaN_2(
69 ; CHECK: ret double 0x7FF8000000000000
72 define double @test_NaN_3()  {
73   %1 = call double @llvm.fma.f64(double 0xFFF8000000000000, double 8.0, double 0.0)
74   ret double %1
76 ; CHECK-LABEL: @test_NaN_3(
77 ; CHECK: ret double 0x7FF8000000000000
80 define double @test_NaN_4()  {
81   %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF8000000000000, double 0.0)
82   ret double %1
84 ; CHECK-LABEL: @test_NaN_4(
85 ; CHECK: ret double 0x7FF8000000000000
88 ; Test builtin fma with one of the operands to the multiply being +/-Inf.
89 define double @test_Inf_1()  {
90   %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double 8.0, double 0.0)
91   ret double %1
93 ; CHECK-LABEL: @test_Inf_1(
94 ; CHECK: ret double 0x7FF0000000000000
97 define double @test_Inf_2()  {
98   %1 = call double @llvm.fma.f64(double 7.0, double 0x7FF0000000000000, double 0.0)
99   ret double %1
101 ; CHECK-LABEL: @test_Inf_2(
102 ; CHECK: ret double 0x7FF0000000000000
105 define double @test_Inf_3()  {
106   %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double 8.0, double 0.0)
107   ret double %1
109 ; CHECK-LABEL: @test_Inf_3(
110 ; CHECK: ret double 0xFFF0000000000000
113 define double @test_Inf_4()  {
114   %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF0000000000000, double 0.0)
115   ret double %1
117 ; CHECK-LABEL: @test_Inf_4(
118 ; CHECK: ret double 0xFFF0000000000000