diff options
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fpextend.ll | 112 |
1 files changed, 40 insertions, 72 deletions
diff --git a/llvm/test/Transforms/InstCombine/fpextend.ll b/llvm/test/Transforms/InstCombine/fpextend.ll index 30930ff71c2..215e36120ba 100644 --- a/llvm/test/Transforms/InstCombine/fpextend.ll +++ b/llvm/test/Transforms/InstCombine/fpextend.ll @@ -1,120 +1,88 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s -@X = external global float -@Y = external global float -@Z = external global <2 x float> - -define void @test() nounwind { +define float @test(float %x) nounwind { ; CHECK-LABEL: @test( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load float, float* @X, align 4 -; CHECK-NEXT: [[TMP34:%.*]] = fadd float [[TMP]], 0.000000e+00 -; CHECK-NEXT: store float [[TMP34]], float* @X, align 4 -; CHECK-NEXT: ret void +; CHECK-NEXT: [[TMP34:%.*]] = fadd float [[X:%.*]], 0.000000e+00 +; CHECK-NEXT: ret float [[TMP34]] ; entry: - %tmp = load float, float* @X, align 4 ; <float> [#uses=1] - %tmp1 = fpext float %tmp to double ; <double> [#uses=1] - %tmp3 = fadd double %tmp1, 0.000000e+00 ; <double> [#uses=1] - %tmp34 = fptrunc double %tmp3 to float ; <float> [#uses=1] - store float %tmp34, float* @X, align 4 - ret void + %tmp1 = fpext float %x to double + %tmp3 = fadd double %tmp1, 0.000000e+00 + %tmp34 = fptrunc double %tmp3 to float + ret float %tmp34 } -define void @test2() nounwind { +define float @test2(float %x, float %y) nounwind { ; CHECK-LABEL: @test2( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load float, float* @X, align 4 -; CHECK-NEXT: [[TMP2:%.*]] = load float, float* @Y, align 4 -; CHECK-NEXT: [[TMP56:%.*]] = fmul float [[TMP]], [[TMP2]] -; CHECK-NEXT: store float [[TMP56]], float* @X, align 4 -; CHECK-NEXT: ret void +; CHECK-NEXT: [[TMP56:%.*]] = fmul float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret float [[TMP56]] ; entry: - %tmp = load float, float* @X, align 4 ; <float> [#uses=1] - %tmp1 = fpext float %tmp to double ; <double> [#uses=1] - %tmp2 = load float, float* @Y, align 4 ; <float> [#uses=1] - %tmp23 = fpext float %tmp2 to double ; <double> [#uses=1] - %tmp5 = fmul double %tmp1, %tmp23 ; <double> [#uses=1] - %tmp56 = fptrunc double %tmp5 to float ; <float> [#uses=1] - store float %tmp56, float* @X, align 4 - ret void + %tmp1 = fpext float %x to double + %tmp23 = fpext float %y to double + %tmp5 = fmul double %tmp1, %tmp23 + %tmp56 = fptrunc double %tmp5 to float + ret float %tmp56 } -define void @test3() nounwind { +define float @test3(float %x, float %y) nounwind { ; CHECK-LABEL: @test3( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load float, float* @X, align 4 -; CHECK-NEXT: [[TMP2:%.*]] = load float, float* @Y, align 4 -; CHECK-NEXT: [[TMP56:%.*]] = fdiv float [[TMP]], [[TMP2]] -; CHECK-NEXT: store float [[TMP56]], float* @X, align 4 -; CHECK-NEXT: ret void +; CHECK-NEXT: [[TMP56:%.*]] = fdiv float [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: ret float [[TMP56]] ; entry: - %tmp = load float, float* @X, align 4 ; <float> [#uses=1] - %tmp1 = fpext float %tmp to double ; <double> [#uses=1] - %tmp2 = load float, float* @Y, align 4 ; <float> [#uses=1] - %tmp23 = fpext float %tmp2 to double ; <double> [#uses=1] - %tmp5 = fdiv double %tmp1, %tmp23 ; <double> [#uses=1] - %tmp56 = fptrunc double %tmp5 to float ; <float> [#uses=1] - store float %tmp56, float* @X, align 4 - ret void + %tmp1 = fpext float %x to double + %tmp23 = fpext float %y to double + %tmp5 = fdiv double %tmp1, %tmp23 + %tmp56 = fptrunc double %tmp5 to float + ret float %tmp56 } -define void @test4() nounwind { +define float @test4(float %x) nounwind { ; CHECK-LABEL: @test4( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load float, float* @X, align 4 -; CHECK-NEXT: [[TMP34:%.*]] = fsub float -0.000000e+00, [[TMP]] -; CHECK-NEXT: store float [[TMP34]], float* @X, align 4 -; CHECK-NEXT: ret void +; CHECK-NEXT: [[TMP34:%.*]] = fsub float -0.000000e+00, [[X:%.*]] +; CHECK-NEXT: ret float [[TMP34]] ; entry: - %tmp = load float, float* @X, align 4 ; <float> [#uses=1] - %tmp1 = fpext float %tmp to double ; <double> [#uses=1] - %tmp2 = fsub double -0.000000e+00, %tmp1 ; <double> [#uses=1] - %tmp34 = fptrunc double %tmp2 to float ; <float> [#uses=1] - store float %tmp34, float* @X, align 4 - ret void + %tmp1 = fpext float %x to double + %tmp2 = fsub double -0.000000e+00, %tmp1 + %tmp34 = fptrunc double %tmp2 to float + ret float %tmp34 } ; Test with vector splat constant -define void @test5() nounwind { +define <2 x float> @test5(<2 x float> %x) nounwind { ; CHECK-LABEL: @test5( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load <2 x float>, <2 x float>* @Z, align 8 -; CHECK-NEXT: [[TMP1:%.*]] = fpext <2 x float> [[TMP]] to <2 x double> +; CHECK-NEXT: [[TMP1:%.*]] = fpext <2 x float> [[X:%.*]] to <2 x double> ; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], zeroinitializer ; CHECK-NEXT: [[TMP34:%.*]] = fptrunc <2 x double> [[TMP3]] to <2 x float> -; CHECK-NEXT: store <2 x float> [[TMP34]], <2 x float>* @Z, align 8 -; CHECK-NEXT: ret void +; CHECK-NEXT: ret <2 x float> [[TMP34]] ; entry: - %tmp = load <2 x float>, <2 x float>* @Z, align 4 - %tmp1 = fpext <2 x float> %tmp to <2 x double> + %tmp1 = fpext <2 x float> %x to <2 x double> %tmp3 = fadd <2 x double> %tmp1, <double 0.000000e+00, double 0.000000e+00> %tmp34 = fptrunc <2 x double> %tmp3 to <2 x float> - store <2 x float> %tmp34, <2 x float>* @Z, align 4 - ret void + ret <2 x float> %tmp34 } ; Test with a non-splat constant -define void @test6() nounwind { +define <2 x float> @test6(<2 x float> %x) nounwind { ; CHECK-LABEL: @test6( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP:%.*]] = load <2 x float>, <2 x float>* @Z, align 8 -; CHECK-NEXT: [[TMP1:%.*]] = fpext <2 x float> [[TMP]] to <2 x double> +; CHECK-NEXT: [[TMP1:%.*]] = fpext <2 x float> [[X:%.*]] to <2 x double> ; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP1]], <double 0.000000e+00, double -0.000000e+00> ; CHECK-NEXT: [[TMP34:%.*]] = fptrunc <2 x double> [[TMP3]] to <2 x float> -; CHECK-NEXT: store <2 x float> [[TMP34]], <2 x float>* @Z, align 8 -; CHECK-NEXT: ret void +; CHECK-NEXT: ret <2 x float> [[TMP34]] ; entry: - %tmp = load <2 x float>, <2 x float>* @Z, align 4 - %tmp1 = fpext <2 x float> %tmp to <2 x double> + %tmp1 = fpext <2 x float> %x to <2 x double> %tmp3 = fadd <2 x double> %tmp1, <double 0.000000e+00, double -0.000000e+00> %tmp34 = fptrunc <2 x double> %tmp3 to <2 x float> - store <2 x float> %tmp34, <2 x float>* @Z, align 4 - ret void + ret <2 x float> %tmp34 } |

