1 /* Copyright 2010-2019 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 #if defined (__thumb__)
32 /* Test call and return */
38 nop @ Location test_ret_end
43 /* Test ldr from pc */
46 /* Test ldm/stm only in ARM mode */
47 #if !defined (__thumb__)
51 /* Test ldrX literal in ARM and Thumb-2 */
52 #if !defined (__thumb__) || defined(__thumb2__)
56 /* Test ldr literal in Thumb */
57 #if defined(__thumb__)
58 bl test_ldr_literal_16
61 /* Test cbnz/cbz in Thumb-2 */
62 #if defined(__thumb2__)
66 /* Test adr in Thumb and Thumb-2 */
67 #if defined(__thumb__)
70 /* Test 32-bit adr in ARM and Thumb-2 */
71 #if defined(__thumb2__) || !defined(__thumb__)
77 /* Test str in ARM mode and Thumb-2 */
78 #if !defined(__thumb__)
82 /* Test add with pc in Thumb and Thumb-2 */
83 #if defined(__thumb__)
93 .global test_call_subr
94 #if defined (__thumb__)
98 .type test_call_subr, %function
101 .global test_call_end
103 nop @ Location test_call_end
107 .size test_call_subr, .-test_call_subr
111 #if defined (__thumb__)
115 .type test_branch, %function
121 .size test_branch, .-test_branch
124 #if defined (__thumb__)
128 .type test_ldr_pc, %function
132 .global test_ldr_pc_ret
135 .size test_ldr_pc, .-test_ldr_pc
137 #if !defined (__thumb__)
138 .global test_ldm_stm_pc
139 .type test_ldm_stm_pc, %function
148 .global test_ldm_stm_pc_ret
153 .word test_ldm_stm_pc_ret
154 .size test_ldm_stm_pc, .-test_ldm_stm_pc
157 #if !defined (__thumb__) || defined(__thumb2__)
158 .global test_ldr_literal
159 .type test_ldr_literal, %function
162 .global test_ldrsb_literal
165 .global test_ldrsh_literal
168 .global test_ldr_literal_end
169 test_ldr_literal_end:
171 .size test_ldr_literal, .-test_ldr_literal
174 #if defined(__thumb__)
175 .global test_ldr_literal_16
180 .global test_ldr_literal_16_end
181 test_ldr_literal_16_end:
185 .word test_ldr_literal_16
186 .size test_ldr_literal_16, .-test_ldr_literal_16
189 #if defined(__thumb2__)
190 .global test_cbz_cbnz
195 .global test_zero_cbnz
198 .global test_zero_cbz
203 .global test_non_zero_cbz
206 .global test_non_zero_cbnz
211 .global test_cbz_cbnz_end
214 .size test_cbz_cbnz, .-test_cbz_cbnz
217 #if defined(__thumb__)
230 .size test_adr, .-test_adr
233 #if defined(__thumb2__) || !defined(__thumb__)
234 .global test_adr_32bit
235 #if defined(__thumb2__)
244 .global test_adr_32bit_after
245 test_adr_32bit_after:
248 .global test_adr_32bit_end
251 .size test_adr_32bit, .-test_adr_32bit
255 .type test_pop_pc, %function
256 #if defined(__thumb__)
264 #if defined(__thumb__)
271 .global test_pop_pc_1
277 #if defined(__thumb__)
282 .global test_pop_pc_2
286 /* Test pop instruction with full register list. */
290 #if defined(__thumb__)
296 push {r1} /* Push the right address so that PC will get it. */
297 /* Push the wrong address so r0-r7 will get the wrong a ddress. If PC
298 is set from any of them, we can get a FAIL. */
308 pop {r0,r1,r2,r3,r4,r5,r6,r7,pc}
309 .global test_pop_pc_ret
314 .global test_pop_pc_1_right
316 b test_pop_pc_2_start /* right */
317 .global test_pop_pc_1_wrong
319 b test_pop_pc_2_start /* wrong */
320 .global test_pop_pc_2_right
322 b test_pop_pc_3_start /* right */
323 .global test_pop_pc_2_wrong
325 b test_pop_pc_3_start /* wrong */
326 .global test_pop_pc_3_right
328 b test_pop_pc_ret /* right */
329 .global test_pop_pc_3_wrong
331 b test_pop_pc_ret /* wrong */
335 .word test_pop_pc_1_right
337 .word test_pop_pc_1_wrong
339 .word test_pop_pc_2_right
341 .word test_pop_pc_2_wrong
343 .word test_pop_pc_3_right
345 .word test_pop_pc_3_wrong
346 .size test_pop_pc, .-test_pop_pc
348 #if !defined(__thumb__)
349 #if defined (__thumb2__)
354 .type test_str_pc, %function
359 /* compute offset again without displaced stepping. */
364 /* r0 should be equal to r1. */
368 .global pc_offset_right
372 .global pc_offset_wrong
376 .global test_str_pc_end
381 #if defined(__thumb__)
382 .global test_add_rn_pc
387 test_add_rn_pc_start:
389 .global test_add_rn_pc_end
392 .size test_add_rn_pc, .-test_add_rn_pc