aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
diff options
context:
space:
mode:
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-06-02 21:48:17 +0000
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>2013-06-02 21:48:17 +0000
commit65ca7aa57d5e9b391f02a5686e7622deaac146f9 (patch)
tree9517c1fe25c819c191102a54d662f3be194bc7f2 /test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
parent0a972fa1ef70c0523091732d41f35f660f97e107 (diff)
downloadexternal_llvm-65ca7aa57d5e9b391f02a5686e7622deaac146f9.zip
external_llvm-65ca7aa57d5e9b391f02a5686e7622deaac146f9.tar.gz
external_llvm-65ca7aa57d5e9b391f02a5686e7622deaac146f9.tar.bz2
Sparc: Combine add/or/sethi instruction with restore if possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SPARC/2011-01-19-DelaySlot.ll')
-rw-r--r--test/CodeGen/SPARC/2011-01-19-DelaySlot.ll76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll b/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
index 4fd2e7b..89981a8 100644
--- a/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
+++ b/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
@@ -105,3 +105,79 @@ entry:
declare i32 @func(i32*)
+
+
+define i32 @restore_add(i32 %a, i32 %b) {
+entry:
+;CHECK: restore_add:
+;CHECK: jmp %i7+8
+;CHECK: restore %o0, %i1, %o0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ %1 = add nsw i32 %0, %b
+ ret i32 %1
+}
+
+define i32 @restore_add_imm(i32 %a) {
+entry:
+;CHECK: restore_add_imm:
+;CHECK: jmp %i7+8
+;CHECK: restore %o0, 20, %o0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ %1 = add nsw i32 %0, 20
+ ret i32 %1
+}
+
+define i32 @restore_or(i32 %a) {
+entry:
+;CHECK: restore_or:
+;CHECK: jmp %i7+8
+;CHECK: restore %g0, %o0, %o0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ ret i32 %0
+}
+
+define i32 @restore_or_imm(i32 %a) {
+entry:
+;CHECK: restore_or_imm:
+;CHECK: or %o0, 20, %i0
+;CHECK: jmp %i7+8
+;CHECK: restore %g0, %g0, %g0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ %1 = or i32 %0, 20
+ ret i32 %1
+}
+
+
+define i32 @restore_sethi(i32 %a) {
+entry:
+;CHECK: restore_sethi
+;CHECK-NOT: sethi 3
+;CHECK: restore %g0, 3072, %o0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ %1 = icmp ne i32 %0, 0
+ %2 = select i1 %1, i32 3072, i32 0
+ ret i32 %2
+}
+
+define i32 @restore_sethi_3bit(i32 %a) {
+entry:
+;CHECK: restore_sethi
+;CHECK: sethi 6
+;CHECK-NOT: restore %g0, 6144, %o0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ %1 = icmp ne i32 %0, 0
+ %2 = select i1 %1, i32 6144, i32 0
+ ret i32 %2
+}
+
+define i32 @restore_sethi_large(i32 %a) {
+entry:
+;CHECK: restore_sethi
+;CHECK: sethi 4000, %i0
+;CHECK: restore %g0, %g0, %g0
+ %0 = tail call i32 @bar(i32 %a) nounwind
+ %1 = icmp ne i32 %0, 0
+ %2 = select i1 %1, i32 4096000, i32 0
+ ret i32 %2
+}
+