1 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
2 ; RUN: -code-model=small -stop-after=machine-cp < %s | FileCheck \
3 ; RUN: --check-prefix=32SMALL-MIR %s
5 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
6 ; RUN: -code-model=large -stop-after=machine-cp < %s | FileCheck \
7 ; RUN: --check-prefix=32LARGE-MIR %s
9 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \
10 ; RUN: -code-model=small -stop-after=machine-cp < %s | FileCheck \
11 ; RUN: --check-prefix=64SMALL-MIR %s
13 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \
14 ; RUN: -code-model=large -stop-after=machine-cp < %s | FileCheck \
15 ; RUN: --check-prefix=64LARGE-MIR %s
17 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=small < %s | FileCheck \
18 ; RUN: --check-prefixes=32SMALL-ASM,SMALL-ASM %s
20 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -code-model=large < %s | FileCheck \
21 ; RUN: --check-prefixes=32LARGE-ASM,LARGE-ASM %s
23 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -code-model=small < %s | FileCheck \
24 ; RUN: --check-prefixes=64SMALL-ASM,SMALL-ASM %s
26 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -code-model=large < %s | FileCheck \
27 ; RUN: --check-prefixes=64LARGE-ASM,LARGE-ASM %s
29 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -function-sections < %s | FileCheck \
30 ; RUN: --check-prefix=FUNC-ASM %s
32 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -function-sections < %s | FileCheck \
33 ; RUN: --check-prefix=FUNC-ASM %s
35 define i32 @jump_table(i32 %a) {
37 switch i32 %a, label %sw.epilog [
45 tail call void asm sideeffect "", ""()
49 tail call void asm sideeffect "", ""()
53 tail call void asm sideeffect "", ""()
57 tail call void asm sideeffect "", ""()
65 ; 32SMALL-MIR: renamable $r[[REG1:[0-9]+]] = LWZtoc %jump-table.0, $r2 :: (load (s32) from got)
66 ; 32SMALL-MIR: renamable $r[[REG3:[0-9]+]] = RLWINM killed renamable $r[[REG2:[0-9]+]], 2, 0, 29
67 ; 32SMALL-MIR: renamable $r[[REG4:[0-9]+]] = LWZX killed renamable $r[[REG3]], renamable $r[[REG1]] :: (load (s32) from jump-table)
68 ; 32SMALL-MIR: renamable $r[[REG5:[0-9]+]] = ADD4 killed renamable $r[[REG4]], killed renamable $r[[REG1]]
70 ; 32LARGE-MIR: renamable $r[[REG1:[0-9]+]] = ADDIStocHA $r2, %jump-table.0
71 ; 32LARGE-MIR: renamable $r[[REG2:[0-9]+]] = LWZtocL %jump-table.0, killed renamable $r[[REG1]], implicit $r2 :: (load (s32) from got)
72 ; 32LARGE-MIR: renamable $r[[REG4:[0-9]+]] = RLWINM killed renamable $r[[REG3:[0-9]+]], 2, 0, 29
73 ; 32LARGE-MIR: renamable $r[[REG5:[0-9]+]] = LWZX killed renamable $r[[REG4]], renamable $r[[REG2]] :: (load (s32) from jump-table)
74 ; 32LARGE-MIR: renamable $r[[REG6:[0-9]+]] = ADD4 killed renamable $r[[REG5]], killed renamable $r[[REG2]]
76 ; 64SMALL-MIR: renamable $x[[REG1:[0-9]+]] = LDtocJTI %jump-table.0, $x2 :: (load (s64) from got)
77 ; 64SMALL-MIR: renamable $x[[REG3:[0-9]+]] = RLDIC killed renamable $x[[REG2:[0-9]+]], 2, 30
78 ; 64SMALL-MIR: renamable $x[[REG4:[0-9]+]] = LWAX killed renamable $x[[REG3]], renamable $x[[REG1]] :: (load (s32) from jump-table)
79 ; 64SMALL-MIR: renamable $x[[REG6:[0-9]+]] = ADD8 killed renamable $x[[REG4]], killed renamable $x[[REG1]]
81 ; 64LARGE-MIR: renamable $x[[REG1:[0-9]+]] = ADDIStocHA8 $x2, %jump-table.0
82 ; 64LARGE-MIR: renamable $x[[REG2:[0-9]+]] = LDtocL %jump-table.0, killed renamable $x[[REG1]], implicit $x2 :: (load (s64) from got)
83 ; 64LARGE-MIR: renamable $x[[REG4:[0-9]+]] = RLDIC killed renamable $x[[REG3:[0-9]+]], 2, 30
84 ; 64LARGE-MIR: renamable $x[[REG5:[0-9]+]] = LWAX killed renamable $x[[REG4]], renamable $x[[REG2]] :: (load (s32) from jump-table)
85 ; 64LARGE-MIR: renamable $x[[REG6:[0-9]+]] = ADD8 killed renamable $x[[REG5]], killed renamable $x[[REG2]]
87 ; 32SMALL-ASM-LABEL: jump_table
88 ; 32SMALL-ASM: .jump_table:
89 ; 32SMALL-ASM: addi 3, 3, -1
90 ; 32SMALL-ASM: cmplwi 3, 3
91 ; 32SMALL-ASM: bgt 0, L..BB0_6
92 ; 32SMALL-ASM: lwz 4, L..C0(2)
93 ; 32SMALL-ASM: slwi 3, 3, 2
94 ; 32SMALL-ASM: lwzx 3, 3, 4
95 ; 32SMALL-ASM: add 3, 3, 4
96 ; 32SMALL-ASM: mtctr 3
98 ; 32SMALL-ASM: L..BB0_2:
99 ; 32SMALL-ASM: L..BB0_3:
100 ; 32SMALL-ASM: L..BB0_4:
101 ; 32SMALL-ASM: L..BB0_5:
102 ; 32SMALL-ASM: L..BB0_6:
103 ; 32SMALL-ASM: li 3, 0
105 ; 32SMALL-ASM: .csect .rodata[RO],2
106 ; 32SMALL-ASM: .align 2
107 ; 32SMALL-ASM: L..JTI0_0:
108 ; 32SMALL-ASM: .vbyte 4, L..BB0_2-L..JTI0_0
109 ; 32SMALL-ASM: .vbyte 4, L..BB0_3-L..JTI0_0
110 ; 32SMALL-ASM: .vbyte 4, L..BB0_4-L..JTI0_0
111 ; 32SMALL-ASM: .vbyte 4, L..BB0_5-L..JTI0_0
113 ; 32LARGE-ASM-LABEL: jump_table
114 ; 32LARGE-ASM: .jump_table:
115 ; 32LARGE-ASM: addi 3, 3, -1
116 ; 32LARGE-ASM: cmplwi 3, 3
117 ; 32LARGE-ASM: bgt 0, L..BB0_6
118 ; 32LARGE-ASM: addis 4, L..C0@u(2)
119 ; 32LARGE-ASM: slwi 3, 3, 2
120 ; 32LARGE-ASM: lwz 4, L..C0@l(4)
121 ; 32LARGE-ASM: lwzx 3, 3, 4
122 ; 32LARGE-ASM: add 3, 3, 4
123 ; 32LARGE-ASM: mtctr 3
125 ; 32LARGE-ASM: L..BB0_2:
126 ; 32LARGE-ASM: L..BB0_3:
127 ; 32LARGE-ASM: L..BB0_4:
128 ; 32LARGE-ASM: L..BB0_5:
129 ; 32LARGE-ASM: L..BB0_6:
130 ; 32LARGE-ASM: li 3, 0
132 ; 32LARGE-ASM: .csect .rodata[RO],2
133 ; 32LARGE-ASM: .align 2
134 ; 32LARGE-ASM: L..JTI0_0:
135 ; 32LARGE-ASM: .vbyte 4, L..BB0_2-L..JTI0_0
136 ; 32LARGE-ASM: .vbyte 4, L..BB0_3-L..JTI0_0
137 ; 32LARGE-ASM: .vbyte 4, L..BB0_4-L..JTI0_0
138 ; 32LARGE-ASM: .vbyte 4, L..BB0_5-L..JTI0_0
140 ; 64SMALL-ASM-LABEL: jump_table
141 ; 64SMALL-ASM: .jump_table:
142 ; 64SMALL-ASM: addi 3, 3, -1
143 ; 64SMALL-ASM: cmplwi 3, 3
144 ; 64SMALL-ASM: bgt 0, L..BB0_6
145 ; 64SMALL-ASM: ld 4, L..C0(2)
146 ; 64SMALL-ASM: rldic 3, 3, 2, 30
147 ; 64SMALL-ASM: lwax 3, 3, 4
148 ; 64SMALL-ASM: add 3, 3, 4
149 ; 64SMALL-ASM: mtctr 3
151 ; 64SMALL-ASM: L..BB0_2:
152 ; 64SMALL-ASM: L..BB0_3:
153 ; 64SMALL-ASM: L..BB0_4:
154 ; 64SMALL-ASM: L..BB0_5:
155 ; 64SMALL-ASM: L..BB0_6:
156 ; 64SMALL-ASM: li 3, 0
158 ; 64SMALL-ASM: .csect .rodata[RO],2
159 ; 64SMALL-ASM: .align 2
160 ; 64SMALL-ASM: L..JTI0_0:
161 ; 64SMALL-ASM: .vbyte 4, L..BB0_2-L..JTI0_0
162 ; 64SMALL-ASM: .vbyte 4, L..BB0_3-L..JTI0_0
163 ; 64SMALL-ASM: .vbyte 4, L..BB0_4-L..JTI0_0
164 ; 64SMALL-ASM: .vbyte 4, L..BB0_5-L..JTI0_0
166 ; 64LARGE-ASM-LABEL: jump_table
167 ; 64LARGE-ASM: .jump_table:
168 ; 64LARGE-ASM: addi 3, 3, -1
169 ; 64LARGE-ASM: cmplwi 3, 3
170 ; 64LARGE-ASM: bgt 0, L..BB0_6
171 ; 64LARGE-ASM: addis 4, L..C0@u(2)
172 ; 64LARGE-ASM: rldic 3, 3, 2, 30
173 ; 64LARGE-ASM: ld 4, L..C0@l(4)
174 ; 64LARGE-ASM: lwax 3, 3, 4
175 ; 64LARGE-ASM: add 3, 3, 4
176 ; 64LARGE-ASM: mtctr 3
178 ; 64LARGE-ASM: L..BB0_2:
179 ; 64LARGE-ASM: L..BB0_3:
180 ; 64LARGE-ASM: L..BB0_4:
181 ; 64LARGE-ASM: L..BB0_5:
182 ; 64LARGE-ASM: L..BB0_6:
183 ; 64LARGE-ASM: li 3, 0
185 ; 64LARGE-ASM: .csect .rodata[RO],2
186 ; 64LARGE-ASM: .align 2
187 ; 64LARGE-ASM: L..JTI0_0:
188 ; 64LARGE-ASM: .vbyte 4, L..BB0_2-L..JTI0_0
189 ; 64LARGE-ASM: .vbyte 4, L..BB0_3-L..JTI0_0
190 ; 64LARGE-ASM: .vbyte 4, L..BB0_4-L..JTI0_0
191 ; 64LARGE-ASM: .vbyte 4, L..BB0_5-L..JTI0_0
193 ; FUNC-ASM: .csect .jump_table[PR],2
194 ; FUNC-ASM: L..BB0_2:
195 ; FUNC-ASM: L..BB0_3:
196 ; FUNC-ASM: L..BB0_4:
197 ; FUNC-ASM: L..BB0_5:
198 ; FUNC-ASM: L..BB0_6:
201 ; FUNC-ASM: .csect .rodata.jmp..jump_table[RO],2
203 ; FUNC-ASM: L..JTI0_0:
204 ; FUNC-ASM: .vbyte 4, L..BB0_2-L..JTI0_0
205 ; FUNC-ASM: .vbyte 4, L..BB0_3-L..JTI0_0
206 ; FUNC-ASM: .vbyte 4, L..BB0_4-L..JTI0_0
207 ; FUNC-ASM: .vbyte 4, L..BB0_5-L..JTI0_0
210 ; SMALL-ASM: .tc L..JTI0_0[TC],L..JTI0_0
213 ; LARGE-ASM: .tc L..JTI0_0[TE],L..JTI0_0