[ARM] Better OR's for MVE compares
[llvm-core.git] / test / MC / Mips / expansion-jal-sym-pic.s
blobe20562a88a5f70f29c9b18c60288315a54827e06
1 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu -show-encoding |\
2 # RUN: FileCheck %s -check-prefixes=ALL,MIPS,O32
4 # RUN: llvm-mc %s -triple mips64-unknown-linux-gnuabin32 -show-encoding |\
5 # RUN: FileCheck %s -check-prefixes=ALL,MIPS,N32
7 # RUN: llvm-mc %s -triple mips64-unknown-linux-gnu -show-encoding |\
8 # RUN: FileCheck %s -check-prefixes=ALL,MIPS,N64
10 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu -mattr=micromips -show-encoding |\
11 # RUN: FileCheck %s -check-prefixes=ALL,MM,O32-MM
13 # Repeat the tests but using ELF output. An initial version of this patch did
14 # this as the output different depending on whether it went through
15 # MCAsmStreamer or MCELFStreamer. This ensures that the assembly expansion and
16 # direct objection emission match.
18 # RUN: llvm-mc %s -triple mips-unknown-linux-gnu -filetype=obj | \
19 # RUN: llvm-objdump -d -r - | FileCheck %s -check-prefixes=ELF-O32
20 # RUN: llvm-mc %s -triple mips64-unknown-linux-gnuabin32 -filetype=obj | \
21 # RUN: llvm-objdump -d -r - | FileCheck %s -check-prefixes=ELF-N32
22 # RUN: llvm-mc %s -triple mips64-unknown-linux-gnu -filetype=obj | \
23 # RUN: llvm-objdump -d -r - | FileCheck %s -check-prefixes=ELF-N64
25 .weak weak_label
27 .text
28 .option pic2
30 .ent local_label
31 local_label:
32 .frame $sp, 0, $ra
33 .set noreorder
35 jal local_label
36 nop
38 # Expanding "jal local_label":
39 # O32: lw $25, %got(local_label)($gp) # encoding: [0x8f,0x99,A,A]
40 # O32: # fixup A - offset: 0, value: %got(local_label), kind: fixup_Mips_GOT
41 # O32: addiu $25, $25, %lo(local_label) # encoding: [0x27,0x39,A,A]
42 # O32: # fixup A - offset: 0, value: %lo(local_label), kind: fixup_Mips_LO16
43 # O32-NEXT: .reloc ($tmp0), R_MIPS_JALR, local_label
45 # ELF-O32: 8f 99 00 00 lw $25, 0($gp)
46 # ELF-O32-NEXT: R_MIPS_GOT16 .text
47 # ELF-O32-NEXT: 27 39 00 00 addiu $25, $25, 0
48 # ELF-O32-NEXT: R_MIPS_LO16 .text
49 # ELF-O32-NEXT: 03 20 f8 09 jalr $25
50 # ELF-O32-NEXT: R_MIPS_JALR local_label
52 # N32: lw $25, %got_disp(local_label)($gp) # encoding: [0x8f,0x99,A,A]
53 # N32: # fixup A - offset: 0, value: %got_disp(local_label), kind: fixup_Mips_GOT_DISP
54 # N32-NEXT: .reloc .Ltmp0, R_MIPS_JALR, local_label
56 # ELF-N32: 8f 99 00 00 lw $25, 0($gp)
57 # ELF-N32-NEXT: R_MIPS_GOT_DISP local_label
58 # ELF-N32-NEXT: 03 20 f8 09 jalr $25
59 # ELF-N32-NEXT: R_MIPS_JALR local_label
61 # N64: ld $25, %got_disp(local_label)($gp) # encoding: [0xdf,0x99,A,A]
62 # N64: # fixup A - offset: 0, value: %got_disp(local_label), kind: fixup_Mips_GOT_DISP
63 # N64-NEXT: .reloc .Ltmp0, R_MIPS_JALR, local_label
65 # ELF-N64: df 99 00 00 ld $25, 0($gp)
66 # ELF-N64-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE local_label
67 # ELF-N64-NEXT: 03 20 f8 09 jalr $25
68 # ELF-N64-NEXT: R_MIPS_JALR/R_MIPS_NONE/R_MIPS_NONE local_label
70 # O32-MM: lw $25, %got(local_label)($gp) # encoding: [0xff,0x3c,A,A]
71 # O32-MM: # fixup A - offset: 0, value: %got(local_label), kind: fixup_MICROMIPS_GOT16
72 # O32-MM: addiu $25, $25, %lo(local_label) # encoding: [0x33,0x39,A,A]
73 # O32-MM: # fixup A - offset: 0, value: %lo(local_label), kind: fixup_MICROMIPS_LO16
74 # O32-MM-NEXT: .reloc ($tmp0), R_MICROMIPS_JALR, local_label
76 # MIPS: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
77 # MM: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
78 # ALL: nop # encoding: [0x00,0x00,0x00,0x00]
80 jal weak_label
81 nop
83 # Expanding "jal weak_label":
84 # O32: lw $25, %call16(weak_label)($gp) # encoding: [0x8f,0x99,A,A]
85 # O32: # fixup A - offset: 0, value: %call16(weak_label), kind: fixup_Mips_CALL16
86 # O32-NEXT: .reloc ($tmp1), R_MIPS_JALR, weak_label
88 # ELF-O32: 8f 99 00 00 lw $25, 0($gp)
89 # ELF-O32-NEXT: R_MIPS_CALL16 weak_label
90 # ELF-O32-NEXT: 03 20 f8 09 jalr $25
91 # ELF-O32-NEXT: R_MIPS_JALR weak_label
93 # N32: lw $25, %call16(weak_label)($gp) # encoding: [0x8f,0x99,A,A]
94 # N32: # fixup A - offset: 0, value: %call16(weak_label), kind: fixup_Mips_CALL16
95 # N32-NEXT: .reloc .Ltmp1, R_MIPS_JALR, weak_label
97 # ELF-N32: 8f 99 00 00 lw $25, 0($gp)
98 # ELF-N32-NEXT: R_MIPS_CALL16 weak_label
99 # ELF-N32-NEXT: 03 20 f8 09 jalr $25
100 # ELF-N32-NEXT: R_MIPS_JALR weak_label
102 # N64: ld $25, %call16(weak_label)($gp) # encoding: [0xdf,0x99,A,A]
103 # N64: # fixup A - offset: 0, value: %call16(weak_label), kind: fixup_Mips_CALL16
104 # N64-NEXT: .reloc .Ltmp1, R_MIPS_JALR, weak_label
106 # ELF-N64: df 99 00 00 ld $25, 0($gp)
107 # ELF-N64-NEXT: R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE weak_label
108 # ELF-N64-NEXT: 03 20 f8 09 jalr $25
109 # ELF-N64-NEXT: R_MIPS_JALR/R_MIPS_NONE/R_MIPS_NONE weak_label
111 # O32-MM: lw $25, %call16(weak_label)($gp) # encoding: [0xff,0x3c,A,A]
112 # O32-MM: # fixup A - offset: 0, value: %call16(weak_label), kind: fixup_MICROMIPS_CALL16
113 # O32-MM-NEXT: .reloc ($tmp1), R_MICROMIPS_JALR, weak_label
115 # MIPS: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
116 # MM: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
117 # ALL: nop # encoding: [0x00,0x00,0x00,0x00]
119 jal global_label
122 # Expanding "jal global_label":
123 # O32: lw $25, %call16(global_label)($gp) # encoding: [0x8f,0x99,A,A]
124 # O32: # fixup A - offset: 0, value: %call16(global_label), kind: fixup_Mips_CALL16
125 # O32-NEXT: .reloc ($tmp2), R_MIPS_JALR, global_label
127 # ELF-O32: 8f 99 00 00 lw $25, 0($gp)
128 # ELF-O32-NEXT: R_MIPS_CALL16 global_label
129 # ELF-O32-NEXT: 03 20 f8 09 jalr $25
130 # ELF-O32-NEXT: R_MIPS_JALR global_label
132 # N32: lw $25, %call16(global_label)($gp) # encoding: [0x8f,0x99,A,A]
133 # N32: # fixup A - offset: 0, value: %call16(global_label), kind: fixup_Mips_CALL16
134 # N32-NEXT: .reloc .Ltmp2, R_MIPS_JALR, global_label
136 # ELF-N32: 8f 99 00 00 lw $25, 0($gp)
137 # ELF-N32-NEXT: R_MIPS_CALL16 global_label
138 # ELF-N32-NEXT: 03 20 f8 09 jalr $25
139 # ELF-N32-NEXT: R_MIPS_JALR global_label
141 # N64: ld $25, %call16(global_label)($gp) # encoding: [0xdf,0x99,A,A]
142 # N64: # fixup A - offset: 0, value: %call16(global_label), kind: fixup_Mips_CALL16
143 # N64-NEXT: .reloc .Ltmp2, R_MIPS_JALR, global_label
145 # ELF-N64: df 99 00 00 ld $25, 0($gp)
146 # ELF-N64-NEXT: R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE global_label
147 # ELF-N64-NEXT: 03 20 f8 09 jalr $25
148 # ELF-N64-NEXT: R_MIPS_JALR/R_MIPS_NONE/R_MIPS_NONE global_label
150 # O32-MM: lw $25, %call16(global_label)($gp) # encoding: [0xff,0x3c,A,A]
151 # O32-MM: # fixup A - offset: 0, value: %call16(global_label), kind: fixup_MICROMIPS_CALL16
152 # O32-MM-NEXT: .reloc ($tmp2), R_MICROMIPS_JALR, global_label
154 # MIPS: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
155 # MM: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
156 # ALL: nop # encoding: [0x00,0x00,0x00,0x00]
158 jal .text
161 # Expanding "jal .text":
162 # O32: lw $25, %got(.text)($gp) # encoding: [0x8f,0x99,A,A]
163 # O32-NEXT: # fixup A - offset: 0, value: %got(.text), kind: fixup_Mips_GOT
165 # ELF-O32: 8f 99 00 00 lw $25, 0($gp)
166 # ELF-O32-NEXT: R_MIPS_GOT16 .text
168 # N32: lw $25, %got_disp(.text)($gp) # encoding: [0x8f,0x99,A,A]
169 # N32-NEXT: # fixup A - offset: 0, value: %got_disp(.text), kind: fixup_Mips_GOT_DISP
171 # ELF-N32: 8f 99 00 00 lw $25, 0($gp)
172 # ELF-N32-NEXT: R_MIPS_GOT_DISP .text
174 # N64: ld $25, %got_disp(.text)($gp) # encoding: [0xdf,0x99,A,A]
175 # N64-NEXT: # fixup A - offset: 0, value: %got_disp(.text), kind: fixup_Mips_GOT_DISP
177 # ELF-N64: df 99 00 00 ld $25, 0($gp)
178 # ELF-N64-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE .text
180 # O32-MM: lw $25, %got(.text)($gp) # encoding: [0xff,0x3c,A,A]
181 # O32-MM-NEXT: # fixup A - offset: 0, value: %got(.text), kind: fixup_MICROMIPS_GOT16
182 # O32-MM-NEXT: addiu $25, $25, %lo(.text) # encoding: [0x33,0x39,A,A]
183 # O32-MM-NEXT: # fixup A - offset: 0, value: %lo(.text), kind: fixup_MICROMIPS_LO16
184 # O32-MM-NEXT: .reloc ($tmp3), R_MICROMIPS_JALR, .text
186 # MIPS: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
187 # MM: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
188 # ALL: nop # encoding: [0x00,0x00,0x00,0x00]
190 # local labels ($tmp symbols)
191 jal 1f
194 # Expanding "jal 1f":
195 # O32: lw $25, %got($tmp4)($gp) # encoding: [0x8f,0x99,A,A]
196 # O32: # fixup A - offset: 0, value: %got($tmp4), kind: fixup_Mips_GOT
197 # O32: addiu $25, $25, %lo($tmp4) # encoding: [0x27,0x39,A,A]
198 # O32: # fixup A - offset: 0, value: %lo($tmp4), kind: fixup_Mips_LO16
199 # O32-NEXT: .reloc ($tmp5), R_MIPS_JALR, ($tmp4)
201 # ELF-O32: 8f 99 00 00 lw $25, 0($gp)
202 # ELF-O32-NEXT: R_MIPS_GOT16 .text
203 # ELF-O32-NEXT: 27 39 00 58 addiu $25, $25, 88
204 # ELF-O32-NEXT: R_MIPS_LO16 .text
205 # ELF-O32-NEXT: 03 20 f8 09 jalr $25
206 # ELF-O32-NEXT: R_MIPS_JALR $tmp0
208 # N32: lw $25, %got_disp(.Ltmp4)($gp) # encoding: [0x8f,0x99,A,A]
209 # N32: # fixup A - offset: 0, value: %got_disp(.Ltmp4), kind: fixup_Mips_GOT_DISP
211 # ELF-N32: 8f 99 00 00 lw $25, 0($gp)
212 # ELF-N32-NEXT: R_MIPS_GOT_DISP .Ltmp0
214 # N64: ld $25, %got_disp(.Ltmp4)($gp) # encoding: [0xdf,0x99,A,A]
215 # N64: # fixup A - offset: 0, value: %got_disp(.Ltmp4), kind: fixup_Mips_GOT_DISP
217 # ELF-N64: df 99 00 00 ld $25, 0($gp)
218 # ELF-N64-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE .Ltmp0
220 # O32-MM: lw $25, %got($tmp4)($gp) # encoding: [0xff,0x3c,A,A]
221 # O32-MM: # fixup A - offset: 0, value: %got($tmp4), kind: fixup_MICROMIPS_GOT16
222 # O32-MM: addiu $25, $25, %lo($tmp4) # encoding: [0x33,0x39,A,A]
223 # O32-MM: # fixup A - offset: 0, value: %lo($tmp4), kind: fixup_MICROMIPS_LO16
224 # O32-MM-NEXT: .reloc ($tmp5), R_MICROMIPS_JALR, ($tmp4)
226 # MIPS: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
227 # MM: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
228 # ALL: nop # encoding: [0x00,0x00,0x00,0x00]
230 .local forward_local
231 jal forward_local
234 # Expanding "jal forward_local":
235 # O32-FIXME: lw $25, %got(forward_local)($gp) # encoding: [0x8f,0x99,A,A]
236 # O32-FIXME: # fixup A - offset: 0, value: %got(forward_local), kind: fixup_Mips_GOT
237 # O32-FIXME: addiu $25, $25, %lo(forward_local) # encoding: [0x27,0x39,A,A]
238 # O32-FIXME:: # fixup A - offset: 0, value: %lo(forward_local), kind: fixup_Mips_LO16
239 # O32-FIXME: .reloc ($tmp6), R_MIPS_JALR, forward_local
241 # ELF-O32: 8f 99 00 00 lw $25, 0($gp)
242 # ELF-O32-NEXT: R_MIPS_GOT16 .text
243 # ELF-O32-NEXT: 27 39 00 64 addiu $25, $25, 100
244 # ELF-O32-NEXT: R_MIPS_LO16 .text
245 # ELF-O32-NEXT: 03 20 f8 09 jalr $25
246 # ELF-O32-NEXT: R_MIPS_JALR forward_local
248 # N32-FIXME: lw $25, %got_disp(forward_local)($gp) # encoding: [0x8f,0x99,A,A]
249 # N32-FIXME: # fixup A - offset: 0, value: %got_disp(forward_local), kind: fixup_Mips_GOT_DISP
251 # ELF-N32: 8f 99 00 00 lw $25, 0($gp)
252 # ELF-N32-NEXT: R_MIPS_GOT_DISP forward_local
254 # N64-FIXME: ld $25, %got_disp(forward_local)($gp) # encoding: [0xdf,0x99,A,A]
255 # N64-FIXME: # fixup A - offset: 0, value: %got_disp(forward_local), kind: fixup_Mips_GOT_DISP
257 # ELF-N64: df 99 00 00 ld $25, 0($gp)
258 # ELF-N64-NEXT: R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE forward_local
260 # O32-MM-FIXME: lw $25, %got(forward_local)($gp) # encoding: [0xff,0x3c,A,A]
261 # O32-MM-FIXME: # fixup A - offset: 0, value: %got(forward_local), kind: fixup_MICROMIPS_GOT16
262 # O32-MM-FIXME: addiu $25, $25, %lo(forward_local) # encoding: [0x33,0x39,A,A]
263 # O32-MM-FIXME: # fixup A - offset: 0, value: %lo(forward_local), kind: fixup_MICROMIPS_LO16
264 # O32-MM-FIXME: .reloc ($tmp6), R_MIPS_JALR, forward_local
266 # MIPS: jalr $25 # encoding: [0x03,0x20,0xf8,0x09]
267 # MM: jalr $ra, $25 # encoding: [0x03,0xf9,0x0f,0x3c]
268 # ALL: nop # encoding: [0x00,0x00,0x00,0x00]
270 .end local_label
274 add $8, $8, $8
276 forward_local: