fixed bash/dash/sh issue (Ubuntu)
[zpugcc/jano.git] / toolchain / binutils / ld / testsuite / ld-m68hc11 / adj-jump.s
blob99b7258d8d9209fb292ac44cd6c9cae6815646da
1 ;;; Test 68HC11 linker relaxation and fixup of bcc/bra branches
2 ;;;
3 .sect .text
4 .globl _start
5 _start:
6 ;; Next 'bra' is assembled as a 'jmp'. It is relaxed to 'bra L3'
7 ;; during a second pass of relax.
8 bra L3
9 .skip 20
10 ;; Next 'jmp' must be relaxed to a 'bra' during the first pass.
11 ;; The branch offset must then be adjusted by consecutive relax.
12 jmp L3
13 L1:
14 addd 0,x
15 bne L1 ; Branch not adjusted
16 addd _toto
17 beq L1 ; Backward branch, adjust -1
18 addd _toto+1
19 jbne L1 ; Backward branch, adjust -2
20 bgt L1 ; All possible backward branchs, adjust -2
21 bge L1
22 beq L1
23 ble L1
24 blt L1
25 bhi L1
26 bhs L1
27 beq L1
28 bls L1
29 blo L1
30 bcs L1
31 bmi L1
32 bvs L1
33 bcc L1
34 bpl L1
35 bvc L1
36 bne L1
37 brn L1
38 bra L1
39 ;; Relax several insn to reduce block by 15
40 addd _toto
41 addd _toto
42 addd _toto
43 addd _toto
44 addd _toto
45 addd _toto
46 addd _toto
47 addd _toto
48 addd _toto
49 addd _toto
50 addd _toto
51 addd _toto
52 addd _toto
53 addd _toto
54 addd _toto
55 L2:
56 jmp _start ; -> relax to bra _start
57 bne L2 ; Backward branch, adjust -1
58 beq L3 ; Forward branch, adjust -2
59 addd _toto
60 beq L3 ; Forward branch, adjust -1
61 addd _toto
62 L3:
63 addd _toto
64 rts
66 .sect .page0
67 _bar:
68 .long 0
69 _toto:
70 .long 0
71 .skip 32
72 stack:
73 .skip 10
74 _table: