summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-03-02 00:27:44 +0000
committerCraig Topper <craig.topper@intel.com>2018-03-02 00:27:44 +0000
commit113446ca372df474dd51384852c65329c59bff13 (patch)
treeca64f7b518f1b1f37aa843e38b3fa80d0e56b327
parent4c693a894f73af181803932b91c117f90a0ded0f (diff)
downloadbcm5719-llvm-113446ca372df474dd51384852c65329c59bff13.tar.gz
bcm5719-llvm-113446ca372df474dd51384852c65329c59bff13.zip
[InstCombine] Simplify test cases by removing loads/stores that aren't required for what is being tested.
The loads and stores were getting the data and storing the results. There's no reason we can't just use function arguments and return. llvm-svn: 326515
-rw-r--r--llvm/test/Transforms/InstCombine/fpextend.ll112
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
}
OpenPOWER on IntegriCloud