xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/2010-07-20-Switch.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips -relocation-model=static | \
2*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=STATIC-O32
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips -relocation-model=pic | \
4*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck %s -check-prefix=PIC-O32
5*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64 -relocation-model=pic -mcpu=mips4 | \
6*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -check-prefix=N64
7*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64 -relocation-model=static -mcpu=mips4 | \
8*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -check-prefix=N64
9*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64 -relocation-model=pic -mcpu=mips64 | \
10*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -check-prefix=N64
11*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=mips64 -relocation-model=static -mcpu=mips64 | \
12*9880d681SAndroid Build Coastguard Worker; RUN:     FileCheck %s -check-prefix=N64
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine i32 @main() nounwind readnone {
15*9880d681SAndroid Build Coastguard Workerentry:
16*9880d681SAndroid Build Coastguard Worker  %x = alloca i32, align 4                        ; <i32*> [#uses=2]
17*9880d681SAndroid Build Coastguard Worker  store volatile i32 2, i32* %x, align 4
18*9880d681SAndroid Build Coastguard Worker  %0 = load volatile i32, i32* %x, align 4             ; <i32> [#uses=1]
19*9880d681SAndroid Build Coastguard Worker; STATIC-O32: sll $[[R0:[0-9]+]], ${{[0-9]+}}, 2
20*9880d681SAndroid Build Coastguard Worker; STATIC-O32: lui $[[R1:[0-9]+]], %hi($JTI0_0)
21*9880d681SAndroid Build Coastguard Worker; STATIC-O32: addu $[[R2:[0-9]+]], $[[R0]], $[[R1]]
22*9880d681SAndroid Build Coastguard Worker; STATIC-O32: lw $[[R3:[0-9]+]], %lo($JTI0_0)($[[R2]])
23*9880d681SAndroid Build Coastguard Worker; PIC-O32: sll $[[R0:[0-9]+]], ${{[0-9]+}}, 2
24*9880d681SAndroid Build Coastguard Worker; PIC-O32: lw $[[R1:[0-9]+]], %got($JTI0_0)
25*9880d681SAndroid Build Coastguard Worker; PIC-O32: addu $[[R2:[0-9]+]], $[[R0]], $[[R1]]
26*9880d681SAndroid Build Coastguard Worker; PIC-O32: lw $[[R4:[0-9]+]], %lo($JTI0_0)($[[R2]])
27*9880d681SAndroid Build Coastguard Worker; PIC-O32: addu $[[R5:[0-9]+]], $[[R4:[0-9]+]]
28*9880d681SAndroid Build Coastguard Worker; PIC-O32: jr  $[[R5]]
29*9880d681SAndroid Build Coastguard Worker; N64: dsll $[[R0:[0-9]+]], ${{[0-9]+}}, 3
30*9880d681SAndroid Build Coastguard Worker; N64: ld $[[R1:[0-9]+]], %got_page($JTI0_0)
31*9880d681SAndroid Build Coastguard Worker; N64: daddu $[[R2:[0-9]+]], $[[R0:[0-9]+]], $[[R1]]
32*9880d681SAndroid Build Coastguard Worker; N64: ld $[[R4:[0-9]+]], %got_ofst($JTI0_0)($[[R2]])
33*9880d681SAndroid Build Coastguard Worker; N64: daddu $[[R5:[0-9]+]], $[[R4:[0-9]+]]
34*9880d681SAndroid Build Coastguard Worker; N64: jr  $[[R5]]
35*9880d681SAndroid Build Coastguard Worker  switch i32 %0, label %bb4 [
36*9880d681SAndroid Build Coastguard Worker    i32 0, label %bb5
37*9880d681SAndroid Build Coastguard Worker    i32 1, label %bb1
38*9880d681SAndroid Build Coastguard Worker    i32 2, label %bb2
39*9880d681SAndroid Build Coastguard Worker    i32 3, label %bb3
40*9880d681SAndroid Build Coastguard Worker  ]
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerbb1:                                              ; preds = %entry
43*9880d681SAndroid Build Coastguard Worker  ret i32 2
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workerbb2:                                              ; preds = %entry
46*9880d681SAndroid Build Coastguard Worker  ret i32 0
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Workerbb3:                                              ; preds = %entry
49*9880d681SAndroid Build Coastguard Worker  ret i32 3
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerbb4:                                              ; preds = %entry
52*9880d681SAndroid Build Coastguard Worker  ret i32 4
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerbb5:                                              ; preds = %entry
55*9880d681SAndroid Build Coastguard Worker  ret i32 1
56*9880d681SAndroid Build Coastguard Worker}
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker; STATIC-O32: .p2align  2
59*9880d681SAndroid Build Coastguard Worker; STATIC-O32: $JTI0_0:
60*9880d681SAndroid Build Coastguard Worker; STATIC-O32: .4byte
61*9880d681SAndroid Build Coastguard Worker; STATIC-O32: .4byte
62*9880d681SAndroid Build Coastguard Worker; STATIC-O32: .4byte
63*9880d681SAndroid Build Coastguard Worker; STATIC-O32: .4byte
64*9880d681SAndroid Build Coastguard Worker; PIC-O32: .p2align  2
65*9880d681SAndroid Build Coastguard Worker; PIC-O32: $JTI0_0:
66*9880d681SAndroid Build Coastguard Worker; PIC-O32: .gpword
67*9880d681SAndroid Build Coastguard Worker; PIC-O32: .gpword
68*9880d681SAndroid Build Coastguard Worker; PIC-O32: .gpword
69*9880d681SAndroid Build Coastguard Worker; PIC-O32: .gpword
70*9880d681SAndroid Build Coastguard Worker; N64: .p2align  3
71*9880d681SAndroid Build Coastguard Worker; N64: $JTI0_0:
72*9880d681SAndroid Build Coastguard Worker; N64: .gpdword
73*9880d681SAndroid Build Coastguard Worker; N64: .gpdword
74*9880d681SAndroid Build Coastguard Worker; N64: .gpdword
75*9880d681SAndroid Build Coastguard Worker; N64: .gpdword
76*9880d681SAndroid Build Coastguard Worker
77