1 /* Copyright 2010-2015 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__)
88 .global test_call_subr
89 #if defined (__thumb__)
93 .type test_call_subr, %function
98 nop @ Location test_call_end
102 .size test_call_subr, .-test_call_subr
106 #if defined (__thumb__)
110 .type test_branch, %function
116 .size test_branch, .-test_branch
119 #if defined (__thumb__)
123 .type test_ldr_pc, %function
127 .global test_ldr_pc_ret
130 .size test_ldr_pc, .-test_ldr_pc
132 #if !defined (__thumb__)
133 .global test_ldm_stm_pc
134 .type test_ldm_stm_pc, %function
143 .global test_ldm_stm_pc_ret
148 .word test_ldm_stm_pc_ret
149 .size test_ldm_stm_pc, .-test_ldm_stm_pc
152 #if !defined (__thumb__) || defined(__thumb2__)
153 .global test_ldr_literal
154 .type test_ldr_literal, %function
157 .global test_ldrsb_literal
160 .global test_ldrsh_literal
163 .global test_ldr_literal_end
164 test_ldr_literal_end:
166 .size test_ldr_literal, .-test_ldr_literal
169 #if defined(__thumb__)
170 .global test_ldr_literal_16
175 .global test_ldr_literal_16_end
176 test_ldr_literal_16_end:
180 .word test_ldr_literal_16
181 .size test_ldr_literal_16, .-test_ldr_literal_16
184 #if defined(__thumb2__)
185 .global test_cbz_cbnz
190 .global test_zero_cbnz
193 .global test_zero_cbz
198 .global test_non_zero_cbz
201 .global test_non_zero_cbnz
206 .global test_cbz_cbnz_end
209 .size test_cbz_cbnz, .-test_cbz_cbnz
212 #if defined(__thumb__)
225 .size test_adr, .-test_adr
228 #if defined(__thumb2__) || !defined(__thumb__)
229 .global test_adr_32bit
230 #if defined(__thumb2__)
239 .global test_adr_32bit_after
240 test_adr_32bit_after:
243 .global test_adr_32bit_end
246 .size test_adr_32bit, .-test_adr_32bit
250 .type test_pop_pc, %function
251 #if defined(__thumb__)
259 #if defined(__thumb__)
266 .global test_pop_pc_1
272 #if defined(__thumb__)
277 .global test_pop_pc_2
281 /* Test pop instruction with full register list. */
285 #if defined(__thumb__)
291 push {r1} /* Push the right address so that PC will get it. */
292 /* Push the wrong address so r0-r7 will get the wrong a ddress. If PC
293 is set from any of them, we can get a FAIL. */
303 pop {r0,r1,r2,r3,r4,r5,r6,r7,pc}
304 .global test_pop_pc_ret
309 .global test_pop_pc_1_right
311 b test_pop_pc_2_start /* right */
312 .global test_pop_pc_1_wrong
314 b test_pop_pc_2_start /* wrong */
315 .global test_pop_pc_2_right
317 b test_pop_pc_3_start /* right */
318 .global test_pop_pc_2_wrong
320 b test_pop_pc_3_start /* wrong */
321 .global test_pop_pc_3_right
323 b test_pop_pc_ret /* right */
324 .global test_pop_pc_3_wrong
326 b test_pop_pc_ret /* wrong */
330 .word test_pop_pc_1_right
332 .word test_pop_pc_1_wrong
334 .word test_pop_pc_2_right
336 .word test_pop_pc_2_wrong
338 .word test_pop_pc_3_right
340 .word test_pop_pc_3_wrong
341 .size test_pop_pc, .-test_pop_pc
343 #if !defined(__thumb__)
344 #if defined (__thumb2__)
349 .type test_str_pc, %function
354 /* compute offset again without displaced stepping. */
359 /* r0 should be equal to r1. */
363 .global pc_offset_right
367 .global pc_offset_wrong
371 .global test_str_pc_end