diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/fast-math.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fast-math.ll | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll index 6c251c355cf..96d70dbdfc4 100644 --- a/llvm/test/Transforms/InstCombine/fast-math.ll +++ b/llvm/test/Transforms/InstCombine/fast-math.ll @@ -273,94 +273,6 @@ define float @fmul_distribute4(float %f1) { ret float %t3 } -; C1/X * C2 => (C1*C2) / X -define float @fmul2(float %f1) { -; CHECK-LABEL: @fmul2( -; CHECK-NEXT: [[TMP1:%.*]] = fdiv fast float 1.200000e+07, [[F1:%.*]] -; CHECK-NEXT: ret float [[TMP1]] -; - %t1 = fdiv float 2.0e+3, %f1 - %t3 = fmul fast float %t1, 6.0e+3 - ret float %t3 -} - -; X/C1 * C2 => X * (C2/C1) is disabled if X/C1 has multiple uses -@fmul2_external = external global float -define float @fmul2_disable(float %f1) { -; CHECK-LABEL: @fmul2_disable( -; CHECK-NEXT: [[DIV:%.*]] = fdiv fast float 1.000000e+00, [[F1:%.*]] -; CHECK-NEXT: store float [[DIV]], float* @fmul2_external, align 4 -; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[DIV]], 2.000000e+00 -; CHECK-NEXT: ret float [[MUL]] -; - %div = fdiv fast float 1.000000e+00, %f1 - store float %div, float* @fmul2_external - %mul = fmul fast float %div, 2.000000e+00 - ret float %mul -} - -; X/C1 * C2 => X * (C2/C1) (if C2/C1 is normal Fp) -define float @fmul3(float %f1, float %f2) { -; CHECK-LABEL: @fmul3( -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast float [[F1:%.*]], 3.000000e+00 -; CHECK-NEXT: ret float [[TMP1]] -; - %t1 = fdiv float %f1, 2.0e+3 - %t3 = fmul fast float %t1, 6.0e+3 - ret float %t3 -} - -define <4 x float> @fmul3_vec(<4 x float> %f1, <4 x float> %f2) { -; CHECK-LABEL: @fmul3_vec( -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <4 x float> [[F1:%.*]], <float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 1.000000e+00> -; CHECK-NEXT: ret <4 x float> [[TMP1]] -; - %t1 = fdiv <4 x float> %f1, <float 2.0e+3, float 3.0e+3, float 2.0e+3, float 1.0e+3> - %t3 = fmul fast <4 x float> %t1, <float 6.0e+3, float 6.0e+3, float 2.0e+3, float 1.0e+3> - ret <4 x float> %t3 -} - -; Make sure fmul with constant expression doesn't assert. -define <4 x float> @fmul3_vec_constexpr(<4 x float> %f1, <4 x float> %f2) { -; CHECK-LABEL: @fmul3_vec_constexpr( -; CHECK-NEXT: [[TMP1:%.*]] = fmul fast <4 x float> [[F1:%.*]], <float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 1.000000e+00> -; CHECK-NEXT: ret <4 x float> [[TMP1]] -; - %constExprMul = bitcast i128 trunc (i160 bitcast (<5 x float> <float 6.0e+3, float 6.0e+3, float 2.0e+3, float 1.0e+3, float undef> to i160) to i128) to <4 x float> - %t1 = fdiv <4 x float> %f1, <float 2.0e+3, float 3.0e+3, float 2.0e+3, float 1.0e+3> - %t3 = fmul fast <4 x float> %t1, %constExprMul - ret <4 x float> %t3 -} - -; Rule "X/C1 * C2 => X * (C2/C1) is not applicable if C2/C1 is either a special -; value of a denormal. The 0x3810000000000000 here take value FLT_MIN -; -define float @fmul4(float %f1, float %f2) { -; CHECK-LABEL: @fmul4( -; CHECK-NEXT: [[T1:%.*]] = fdiv float [[F1:%.*]], 2.000000e+03 -; CHECK-NEXT: [[T3:%.*]] = fmul fast float [[T1]], 0x3810000000000000 -; CHECK-NEXT: ret float [[T3]] -; - %t1 = fdiv float %f1, 2.0e+3 - %t3 = fmul fast float %t1, 0x3810000000000000 - ret float %t3 -} - -; X / C1 * C2 => X / (C2/C1) if C1/C2 is either a special value of a denormal, -; and C2/C1 is a normal value. -; TODO: We don't convert the fast fdiv to fmul because that would be multiplication -; by a denormal, but we could do better when we know that denormals are not a problem. - -define float @fmul5(float %f1, float %f2) { -; CHECK-LABEL: @fmul5( -; CHECK-NEXT: [[TMP1:%.*]] = fdiv fast float [[F1:%.*]], 0x47E8000000000000 -; CHECK-NEXT: ret float [[TMP1]] -; - %t1 = fdiv float %f1, 3.0e+0 - %t3 = fmul fast float %t1, 0x3810000000000000 - ret float %t3 -} - ; "(X*Y) * X => (X*X) * Y" is disabled if "X*Y" has multiple uses define float @fmul7(float %f1, float %f2) { ; CHECK-LABEL: @fmul7( |

