aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-27 05:29:54 +0000
committerChris Lattner <sabre@nondot.org>2008-01-27 05:29:54 +0000
commitb753065f6d415ee4a63a045a4150caaebd5d05a2 (patch)
treead18280e86daafdb17839378d797f5a7d1a7468e /test/Transforms
parent4d53049c92c1d362db3e9f3697e398ec38934408 (diff)
Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/fpextend.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fpextend.ll b/test/Transforms/InstCombine/fpextend.ll
new file mode 100644
index 0000000000..5971080cef
--- /dev/null
+++ b/test/Transforms/InstCombine/fpextend.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep fpext
+@X = external global float
+@Y = external global float
+
+define void @test() nounwind {
+entry:
+ %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
+ %tmp3 = add 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
+}
+
+define void @test3() nounwind {
+entry:
+ %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
+ %tmp2 = load 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
+}
+
+define void @test4() nounwind {
+entry:
+ %tmp = load float* @X, align 4 ; <float> [#uses=1]
+ %tmp1 = fpext float %tmp to double ; <double> [#uses=1]
+ %tmp2 = sub 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
+}
+