|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: opt < %s -passes=instcombine -S | FileCheck %s |
| 3 | + |
| 4 | +define float @tanAtanInverseFast(float %x) { |
| 5 | +; CHECK-LABEL: define float @tanAtanInverseFast( |
| 6 | +; CHECK-SAME: float [[X:%.*]]) { |
| 7 | +; CHECK-NEXT: [[CALL:%.*]] = call fast float @atanf(float [[X]]) |
| 8 | +; CHECK-NEXT: ret float [[X]] |
| 9 | +; |
| 10 | + %call = call fast float @atanf(float %x) |
| 11 | + %call1 = call fast float @tanf(float %call) |
| 12 | + ret float %call1 |
| 13 | +} |
| 14 | + |
| 15 | +define float @atanhTanhInverseFast(float %x) { |
| 16 | +; CHECK-LABEL: define float @atanhTanhInverseFast( |
| 17 | +; CHECK-SAME: float [[X:%.*]]) { |
| 18 | +; CHECK-NEXT: [[CALL:%.*]] = call fast float @tanhf(float [[X]]) |
| 19 | +; CHECK-NEXT: ret float [[X]] |
| 20 | +; |
| 21 | + %call = call fast float @tanhf(float %x) |
| 22 | + %call1 = call fast float @atanhf(float %call) |
| 23 | + ret float %call1 |
| 24 | +} |
| 25 | + |
| 26 | +define float @sinhAsinhInverseFast(float %x) { |
| 27 | +; CHECK-LABEL: define float @sinhAsinhInverseFast( |
| 28 | +; CHECK-SAME: float [[X:%.*]]) { |
| 29 | +; CHECK-NEXT: [[CALL:%.*]] = call fast float @asinhf(float [[X]]) |
| 30 | +; CHECK-NEXT: ret float [[X]] |
| 31 | +; |
| 32 | + %call = call fast float @asinhf(float %x) |
| 33 | + %call1 = call fast float @sinhf(float %call) |
| 34 | + ret float %call1 |
| 35 | +} |
| 36 | + |
| 37 | +define float @asinhSinhInverseFast(float %x) { |
| 38 | +; CHECK-LABEL: define float @asinhSinhInverseFast( |
| 39 | +; CHECK-SAME: float [[X:%.*]]) { |
| 40 | +; CHECK-NEXT: [[CALL:%.*]] = call fast float @sinhf(float [[X]]) |
| 41 | +; CHECK-NEXT: ret float [[X]] |
| 42 | +; |
| 43 | + %call = call fast float @sinhf(float %x) |
| 44 | + %call1 = call fast float @asinhf(float %call) |
| 45 | + ret float %call1 |
| 46 | +} |
| 47 | + |
| 48 | +define float @coshAcoshInverseFast(float %x) { |
| 49 | +; CHECK-LABEL: define float @coshAcoshInverseFast( |
| 50 | +; CHECK-SAME: float [[X:%.*]]) { |
| 51 | +; CHECK-NEXT: [[CALL:%.*]] = call fast float @acoshf(float [[X]]) |
| 52 | +; CHECK-NEXT: ret float [[X]] |
| 53 | +; |
| 54 | + %call = call fast float @acoshf(float %x) |
| 55 | + %call1 = call fast float @coshf(float %call) |
| 56 | + ret float %call1 |
| 57 | +} |
| 58 | + |
| 59 | +define float @indirectTanCall(ptr %fptr) { |
| 60 | +; CHECK-LABEL: define float @indirectTanCall( |
| 61 | +; CHECK-SAME: ptr [[FPTR:%.*]]) { |
| 62 | +; CHECK-NEXT: [[CALL1:%.*]] = call fast float [[FPTR]]() |
| 63 | +; CHECK-NEXT: [[TAN:%.*]] = call fast float @tanf(float [[CALL1]]) |
| 64 | +; CHECK-NEXT: ret float [[TAN]] |
| 65 | +; |
| 66 | + %call1 = call fast float %fptr() |
| 67 | + %tan = call fast float @tanf(float %call1) |
| 68 | + ret float %tan |
| 69 | +} |
| 70 | + |
| 71 | +; No fast-math. |
| 72 | + |
| 73 | +define float @tanAtanInverse(float %x) { |
| 74 | +; CHECK-LABEL: define float @tanAtanInverse( |
| 75 | +; CHECK-SAME: float [[X:%.*]]) { |
| 76 | +; CHECK-NEXT: [[CALL:%.*]] = call float @atanf(float [[X]]) |
| 77 | +; CHECK-NEXT: [[CALL1:%.*]] = call float @tanf(float [[CALL]]) |
| 78 | +; CHECK-NEXT: ret float [[CALL1]] |
| 79 | +; |
| 80 | + %call = call float @atanf(float %x) |
| 81 | + %call1 = call float @tanf(float %call) |
| 82 | + ret float %call1 |
| 83 | +} |
| 84 | + |
| 85 | +define float @atanhTanhInverse(float %x) { |
| 86 | +; CHECK-LABEL: define float @atanhTanhInverse( |
| 87 | +; CHECK-SAME: float [[X:%.*]]) { |
| 88 | +; CHECK-NEXT: [[CALL:%.*]] = call float @tanhf(float [[X]]) |
| 89 | +; CHECK-NEXT: [[CALL1:%.*]] = call float @atanhf(float [[CALL]]) |
| 90 | +; CHECK-NEXT: ret float [[CALL1]] |
| 91 | +; |
| 92 | + %call = call float @tanhf(float %x) |
| 93 | + %call1 = call float @atanhf(float %call) |
| 94 | + ret float %call1 |
| 95 | +} |
| 96 | + |
| 97 | +define float @sinhAsinhInverse(float %x) { |
| 98 | +; CHECK-LABEL: define float @sinhAsinhInverse( |
| 99 | +; CHECK-SAME: float [[X:%.*]]) { |
| 100 | +; CHECK-NEXT: [[CALL:%.*]] = call float @asinhf(float [[X]]) |
| 101 | +; CHECK-NEXT: [[CALL1:%.*]] = call float @sinhf(float [[CALL]]) |
| 102 | +; CHECK-NEXT: ret float [[CALL1]] |
| 103 | +; |
| 104 | + %call = call float @asinhf(float %x) |
| 105 | + %call1 = call float @sinhf(float %call) |
| 106 | + ret float %call1 |
| 107 | +} |
| 108 | + |
| 109 | +define float @asinhSinhInverse(float %x) { |
| 110 | +; CHECK-LABEL: define float @asinhSinhInverse( |
| 111 | +; CHECK-SAME: float [[X:%.*]]) { |
| 112 | +; CHECK-NEXT: [[CALL:%.*]] = call float @sinhf(float [[X]]) |
| 113 | +; CHECK-NEXT: [[CALL1:%.*]] = call float @asinhf(float [[CALL]]) |
| 114 | +; CHECK-NEXT: ret float [[CALL1]] |
| 115 | +; |
| 116 | + %call = call float @sinhf(float %x) |
| 117 | + %call1 = call float @asinhf(float %call) |
| 118 | + ret float %call1 |
| 119 | +} |
| 120 | + |
| 121 | +define float @coshAcoshInverse(float %x) { |
| 122 | +; CHECK-LABEL: define float @coshAcoshInverse( |
| 123 | +; CHECK-SAME: float [[X:%.*]]) { |
| 124 | +; CHECK-NEXT: [[CALL:%.*]] = call float @acoshf(float [[X]]) |
| 125 | +; CHECK-NEXT: [[CALL1:%.*]] = call float @coshf(float [[CALL]]) |
| 126 | +; CHECK-NEXT: ret float [[CALL1]] |
| 127 | +; |
| 128 | + %call = call float @acoshf(float %x) |
| 129 | + %call1 = call float @coshf(float %call) |
| 130 | + ret float %call1 |
| 131 | +} |
| 132 | + |
| 133 | +declare float @asinhf(float) |
| 134 | +declare float @sinhf(float) |
| 135 | +declare float @acoshf(float) |
| 136 | +declare float @coshf(float) |
| 137 | +declare float @tanhf(float) |
| 138 | +declare float @atanhf(float) |
| 139 | +declare float @tanf(float) |
| 140 | +declare float @atanf(float) |
0 commit comments