blob: 23b5349ba8126b1694ec5b17406161ea5e21c107 [file] [log] [blame]
Akira Hatanaka2bf08ec2011-12-05 21:03:03 +00001; RUN: llc < %s -march=mips -relocation-model=static | FileCheck %s -check-prefix=STATIC-O32
2; RUN: llc < %s -march=mips -relocation-model=pic | FileCheck %s -check-prefix=PIC-O32
3; RUN: llc < %s -march=mips64 -relocation-model=pic -mcpu=mips64 -mattr=n64 | FileCheck %s -check-prefix=PIC-N64
Bruno Cardoso Lopes46773792010-07-20 08:37:04 +00004
5define i32 @main() nounwind readnone {
6entry:
7 %x = alloca i32, align 4 ; <i32*> [#uses=2]
Chris Lattnerd2bf4322011-11-27 06:54:59 +00008 store volatile i32 2, i32* %x, align 4
9 %0 = load volatile i32* %x, align 4 ; <i32> [#uses=1]
Akira Hatanaka2bf08ec2011-12-05 21:03:03 +000010; STATIC-O32: lui $[[R0:[0-9]+]], %hi($JTI0_0)
11; STATIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0)
12; STATIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2
13; PIC-O32: lw $[[R0:[0-9]+]], %got($JTI0_0)
14; PIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0)
15; PIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2
16; PIC-N64: ld $[[R0:[0-9]+]], %got_page($JTI0_0)
17; PIC-N64: daddiu ${{[0-9]+}}, $[[R0]], %got_ofst($JTI0_0)
18; PIC-N64: dsll ${{[0-9]+}}, ${{[0-9]+}}, 2
Bruno Cardoso Lopes46773792010-07-20 08:37:04 +000019 switch i32 %0, label %bb4 [
20 i32 0, label %bb5
21 i32 1, label %bb1
22 i32 2, label %bb2
23 i32 3, label %bb3
24 ]
25
26bb1: ; preds = %entry
27 ret i32 2
28
Akira Hatanaka2bf08ec2011-12-05 21:03:03 +000029; CHECK: STATIC-O32: $BB0_2
Bruno Cardoso Lopes46773792010-07-20 08:37:04 +000030bb2: ; preds = %entry
31 ret i32 0
32
33bb3: ; preds = %entry
34 ret i32 3
35
36bb4: ; preds = %entry
37 ret i32 4
38
39bb5: ; preds = %entry
40 ret i32 1
41}