1# thumb_blx_in_range.s
2#
3# Test THUMB/THUMB-2 blx instructions just within the branch range limits.
4# Because bit 1 of the branch target comes from the branch instruction
5# address, the branch range from PC (branch instruction address + 4) is
6# acutally -((1<<22) + 2) to ((1<<22) - 4) for THUMB and -((1<<24) + 2) to
7# ((1<<24) - 4) from THUMB2.
8
9	.syntax	unified
10	.section	.text.pre,"x"
11
12# Add padding so that target is just in branch range.
13	.space	8
14
15	.align	2
16	.global	_backward_target
17	.code	32
18	.type	_backword_target, %function
19_backward_target:
20	bx	lr
21	.size	_backward_target, .-_backward_target
22
23	.text
24
25# Define _start so that linker does not complain.
26	.global	_start
27	.code	32
28	.align	2
29	.type	_start, %function
30_start:
31	bx	lr
32	.size	_start, .-_start
33
34	.global	_backward_test
35	.code	16
36	.thumb_func
37	.type	_backward_test, %function
38_backward_test:
39	nop.n
40	blx	_backward_target
41	.size	_backward_test, .-_backward_test
42
43	.align	2
44	.global	_forward_test
45	.code	16
46	.thumb_func
47	.type	_forward_test, %function
48_forward_test:
49	blx	_forward_target
50	.size	_forward_test, .-_forward_test
51	.code	32
52
53	.section	.text.post,"x"
54
55# Add padding so that target is just in branch range.
56	.space	12
57
58	.align	2
59	.global	_forward_target
60	.code	32
61	.type	_forward_target, %function
62_forward_target:
63	bx	lr
64	.size	_forward_target, .-_forward_target
65