From 19dd1b4833bf0660f3788cce1fe14c54229145c3 Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Mon, 14 Oct 2002 21:20:16 +0000 Subject: [PATCH] * ld-m68hc11/m68hc11.exp: Specific tests for 68HC11/68HC12. * ld-m68hc11/adj-jump.d: New test for linker relaxation. * ld-m68hc11/adj-jump.s: Likewise. * ld-m68hc11/adj-brset.s: Likewise. * ld-m68hc11/adj-brset.d: Likewise. * ld-m68hc11/relax-direct.s: Likewise. * ld-m68hc11/relax-direct.d: Likewise. * ld-m68hc11/relax-group.s: Likewise. * ld-m68hc11/relax-group.d: Likewise. * ld-m68hc11/bug-1403.d: Likewise. * ld-m68hc11/bug-1403.s: Likewise. --- ld/testsuite/ChangeLog | 14 +++ ld/testsuite/ld-m68hc11/adj-brset.d | 32 +++++ ld/testsuite/ld-m68hc11/adj-brset.s | 51 ++++++++ ld/testsuite/ld-m68hc11/adj-jump.d | 60 +++++++++ ld/testsuite/ld-m68hc11/adj-jump.s | 74 ++++++++++++ ld/testsuite/ld-m68hc11/bug-1403.d | 12 ++ ld/testsuite/ld-m68hc11/bug-1403.s | 20 +++ ld/testsuite/ld-m68hc11/m68hc11.exp | 31 +++++ ld/testsuite/ld-m68hc11/relax-direct.d | 63 ++++++++++ ld/testsuite/ld-m68hc11/relax-direct.s | 84 +++++++++++++ ld/testsuite/ld-m68hc11/relax-group.d | 63 ++++++++++ ld/testsuite/ld-m68hc11/relax-group.s | 161 +++++++++++++++++++++++++ 12 files changed, 665 insertions(+) create mode 100644 ld/testsuite/ld-m68hc11/adj-brset.d create mode 100644 ld/testsuite/ld-m68hc11/adj-brset.s create mode 100644 ld/testsuite/ld-m68hc11/adj-jump.d create mode 100644 ld/testsuite/ld-m68hc11/adj-jump.s create mode 100644 ld/testsuite/ld-m68hc11/bug-1403.d create mode 100644 ld/testsuite/ld-m68hc11/bug-1403.s create mode 100644 ld/testsuite/ld-m68hc11/m68hc11.exp create mode 100644 ld/testsuite/ld-m68hc11/relax-direct.d create mode 100644 ld/testsuite/ld-m68hc11/relax-direct.s create mode 100644 ld/testsuite/ld-m68hc11/relax-group.d create mode 100644 ld/testsuite/ld-m68hc11/relax-group.s diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 734244f768..3ad8d0fb98 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2002-10-14 Stephane Carrez + + * ld-m68hc11/m68hc11.exp: Specific tests for 68HC11/68HC12. + * ld-m68hc11/adj-jump.d: New test for linker relaxation. + * ld-m68hc11/adj-jump.s: Likewise. + * ld-m68hc11/adj-brset.s: Likewise. + * ld-m68hc11/adj-brset.d: Likewise. + * ld-m68hc11/relax-direct.s: Likewise. + * ld-m68hc11/relax-direct.d: Likewise. + * ld-m68hc11/relax-group.s: Likewise. + * ld-m68hc11/relax-group.d: Likewise. + * ld-m68hc11/bug-1403.d: Likewise. + * ld-m68hc11/bug-1403.s: Likewise. + 2002-10-14 Stephen Clarke * ld-sh/ld-r-1.d: Disable for sh64*-*-linux*. * ld-sh/sh64/sh64.exp: Likewise. diff --git a/ld/testsuite/ld-m68hc11/adj-brset.d b/ld/testsuite/ld-m68hc11/adj-brset.d new file mode 100644 index 0000000000..f1788f7fec --- /dev/null +++ b/ld/testsuite/ld-m68hc11/adj-brset.d @@ -0,0 +1,32 @@ +#source: adj-brset.s +#as: -m68hc11 +#ld: --relax +#objdump: -d --prefix-addresses -r +#target: m6811-*-* m6812-*-* + +.*: +file format elf32\-m68hc11 + +Disassembly of section .text: +0+8000 <_start> brclr 140,x \#\$c8 0+804a +0+8004 addd \*0+4 <_toto> +0+8006 brclr 20,x \#\$03 0+8004 +0+800a brclr 90,x \#\$63 0+801a +0+800e addd \*0+4 <_toto> +0+8010 brclr 19,y \#\$04 0+800e +0+8015 brclr 91,y \#\$62 0+8024 +0+801a addd \*0+4 <_toto> +0+801c brset 18,x \#\$05 0+801a +0+8020 brset 92,x \#\$61 0+8030 +0+8024 addd \*0+4 <_toto> +0+8026 brset 17,y \#\$06 0+8024 +0+802b brset 93,y \#\$60 0+8030 +0+8030 addd \*0+4 <_toto> +0+8032 brset \*0+32 <_table> \#\$07 0+8030 +0+8036 brset \*0+3c <_table\+0xa> \#\$5f 0+8044 +0+803a addd \*0+4 <_toto> +0+803c brclr \*0+33 <_table\+0x1> \#\$08 0+803a +0+8040 brset \*0+3d <_table\+0xb> \#\$5e 0+804a +0+8044 addd \*0+4 <_toto> +0+8046 brclr \*0+33 <_table\+0x1> \#\$08 0+803a +0+804a brclr 140,x \#\$c8 0+8000 <_start> +0+804e rts diff --git a/ld/testsuite/ld-m68hc11/adj-brset.s b/ld/testsuite/ld-m68hc11/adj-brset.s new file mode 100644 index 0000000000..1aaff41cb9 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/adj-brset.s @@ -0,0 +1,51 @@ +;;; Test 68HC11 linker relaxation and fixup of brclr/brset branches +;;; + .sect .text + .globl _start +_start: +start: + brclr 140,x#200,L8 ; Branch adjustment covers the whole test +;;; The 'addd' is relaxed and we win 1 byte. The next brclr/brset +;;; branch must be fixed and reduced by 1. We check for different +;;; addressing modes because the instruction has different opcode and +;;; different lengths. +L1: + addd _toto + brclr 20,x,#3,L1 + brclr 90,x,#99,L3 ; Likewise with forward branch +L2: + addd _toto + brclr 19,y,#4,L2 + brclr 91,y,#98,L4 +L3: + addd _toto + brset 18,x,#5,L3 + brset 92,x,#97,L5 +L4: + addd _toto + brset 17,y,#6,L4 + brset 93,y,#96,L5 +L5: + addd _toto + brset *_table,#7,L5 + brset *_table+10,#95,L7 +L6: + addd _toto + brclr *_table+1,#8,L6 + brset *_table+11,#94,L8 +L7: + addd _toto + brclr *_table+1,#8,L6 +L8: + brclr 140,x#200,_start ; Branch adjustment covers the whole test + rts + + .sect .page0 +_bar: + .long 0 +_toto: + .long 0 + .skip 32 +stack: + .skip 10 +_table: diff --git a/ld/testsuite/ld-m68hc11/adj-jump.d b/ld/testsuite/ld-m68hc11/adj-jump.d new file mode 100644 index 0000000000..be87524717 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/adj-jump.d @@ -0,0 +1,60 @@ +#source: adj-jump.s +#as: -m68hc11 +#ld: --relax +#objdump: -d --prefix-addresses -r +#target: m6811-*-* m6812-*-* + +.*: +file format elf32\-m68hc11 + +Disassembly of section .text: +0+8000 <_start> bra 0+8074 + ... +0+8016 <_start\+0x16> bra 0+8074 +0+8018 addd 0,x +0+801a bne 0+8018 +0+801c addd \*0+4 <_toto> +0+801e beq 0+8018 +0+8020 addd \*0+5 <_toto\+0x1> +0+8022 bne 0+8018 +0+8024 bgt 0+8018 +0+8026 bge 0+8018 +0+8028 beq 0+8018 +0+802a ble 0+8018 +0+802c blt 0+8018 +0+802e bhi 0+8018 +0+8030 bcc 0+8018 +0+8032 beq 0+8018 +0+8034 bls 0+8018 +0+8036 bcs 0+8018 +0+8038 bcs 0+8018 +0+803a bmi 0+8018 +0+803c bvs 0+8018 +0+803e bcc 0+8018 +0+8040 bpl 0+8018 +0+8042 bvc 0+8018 +0+8044 bne 0+8018 +0+8046 brn 0+8018 +0+8048 bra 0+8018 +0+804a addd \*0+4 <_toto> +0+804c addd \*0+4 <_toto> +0+804e addd \*0+4 <_toto> +0+8050 addd \*0+4 <_toto> +0+8052 addd \*0+4 <_toto> +0+8054 addd \*0+4 <_toto> +0+8056 addd \*0+4 <_toto> +0+8058 addd \*0+4 <_toto> +0+805a addd \*0+4 <_toto> +0+805c addd \*0+4 <_toto> +0+805e addd \*0+4 <_toto> +0+8060 addd \*0+4 <_toto> +0+8062 addd \*0+4 <_toto> +0+8064 addd \*0+4 <_toto> +0+8066 addd \*0+4 <_toto> +0+8068 bra 0+8000 <_start> +0+806a bne 0+8068 +0+806c beq 0+8074 +0+806e addd \*0+4 <_toto> +0+8070 beq 0+8074 +0+8072 addd \*0+4 <_toto> +0+8074 addd \*0+4 <_toto> +0+8076 rts diff --git a/ld/testsuite/ld-m68hc11/adj-jump.s b/ld/testsuite/ld-m68hc11/adj-jump.s new file mode 100644 index 0000000000..99b7258d8d --- /dev/null +++ b/ld/testsuite/ld-m68hc11/adj-jump.s @@ -0,0 +1,74 @@ +;;; Test 68HC11 linker relaxation and fixup of bcc/bra branches +;;; + .sect .text + .globl _start +_start: + ;; Next 'bra' is assembled as a 'jmp'. It is relaxed to 'bra L3' + ;; during a second pass of relax. + bra L3 + .skip 20 + ;; Next 'jmp' must be relaxed to a 'bra' during the first pass. + ;; The branch offset must then be adjusted by consecutive relax. + jmp L3 +L1: + addd 0,x + bne L1 ; Branch not adjusted + addd _toto + beq L1 ; Backward branch, adjust -1 + addd _toto+1 + jbne L1 ; Backward branch, adjust -2 + bgt L1 ; All possible backward branchs, adjust -2 + bge L1 + beq L1 + ble L1 + blt L1 + bhi L1 + bhs L1 + beq L1 + bls L1 + blo L1 + bcs L1 + bmi L1 + bvs L1 + bcc L1 + bpl L1 + bvc L1 + bne L1 + brn L1 + bra L1 + ;; Relax several insn to reduce block by 15 + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto + addd _toto +L2: + jmp _start ; -> relax to bra _start + bne L2 ; Backward branch, adjust -1 + beq L3 ; Forward branch, adjust -2 + addd _toto + beq L3 ; Forward branch, adjust -1 + addd _toto +L3: + addd _toto + rts + + .sect .page0 +_bar: + .long 0 +_toto: + .long 0 + .skip 32 +stack: + .skip 10 +_table: diff --git a/ld/testsuite/ld-m68hc11/bug-1403.d b/ld/testsuite/ld-m68hc11/bug-1403.d new file mode 100644 index 0000000000..c643cd1678 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/bug-1403.d @@ -0,0 +1,12 @@ +#source: bug-1403.s +#as: -m68hc11 +#ld: --relax +#objdump: -d --prefix-addresses -r +#target: m6811-*-* m6812-*-* + +.*: +file format elf32-m68hc11 + +Disassembly of section .text: +0+8000 <_start> bset \*0+ <__bss_size> \#\$04 +0+8003 bra 0+8005 +0+8005 rts diff --git a/ld/testsuite/ld-m68hc11/bug-1403.s b/ld/testsuite/ld-m68hc11/bug-1403.s new file mode 100644 index 0000000000..9c6fc9b46b --- /dev/null +++ b/ld/testsuite/ld-m68hc11/bug-1403.s @@ -0,0 +1,20 @@ +;;; Bug #1403: Branch adjustment to another section not correct when doing linker relaxation +;;; http://savannah.gnu.org/bugs/?func=detailbug&bug_id=1403&group_id=2424 +;;; + .sect .text + .globl _start +_start: + .relax L1 + ldx #table + bset 0,x #4 +L1: + bra toto ; bra is assembled as a jmp and relaxed + + .sect .page0 + .globl table +table: .long 0 + + .sect .text.toto + .globl toto +toto: + rts diff --git a/ld/testsuite/ld-m68hc11/m68hc11.exp b/ld/testsuite/ld-m68hc11/m68hc11.exp new file mode 100644 index 0000000000..0b92e5d118 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/m68hc11.exp @@ -0,0 +1,31 @@ +# Expect script for run_dump_test based ld-m68hc11 tests. +# Copyright 2002 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Adapted from ld-sh/rd-sh.exp + +# Test 68HC11 relaxing. This tests the assembler as well as the linker. + +if { ![istarget m6811-*-*] && ![istarget m6812-*-*] } { + return +} + +set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach shtest $rd_test_list { + # We need to strip the ".d", but can leave the dirname. + verbose [file rootname $shtest] + run_dump_test [file rootname $shtest] +} diff --git a/ld/testsuite/ld-m68hc11/relax-direct.d b/ld/testsuite/ld-m68hc11/relax-direct.d new file mode 100644 index 0000000000..9bd0822a9d --- /dev/null +++ b/ld/testsuite/ld-m68hc11/relax-direct.d @@ -0,0 +1,63 @@ +#source: relax-direct.s +#as: -m68hc11 +#ld: --relax +#objdump: -d --prefix-addresses -r +#target: m6811-*-* m6812-*-* + +.*: +file format elf32-m68hc11 + +Disassembly of section .text: +0+8000 <_start> lds \*0+28 +0+8002 <_start\+0x2> ldd \*0+ <__bss_size> +0+8004 <_start\+0x4> beq 0+800f +0+8006 <_start\+0x6> bne 0+800b <_start\+0xb> +0+8008 <_start\+0x8> jmp 0+8138 +0+800b <_start\+0xb> std \*0+ <__bss_size> +0+800d <_start\+0xd> jsr \*0+ <__bss_size> +0+800f addd \*0+4 <_toto> +0+8011 bne 0+8000 <_start> +0+8013 addd \*0+cc <_table\+0x9a> +0+8015 addd 0+114 <_stack_top\+0x1a> +0+8018 adca \*0+34 <_table\+0x2> +0+801a adcb \*0+35 <_table\+0x3> +0+801c adda \*0+36 <_table\+0x4> +0+801e addb \*0+37 <_table\+0x5> +0+8020 addd \*0+38 <_table\+0x6> +0+8022 anda \*0+39 <_table\+0x7> +0+8024 andb \*0+3a <_table\+0x8> +0+8026 cmpa \*0+3b <_table\+0x9> +0+8028 cmpb \*0+3c <_table\+0xa> +0+802a cpd \*0+3d <_table\+0xb> +0+802d cpx \*0+3e <_table\+0xc> +0+802f cpy \*0+3f <_table\+0xd> +0+8032 eora \*0+40 <_table\+0xe> +0+8034 eorb \*0+41 <_table\+0xf> +0+8036 jsr \*0+42 <_table\+0x10> +0+8038 ldaa \*0+43 <_table\+0x11> +0+803a ldab \*0+44 <_table\+0x12> +0+803c ldd \*0+45 <_table\+0x13> +0+803e lds \*0+46 <_table\+0x14> +0+8040 ldx \*0+47 <_table\+0x15> +0+8042 ldy \*0+48 <_table\+0x16> +0+8045 oraa \*0+49 <_table\+0x17> +0+8047 orab \*0+4a <_table\+0x18> +0+8049 sbcb \*0+4b <_table\+0x19> +0+804b sbca \*0+4c <_table\+0x1a> +0+804d staa \*0+4d <_table\+0x1b> +0+804f stab \*0+4e <_table\+0x1c> +0+8051 std \*0+4f <_table\+0x1d> +0+8053 sts \*0+50 <_table\+0x1e> +0+8055 stx \*0+51 <_table\+0x1f> +0+8057 sty \*0+52 <_table\+0x20> +0+805a suba \*0+53 <_table\+0x21> +0+805c subb \*0+54 <_table\+0x22> +0+805e subd \*0+55 <_table\+0x23> +0+8060 bne 0+8000 <_start> +0+8062 bra 0+800f +0+8064 rts +0+8065 addd 0+136 <_stack_top\+0x3c> +0+8068 std 0+122 <_stack_top\+0x28> +0+806b tst 0+5 <_toto\+0x1> +0+806e bne 0+8065 + ... +0+8138 jmp 0+8000 <_start> diff --git a/ld/testsuite/ld-m68hc11/relax-direct.s b/ld/testsuite/ld-m68hc11/relax-direct.s new file mode 100644 index 0000000000..f4497726e8 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/relax-direct.s @@ -0,0 +1,84 @@ +;;; Test 68HC11 linker relaxation from extended addressing to direct +;;; addressing modes +;;; + .sect .text + .globl _start +_start: +start: + lds stack + ldd _bar + beq F1 + beq F2 + std _bar + jsr _bar +F1: + addd _toto + bne start + ;; All the following instructions will be relaxed and win 1 byte + ;; for each. + addd _toto+200 + addd stack+256-20 + adca _table+2 + adcb _table+3 + adda _table+4 + addb _table+5 + addd _table+6 + anda _table+7 + andb _table+8 + cmpa _table+9 + cmpb _table+10 + cpd _table+11 + cpx _table+12 + cpy _table+13 + eora _table+14 + eorb _table+15 + jsr _table+16 + ldaa _table+17 + ldab _table+18 + ldd _table+19 + lds _table+20 + ldx _table+21 + ldy _table+22 + oraa _table+23 + orab _table+24 + sbcb _table+25 + sbca _table+26 + staa _table+27 + stab _table+28 + std _table+29 + sts _table+30 + stx _table+31 + sty _table+32 + suba _table+33 + subb _table+34 + subd _table+35 + ;; 'bne' is assembled as far branch and must relax to + ;; a relative 8-bit branch. + bne _start + ;; Likewise for next branch + bra F1 + rts + +;;; The following instructions will not be relaxed +no_relax: + addd _stack_top+60 + std _stack_top+40 + ;; 'tst' does not support direct addressing mode. + tst _toto+1 + bne no_relax + .skip 200 +F2: + bra _start + + .sect .page0 +_bar: + .long 0 +_toto: + .long 0 + .skip 32 +stack: + .skip 10 +_table: + .skip 200 +_stack_top: + diff --git a/ld/testsuite/ld-m68hc11/relax-group.d b/ld/testsuite/ld-m68hc11/relax-group.d new file mode 100644 index 0000000000..baf294b489 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/relax-group.d @@ -0,0 +1,63 @@ +#source: relax-group.s +#as: -m68hc11 +#ld: --relax +#objdump: -d --prefix-addresses -r +#target: m6811-*-* m6812-*-* + +.*: +file format elf32-m68hc11 + +Disassembly of section .text: +0+8000 <_start> bset \*0+ <__bss_size> #\$04 +0+8003 bset \*0+ <__bss_size> #\$04 +0+8006 bset \*0+3 <__bss_size\+0x3> #\$04 +0+8009 bset \*0+4 #\$08 +0+800c bset \*0+3 <__bss_size\+0x3> #\$04 +0+800f bset \*0+4 #\$08 +0+8012 bset \*0+6 #\$04 +0+8015 bset \*0+7 #\$08 +0+8018 bset \*0+8 #\$0c +0+801b bset \*0+9 #\$0c +0+801e bset \*0+a #\$0c +0+8021 bset \*0+b #\$0c +0+8024 bset \*0+6 #\$04 +0+8027 bset \*0+7 #\$08 +0+802a bset \*0+8 #\$0c +0+802d bset \*0+9 #\$0c +0+8030 bset \*0+a #\$0c +0+8033 bset \*0+b #\$0c +0+8036 bra 0+8000 <_start> +0+8038 ldx #0+fe +0+803b bset \*0+fe #\$04 +0+803e bset \*0+ff #\$08 +0+8041 bset 2,x #\$0c +0+8044 bset 3,x #\$0c +0+8047 bset 4,x #\$0c +0+804a bset 5,x #\$0c +0+804d ldy #0+fe +0+8051 bset \*0+fe #\$04 +0+8054 bset \*0+ff #\$08 +0+8057 bset 2,y #\$0c +0+805b bset 3,y #\$0c +0+805f bset 4,y #\$0c +0+8063 bset 5,y #\$0c +0+8067 bclr \*0+a #\$04 +0+806a bclr \*0+b #\$08 +0+806d bclr \*0+1a #\$04 +0+8070 bclr \*0+1b #\$08 +0+8073 brset \*0+8 #\$04 0+8073 +0+8077 brset \*0+8 #\$04 0+8077 +0+807b brset \*0+8 #\$04 0+8094 +0+807f brset \*0+8 #\$04 0+8094 +0+8083 brclr \*0+8 #\$04 0+8083 +0+8087 brclr \*0+8 #\$04 0+8087 +0+808b brclr \*0+8 #\$04 0+8094 +0+808f brclr \*0+8 #\$04 0+8094 +0+8093 nop +0+8094 bset 0,x #\$04 +0+8097 ldx #0+ <__bss_size> +0+809a ldy #0+8 +0+809e rts +0+809f ldx #0+ <__bss_size> +0+80a2 bset 0,x #\$05 +0+80a5 jmp 0+8000 <_start> +0+80a8 rts diff --git a/ld/testsuite/ld-m68hc11/relax-group.s b/ld/testsuite/ld-m68hc11/relax-group.s new file mode 100644 index 0000000000..41c55f5118 --- /dev/null +++ b/ld/testsuite/ld-m68hc11/relax-group.s @@ -0,0 +1,161 @@ +;;; Test 68HC11 linker relaxation (group relax) +;;; + .sect .text + .globl _start +_start: +;;; +;;; The following group of instructions are adjusted. +;;; + .relax L1x + ldx #table + bset 0,x #4 +L1x: + .relax L1y + ldy #table + bset 0,y #4 +L1y: + .relax L2x + ldx #table+3 + bset 0,x #4 + bset 1,x #8 +L2x: + .relax L2y + ldy #table+3 + bset 0,y #4 + bset 1,y #8 +L2y: + .relax L3x + ldx #table+6 + bset 0,x #4 + bset 1,x #8 + bset 2,x #12 + bset 3,x #12 + bset 4,x #12 + bset 5,x #12 +L3x: + .relax L3y + ldy #table+6 + bset 0,y #4 + bset 1,y #8 + bset 2,y #12 + bset 3,y #12 + bset 4,y #12 + bset 5,y #12 +L3y: + ;; Next branch is always relative. It must be adjusted while + ;; above instructions are relaxed. + bra _start +;;; +;;; This group has the first two bset insn relaxable while the +;;; others are not. The ldx/ldy must not be removed. +;;; + .relax L4x + ldx #table+0xfe + bset 0,x #4 + bset 1,x #8 + bset 2,x #12 + bset 3,x #12 + bset 4,x #12 + bset 5,x #12 +L4x: + .relax L4y + ldy #table+0xfe + bset 0,y #4 + bset 1,y #8 + bset 2,y #12 + bset 3,y #12 + bset 4,y #12 + bset 5,y #12 +L4y: +;;; +;;; Relax group for bclr +;;; + .relax L5x + ldx #table+10 + bclr 0,x #4 + bclr 1,x #8 +L5x: + .relax L5y + ldy #table+16 + bclr 10,y #4 + bclr 11,y #8 +L5y: +;;; +;;; Relax group for brset (with backward branch) +;;; + .relax L6x + ldx #table+8 + brset 0,x #4 L5y +L6x: + .relax L7x + ldy #table+8 + brset 0,y #4 L6x +L7x: +;;; +;;; Relax group for brset (with forward branch) +;;; + .relax L8x + ldx #table+8 + brset 0,x #4 brend +L8x: + .relax L8y + ldy #table+8 + brset 0,y #4 brend +L8y: +;;; +;;; Relax group for brclr (with backward branch) +;;; + .relax L9x + ldx #table+8 + brclr 0,x #4 L8y +L9x: + .relax L9y + ldy #table+8 + brclr 0,y #4 L9x +L9y: +;;; +;;; Relax group for brclr (with forward branch) +;;; + .relax L10x + ldx #table+8 + brclr 0,x #4 brend +L10x: + .relax L10y + ldy #table+8 + brclr 0,y #4 brend +L10y: + nop +brend: +;;; +;;; The following are wrong use of .relax groups. +;;; + .relax w1 +w1: + .relax w2 + bset 0,x #4 +w2: + .relax w3 + ldx #table +w3: + .relax w4 + ldy #table+8 +w4: + .relax w5 + rts +w5: +;;; +;;; Next insn is not in a .relax group + ldx #table + bset 0,x #5 + bra _start + rts + + .sect .page0 + .globl table +table: .long 0 +table4: .long 0 +table8: .long 0 + .skip 10 +end_table: + .long 0 +