|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: opt < %s -passes=instcombine -S | FileCheck %s |
| 3 | + |
| 4 | +define double @fdim_double() { |
| 5 | +; CHECK-LABEL: define double @fdim_double() { |
| 6 | +; CHECK-NEXT: ret double 2.500000e+00 |
| 7 | +; |
| 8 | + %dim = call double @fdim(double 10.5, double 8.0) |
| 9 | + ret double %dim |
| 10 | +} |
| 11 | + |
| 12 | +define double @fdim_double1() { |
| 13 | +; CHECK-LABEL: define double @fdim_double1() { |
| 14 | +; CHECK-NEXT: ret double 0.000000e+00 |
| 15 | +; |
| 16 | + %dim = call double @fdim(double 7.0, double 8.0) |
| 17 | + ret double %dim |
| 18 | +} |
| 19 | + |
| 20 | +define float @fdim_float() { |
| 21 | +; CHECK-LABEL: define float @fdim_float() { |
| 22 | +; CHECK-NEXT: ret float 0.000000e+00 |
| 23 | +; |
| 24 | + %dim = call float @fdimf(float 1.500000e+00, float 8.0) |
| 25 | + ret float %dim |
| 26 | +} |
| 27 | + |
| 28 | +define float @fdim_float1() { |
| 29 | +; CHECK-LABEL: define float @fdim_float1() { |
| 30 | +; CHECK-NEXT: ret float 2.000000e+00 |
| 31 | +; |
| 32 | + %dim = call float @fdimf(float 1.000000e+01, float 8.0) |
| 33 | + ret float %dim |
| 34 | +} |
| 35 | + |
| 36 | +define double @fdim_poison1() { |
| 37 | +; CHECK-LABEL: define double @fdim_poison1() { |
| 38 | +; CHECK-NEXT: ret double poison |
| 39 | +; |
| 40 | + %dim = call double @fdim(double poison, double 1.0) |
| 41 | + ret double %dim |
| 42 | +} |
| 43 | + |
| 44 | +define double @fdim_poison2() { |
| 45 | +; CHECK-LABEL: define double @fdim_poison2() { |
| 46 | +; CHECK-NEXT: ret double poison |
| 47 | +; |
| 48 | + %dim = call double @fdim(double 1.0, double poison) |
| 49 | + ret double %dim |
| 50 | +} |
| 51 | + |
| 52 | +define double @fdim_poison3() { |
| 53 | +; CHECK-LABEL: define double @fdim_poison3() { |
| 54 | +; CHECK-NEXT: ret double poison |
| 55 | +; |
| 56 | + %dim = call double @fdim(double poison, double poison) |
| 57 | + ret double %dim |
| 58 | +} |
| 59 | + |
| 60 | +; undef folding is not implemented yet |
| 61 | +define double @fdim_undef1() { |
| 62 | +; CHECK-LABEL: define double @fdim_undef1() { |
| 63 | +; CHECK-NEXT: [[DIM:%.*]] = call double @fdim(double undef, double 1.000000e+00) |
| 64 | +; CHECK-NEXT: ret double [[DIM]] |
| 65 | +; |
| 66 | + %dim = call double @fdim(double undef, double 1.0) |
| 67 | + ret double %dim |
| 68 | +} |
| 69 | + |
| 70 | +define double @fdim_inf_ninf() { |
| 71 | +; CHECK-LABEL: define double @fdim_inf_ninf() { |
| 72 | +; CHECK-NEXT: ret double 0x7FF0000000000000 |
| 73 | +; |
| 74 | + %dim = call double @fdim(double 0x7FF0000000000000, double 0x8000000000000000 ) |
| 75 | + ret double %dim |
| 76 | +} |
| 77 | + |
| 78 | +define double @fdim_inf() { |
| 79 | +; CHECK-LABEL: define double @fdim_inf() { |
| 80 | +; CHECK-NEXT: ret double 0x7FF8000000000000 |
| 81 | +; |
| 82 | + %dim = call double @fdim(double 0x7FF0000000000000, double 0x7FF0000000000000) |
| 83 | + ret double %dim |
| 84 | +} |
| 85 | + |
| 86 | +define double @fdim_nzero() { |
| 87 | +; CHECK-LABEL: define double @fdim_nzero() { |
| 88 | +; CHECK-NEXT: ret double 0.000000e+00 |
| 89 | +; |
| 90 | + %dim = call double @fdim(double -0.0, double +0.0) |
| 91 | + ret double %dim |
| 92 | +} |
| 93 | + |
| 94 | +define double @fdim_strictfp() { |
| 95 | +; CHECK-LABEL: define double @fdim_strictfp() { |
| 96 | +; CHECK-NEXT: [[DIM:%.*]] = call double @fdim(double 1.000000e+01, double 8.000000e+00) #[[ATTR1:[0-9]+]] |
| 97 | +; CHECK-NEXT: ret double [[DIM]] |
| 98 | +; |
| 99 | + %dim = call double @fdim(double 10.0, double 8.0) strictfp |
| 100 | + ret double %dim |
| 101 | +} |
| 102 | + |
| 103 | +define double @fdim_nan1() { |
| 104 | +; CHECK-LABEL: define double @fdim_nan1() { |
| 105 | +; CHECK-NEXT: ret double 0x7FF8000000000000 |
| 106 | +; |
| 107 | + %dim = call double @fdim(double 10.0, double 0x7FF8000000000000) |
| 108 | + ret double %dim |
| 109 | +} |
| 110 | + |
| 111 | + |
| 112 | +define double @fdim_nan2() { |
| 113 | +; CHECK-LABEL: define double @fdim_nan2() { |
| 114 | +; CHECK-NEXT: ret double 0x7FF8000000000000 |
| 115 | +; |
| 116 | + %dim = call double @fdim(double 0x7FF8000000000000, double 1.4) |
| 117 | + ret double %dim |
| 118 | +} |
| 119 | + |
| 120 | +define double @fdim_snan1() { |
| 121 | +; CHECK-LABEL: define double @fdim_snan1() { |
| 122 | +; CHECK-NEXT: ret double 0x7FFC000000000000 |
| 123 | +; |
| 124 | + %dim = call double @fdim(double 0x7FF4000000000000, double 1.4) |
| 125 | + ret double %dim |
| 126 | +} |
| 127 | + |
| 128 | +define double @fdim_snan2() { |
| 129 | +; CHECK-LABEL: define double @fdim_snan2() { |
| 130 | +; CHECK-NEXT: ret double 0x7FFC000000000000 |
| 131 | +; |
| 132 | + %dim = call double @fdim(double 1.7, double 0x7FF4000000000000) |
| 133 | + ret double %dim |
| 134 | +} |
| 135 | + |
| 136 | +declare double @fdim(double, double) #0 |
| 137 | +declare float @fdimf(float, float) #0 |
| 138 | + |
| 139 | +attributes #0 = { memory(none) } |
0 commit comments