summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Mips/2010-07-20-Switch.ll
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-07-20 08:37:04 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-07-20 08:37:04 +0000
commit160695fecb7333347c9a09a8742eefe09e32f727 (patch)
tree614d2d9e7f99eff587006465614877cd33ea577e /llvm/test/CodeGen/Mips/2010-07-20-Switch.ll
parent81781220d23007e831deb4dfd235be8c1cccdc52 (diff)
downloadbcm5719-llvm-160695fecb7333347c9a09a8742eefe09e32f727.tar.gz
bcm5719-llvm-160695fecb7333347c9a09a8742eefe09e32f727.zip
Fix PR7174, a couple o Mips fixes:
- Fix a typo for PIC check during jmp table lowering - Also fix the "first jump table basic block is not considered only reachable by fall through" problem, use this ad-hoc solution until I come up with something better. Patch by stetorvs@gmail.com llvm-svn: 108820
Diffstat (limited to 'llvm/test/CodeGen/Mips/2010-07-20-Switch.ll')
-rw-r--r--llvm/test/CodeGen/Mips/2010-07-20-Switch.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Mips/2010-07-20-Switch.ll b/llvm/test/CodeGen/Mips/2010-07-20-Switch.ll
new file mode 100644
index 00000000000..07fc10cae18
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/2010-07-20-Switch.ll
@@ -0,0 +1,33 @@
+; RUN: llc < %s -march=mips -relocation-model=static | FileCheck %s
+
+define i32 @main() nounwind readnone {
+entry:
+ %x = alloca i32, align 4 ; <i32*> [#uses=2]
+ volatile store i32 2, i32* %x, align 4
+ %0 = volatile load i32* %x, align 4 ; <i32> [#uses=1]
+; CHECK: lui $3, %hi($JTI0_0)
+; CHECK: sll $2, $2, 2
+; CHECK: addiu $3, $3, %lo($JTI0_0)
+ switch i32 %0, label %bb4 [
+ i32 0, label %bb5
+ i32 1, label %bb1
+ i32 2, label %bb2
+ i32 3, label %bb3
+ ]
+
+bb1: ; preds = %entry
+ ret i32 2
+
+; CHECK: $BB0_2
+bb2: ; preds = %entry
+ ret i32 0
+
+bb3: ; preds = %entry
+ ret i32 3
+
+bb4: ; preds = %entry
+ ret i32 4
+
+bb5: ; preds = %entry
+ ret i32 1
+}
OpenPOWER on IntegriCloud