aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-12-01 02:07:52 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-12-01 02:07:52 +0000
commite62f97c094dba44e4c259d20135167fa91912eea (patch)
tree5d910203fd66c0b5594d9f29a069ae8125283566 /test/CodeGen/X86/2007-11-30-TestLoadFolding.ll
parent790e11cdff59ed6312c2f1d3d8f63537c2ae2ec5 (diff)
downloadexternal_llvm-e62f97c094dba44e4c259d20135167fa91912eea.zip
external_llvm-e62f97c094dba44e4c259d20135167fa91912eea.tar.gz
external_llvm-e62f97c094dba44e4c259d20135167fa91912eea.tar.bz2
Allow some reloads to be folded in multi-use cases. Specifically testl r, r -> cmpl [mem], 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44479 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/2007-11-30-TestLoadFolding.ll')
-rw-r--r--test/CodeGen/X86/2007-11-30-TestLoadFolding.ll58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll b/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll
new file mode 100644
index 0000000..25fc6ac
--- /dev/null
+++ b/test/CodeGen/X86/2007-11-30-TestLoadFolding.ll
@@ -0,0 +1,58 @@
+; RUN: llvm-as < %s | llc -march=x86 -stats |& \
+; RUN: grep {2 .*folded into instructions}
+; RUN: llvm-as < %s | llc -march=x86 | grep cmp | count 3
+
+ %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* }
+
+define fastcc i32 @perimeter(%struct.quad_struct* %tree, i32 %size) {
+entry:
+ %tree.idx7.val = load %struct.quad_struct** null ; <%struct.quad_struct*> [#uses=1]
+ %tmp8.i51 = icmp eq %struct.quad_struct* %tree.idx7.val, null ; <i1> [#uses=2]
+ br i1 %tmp8.i51, label %cond_next, label %cond_next.i52
+
+cond_next.i52: ; preds = %entry
+ ret i32 0
+
+cond_next: ; preds = %entry
+ %tmp59 = load i32* null, align 4 ; <i32> [#uses=1]
+ %tmp70 = icmp eq i32 %tmp59, 2 ; <i1> [#uses=1]
+ br i1 %tmp70, label %cond_true.i35, label %bb80
+
+cond_true.i35: ; preds = %cond_next
+ %tmp14.i.i37 = load %struct.quad_struct** null, align 4 ; <%struct.quad_struct*> [#uses=1]
+ %tmp3.i160 = load i32* null, align 4 ; <i32> [#uses=1]
+ %tmp4.i161 = icmp eq i32 %tmp3.i160, 2 ; <i1> [#uses=1]
+ br i1 %tmp4.i161, label %cond_true.i163, label %cond_false.i178
+
+cond_true.i163: ; preds = %cond_true.i35
+ %tmp7.i162 = sdiv i32 %size, 4 ; <i32> [#uses=2]
+ %tmp13.i168 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* null, i32 3, i32 2, i32 %tmp7.i162 ) ; <i32> [#uses=1]
+ %tmp18.i11.i170 = getelementptr %struct.quad_struct* %tmp14.i.i37, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1]
+ %tmp19.i12.i171 = load %struct.quad_struct** %tmp18.i11.i170, align 4 ; <%struct.quad_struct*> [#uses=1]
+ %tmp21.i173 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* %tmp19.i12.i171, i32 3, i32 2, i32 %tmp7.i162 ) ; <i32> [#uses=1]
+ %tmp22.i174 = add i32 %tmp21.i173, %tmp13.i168 ; <i32> [#uses=1]
+ br i1 false, label %cond_true.i141, label %cond_false.i156
+
+cond_false.i178: ; preds = %cond_true.i35
+ ret i32 0
+
+cond_true.i141: ; preds = %cond_true.i163
+ %tmp7.i140 = sdiv i32 %size, 4 ; <i32> [#uses=1]
+ %tmp21.i151 = tail call fastcc i32 @sum_adjacent( %struct.quad_struct* null, i32 3, i32 2, i32 %tmp7.i140 ) ; <i32> [#uses=0]
+ ret i32 0
+
+cond_false.i156: ; preds = %cond_true.i163
+ %tmp22.i44 = add i32 0, %tmp22.i174 ; <i32> [#uses=0]
+ br i1 %tmp8.i51, label %bb22.i, label %cond_next.i
+
+bb80: ; preds = %cond_next
+ ret i32 0
+
+cond_next.i: ; preds = %cond_false.i156
+ ret i32 0
+
+bb22.i: ; preds = %cond_false.i156
+ ret i32 0
+}
+
+declare fastcc i32 @sum_adjacent(%struct.quad_struct*, i32, i32, i32)