From: Stephane Carrez Date: Sun, 1 Dec 2002 14:32:48 +0000 (+0000) Subject: * gas/m68hc11/m68hc11.exp: Rename from all.exp; run the new tests. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27bdea3da4e21f3779950e8bf2d7e15e106af694;p=binutils-gdb.git * gas/m68hc11/m68hc11.exp: Rename from all.exp; run the new tests. * gas/m68hc11/all.exp: Remove. * gas/m68hc11/indexed12.d: New test. * gas/m68hc11/indexed12.s: Likewise. * gas/m68hc11/bug-1825.d: Likewise. * gas/m68hc11/bug-1825.s: Likewise. --- diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 44ce6716600..95c9be94f22 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2002-12-01 Stephane Carrez + + * gas/m68hc11/m68hc11.exp: Rename from all.exp; run the new tests. + * gas/m68hc11/all.exp: Remove. + * gas/m68hc11/indexed12.d: New test. + * gas/m68hc11/indexed12.s: Likewise. + * gas/m68hc11/bug-1825.d: Likewise. + * gas/m68hc11/bug-1825.s: Likewise. + 2002-12-01 Stephane Carrez * gas/m68hc11/insns.s: Don't use .comm for stack symbol so that objdump diff --git a/gas/testsuite/gas/m68hc11/all.exp b/gas/testsuite/gas/m68hc11/all.exp deleted file mode 100644 index a31ec91715f..00000000000 --- a/gas/testsuite/gas/m68hc11/all.exp +++ /dev/null @@ -1,26 +0,0 @@ -# -# Some generic m68HC11 tests -# -if ![istarget "m68hc11-*-*"] then { - if ![istarget "m6811-*-*"] then { - if ![istarget "m68hc12-*-*"] then { - if ![istarget "m6812-*-*"] then { - return - } - } - } -} -run_dump_test insns -run_dump_test lbranch -run_dump_test all_insns -run_dump_test insns-dwarf2 -run_dump_test lbranch-dwarf2 - -# Compliance with Motorola Assembly Language Input Standard -run_dump_test malis - -# Some 68HC12 tests -run_dump_test opers12 -run_dump_test opers12-dwarf2 -run_dump_test branchs12 -run_dump_test insns12 diff --git a/gas/testsuite/gas/m68hc11/bug-1825.d b/gas/testsuite/gas/m68hc11/bug-1825.d new file mode 100644 index 00000000000..e9c5c7529cf --- /dev/null +++ b/gas/testsuite/gas/m68hc11/bug-1825.d @@ -0,0 +1,112 @@ +#objdump: -S -r +#as: -m68hc12 -gdwarf2 +#name: 68HC12 PC-relative addressing modes (bug-1825) + +.*: file format elf32\-m68hc12 + +Disassembly of section \.text: + +0+ <_main>: +;;; + \.sect \.text + \.globl _main +_main: + nop + 0: a7 nop + ldx L1,pc ; Assemble to 5-bit > 0 offset + 1: ee c2 ldx 2,PC \{5 \} + bra L2 + 3: 20 02 bra 7 + 3: R_M68HC12_RL_JUMP \*ABS\* + +0+5 : + 5: aa bb oraa 5,SP\- + +0+7 : +L1: + .dc.w 0xaabb +L2: + subd L1,pc ; Assemble to 5-bit < 0 offset + 7: a3 dc subd \-4,PC \{5 \} + +0+9 : + 9: a7 nop + a: a7 nop + b: a7 nop + c: a7 nop + d: a7 nop + e: a7 nop + f: a7 nop + 10: a7 nop + 11: a7 nop + 12: a7 nop + 13: a7 nop + 14: a7 nop + 15: a7 nop + 16: a7 nop +L3: + .ds.b 14, 0xA7 + ldab L3,pc ; 5-bit < 0 offset + 17: e6 d0 ldab \-16,PC \{9 \} + ldab L4,pc ; 5-bit > 0 offset + 19: e6 f8 20 ldab 32,PC \{3b \} # SCz: FIXME this is wrong + ... + +0+3b : + ... + .skip 31 +L4: + .skip 128 + subd L4,pc ; 9-bit < 0 offset + bb: a3 f9 7e subd \-130,PC \{3b \} + addd L5,pc ; 9-bit > 0 offset + be: e3 f8 81 addd 129,PC \{141 \} # SCz: FIXME + ... + +0+141 : + ... + 23d: 00 bgnd + 23e: 00 bgnd + .skip 128 +L5: + .skip 256-2 + orab L5,pc ; 9 bit < 0 offset (min value) + 23f: ea f9 00 orab -256,PC \{141 \} + oraa L6,pc ; 9 bit > 0 offset (max value) + 242: aa fa 00 ff oraa 255,PC \{343 \} # SCz: FIXME + ... + +0+345 : + .skip 255 +L6: + anda _main,pc ; 16 bit < 0 offset + 345: a4 fa fc b7 anda -841,PC \{fffffffe <\.L0\+0xfffffb8c>\} # SCz: FIXME + andb L7,pc + 349: e4 fa 01 00 andb 256,PC \{44b \} # SCz: FIXME + ... + +0+44d : + .skip 256 +L7: + stab external,pc ; External 16\-bit PCREL + 44d: 6b fa 00 00 stab 0,PC \{44f \} + 44f: R_M68HC12_16 external # SCz: FIXME + ldd _table,pc + 451: ec cf ldd 15,PC \{462 <_table>\} + addd _table\+2,pc + 453: e3 cf addd 15,PC \{464 <_table\+0x2>\} + subd _table\+4,pc + 455: a3 cf subd 15,PC \{466 <_table\+0x4>\} + addd _table\+8,pc + 457: e3 f8 11 addd 17,PC \{46a <_table\+0x8>\} + addd _table\+12,pc + 45a: e3 f8 12 addd 18,PC \{46e <_table\+0xc>\} + addd _table\+16,pc + 45d: e3 f8 13 addd 19,PC \{472 <.L0>\} + rts + 460: 3d rts + nop + 461: a7 nop + +0+462 <_table>: + \.\.\. diff --git a/gas/testsuite/gas/m68hc11/bug-1825.s b/gas/testsuite/gas/m68hc11/bug-1825.s new file mode 100644 index 00000000000..4854eaca0c7 --- /dev/null +++ b/gas/testsuite/gas/m68hc11/bug-1825.s @@ -0,0 +1,44 @@ +;;; Bug #1825: gas assemble PC-relative indexed addressing modes incorrectly +;;; http://savannah.gnu.org/bugs/?func=detailbug&bug_id=1825&group_id=2424 +;;; + .sect .text + .globl _main +_main: + nop + ldx L1,pc ; Assemble to 5-bit > 0 offset + bra L2 +L1: + .dc.w 0xaabb +L2: + subd L1,pc ; Assemble to 5-bit < 0 offset +L3: + .ds.b 14, 0xA7 + ldab L3,pc ; 5-bit < 0 offset + ldab L4,pc ; 5-bit > 0 offset + .skip 31 +L4: + .skip 128 + subd L4,pc ; 9-bit < 0 offset + addd L5,pc ; 9-bit > 0 offset + .skip 128 +L5: + .skip 256-2 + orab L5,pc ; 9 bit < 0 offset (min value) + oraa L6,pc ; 9 bit > 0 offset (max value) + .skip 255 +L6: + anda _main,pc ; 16 bit < 0 offset + andb L7,pc + .skip 256 +L7: + stab external,pc ; External 16-bit PCREL + ldd _table,pc + addd _table+2,pc + subd _table+4,pc + addd _table+8,pc + addd _table+12,pc + addd _table+16,pc + rts + nop +_table: + .ds.b 16,0 diff --git a/gas/testsuite/gas/m68hc11/indexed12.d b/gas/testsuite/gas/m68hc11/indexed12.d new file mode 100644 index 00000000000..6e9e7763734 --- /dev/null +++ b/gas/testsuite/gas/m68hc11/indexed12.d @@ -0,0 +1,206 @@ +#objdump: -S +#as: -m68hc12 -gdwarf2 +#name: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12) +#source: indexed12.s + +.*: +file format elf32\-m68hc12 + +Disassembly of section .text: + +0+ <_main>: +;; + .sect .text + .globl _main +_main: + nop + 0: a7 nop +;;; Global check \(1st\) + ldab L1\-_main,x ; Offset/const of these 2 insns must be + 1: e6 e0 93 ldab 147,X + ldaa #L1\-_main ; identical \(likewise for 2nd global check\) + 4: 86 93 ldaa #147 +;;; Test gas relax with difference of symbols \(same section\) + ldaa L2\-L1,x ; \-> ldaa 2,x \(5\-bit offset\), text seg + 6: a6 02 ldaa 2,X + adda L1\-L2,y ; \-> adda \-2,y \(5\-bit offset\), text seg + 8: ab 5e adda \-2,Y + + orab L7\-L6,sp ; \-> orab 8,sp \(5\-bit offset\), text seg + a: ea 88 orab 8,SP + anda L8\-L7,sp ; \-> anda 15,sp \(5\-bit offset\), text seg + c: a4 8f anda 15,SP + eora L7\-L8,sp ; \-> eora \-15,sp \(5\-bit offset\), text seg + e: a8 91 eora \-15,SP + eorb L7\-L9,sp ; \-> eorb \-16,sp \(5\-bit offset\), text seg + 10: e8 90 eorb \-16,SP + + andb L9\-L7,sp ; \-> andb 16,sp \(9\-bit offset\), text seg + 12: e4 f0 10 andb 16,SP + staa L7\-L10,x ; \-> staa \-17,x \(9\-bit offset\), text seg + 15: 6a e1 ef staa \-17,X + stab L11\-L10,y ; \-> stab 128,y \(9\-bit offset\), text seg + 18: 6b e8 80 stab 128,Y + stab L10\-L11,y ; \-> stab \-128,y \(9\-bit offset\), text seg + 1b: 6b e9 80 stab \-128,Y + stab L11\-L10\+1,y ; \-> stab 129,y \(9\-bit offset\), text seg + 1e: 6b e8 81 stab 129,Y + stab L10\-L11\-1,y ; \-> stab \-129,y \(9\-bit offset\), text seg + 21: 6b e9 7f stab \-129,Y + stab L11\-1\-L10,y ; \-> stab 127,y \(9\-bit offset\), text seg + 24: 6b e8 7f stab 127,Y + stab L10\-1\-L11,y ; \-> stab \-129,y \(9\-bit offset\), text seg + 27: 6b e9 7f stab \-129,Y + + tst L12\-L10,x ; \-> tst 255,x \(9\-bit offset\), text seg + 2a: e7 e0 ff tst 255,X + tst L10\-L12,x ; \-> tst \-255,x \(9\-bit offset\), text seg + 2d: e7 e1 01 tst \-255,X + tst L12\-L10\+1,x ; \-> tst 256,x \(16\-bit offset\), text seg + 30: e7 e2 01 00 tst 256,X + mina L13\-L10,x ; \-> mina 256,x \(16\-bit offset\) + 34: 18 19 e2 01 mina 256,X + 38: 00 + mina L10\-L13,x ; \-> mina \-256,x \(9\-bit offset\) + 39: 18 19 e1 00 mina \-256,X + + maxa L14\-L10,x ; \-> maxa 257,x \(16\-bit offset\) + 3d: 18 18 e2 01 maxa 257,X + 41: 01 + maxa L10\-L14,x ; \-> maxa \-257,x \(16\-bit offset\) + 42: 18 18 e2 fe maxa \-257,X + 46: ff + +;;; Test gas relax with difference of symbols \(different section\) + ldaa D2\-D1,x ; \-> ldaa 2,x \(5\-bit offset\), data seg + 47: a6 02 ldaa 2,X + adda D1\-D2,y ; \-> adda \-2,y \(5\-bit offset\), data seg + 49: ab 5e adda \-2,Y + + orab D7\-D6,sp ; \-> orab 8,sp \(5\-bit offset\), data seg + 4b: ea 88 orab 8,SP + anda D8\-D7,sp ; \-> anda 15,sp \(5\-bit offset\), data seg + 4d: a4 8f anda 15,SP + eora D7\-D8,sp ; \-> eora \-15,sp \(5\-bit offset\), data seg + 4f: a8 91 eora \-15,SP + eorb D7\-D9,sp ; \-> eorb \-16,sp \(5\-bit offset\), data seg + 51: e8 90 eorb \-16,SP + + andb D9\-D7,sp ; \-> andb 16,sp \(9\-bit offset\), data seg + 53: e4 f0 10 andb 16,SP + staa D7\-D10,x ; \-> staa \-17,x \(9\-bit offset\), data seg + 56: 6a e1 ef staa \-17,X + stab D11\-D10,y ; \-> stab 128,y \(9\-bit offset\), data seg + 59: 6b e8 80 stab 128,Y + stab D10\-D11,y ; \-> stab \-128,y \(9\-bit offset\), data seg + 5c: 6b e9 80 stab \-128,Y + stab D11\-D10\+1,y ; \-> stab 129,y \(9\-bit offset\), data seg + 5f: 6b e8 81 stab 129,Y + stab D10\-D11\+1,y ; \-> stab \-127,y \(9\-bit offset\), data seg + 62: 6b e9 81 stab \-127,Y + stab D11\-1\-D10,y ; \-> stab 127,y \(9\-bit offset\), data seg + 65: 6b e8 7f stab 127,Y + stab D10\-1\-D11,y ; \-> stab \-129,y \(9\-bit offset\), data seg + 68: 6b e9 7f stab \-129,Y + + tst D12\-D10,x ; \-> tst 255,x \(9\-bit offset\), data seg + 6b: e7 e0 ff tst 255,X + tst D10\-D12,x ; \-> tst \-255,x \(9\-bit offset\), data seg + 6e: e7 e1 01 tst \-255,X + tst D12\-D10\+1,x ; \-> tst 256,x \(16\-bit offset\), data seg + 71: e7 e2 01 00 tst 256,X + mina D13\-D10,x ; \-> mina 256,x \(16\-bit offset\) + 75: 18 19 e2 01 mina 256,X + 79: 00 + mina D10\-D13,x ; \-> mina \-256,x \(9\-bit offset\) + 7a: 18 19 e1 00 mina \-256,X + + maxa D14\-D10,x ; \-> maxa 257,x \(16\-bit offset\) + 7e: 18 18 e2 01 maxa 257,X + 82: 01 + maxa D10\-D14,x ; \-> maxa \-257,x \(16\-bit offset\) + 83: 18 18 e2 fe maxa \-257,X + 87: ff + +;;; Global check \(2nd\) + ldab L1\-_main,x + 88: e6 e0 93 ldab 147,X + ldaa #L1\-_main + 8b: 86 93 ldaa #147 + +;;; Indexed addressing with external symbol + ldab _external\+128,x + 8d: e6 e2 00 80 ldab 128,X + bra L2 + 91: 20 02 bra 95 + +0+93 : + 93: aa bb oraa 5,SP\- + +0+95 : + 95: a7 nop + 96: a7 nop + 97: a7 nop + 98: a7 nop + 99: a7 nop + 9a: a7 nop + 9b: a7 nop + 9c: a7 nop + +0+9d : + 9d: a7 nop + 9e: a7 nop + 9f: a7 nop + a0: a7 nop + a1: a7 nop + a2: a7 nop + a3: a7 nop + a4: a7 nop + a5: a7 nop + a6: a7 nop + a7: a7 nop + a8: a7 nop + a9: a7 nop + aa: a7 nop + ab: a7 nop + +0+ac : +L1: + .dc.w 0xaabb +L2: +L6: + .ds.b 8, 0xa7 +L7: + .ds.b 15, 0xa7 +L8: + nop + ac: a7 nop + +0+ad : +L9: + nop + ad: a7 nop + +0+ae : + ... + +0+12e : + ... + +0+1ad : +L10: + .skip 128 +L11: + .skip 127 +L12: + nop + 1ad: a7 nop + +0+1ae : +L13: + nop + 1ae: a7 nop + +0+1af : +L14: + rts + 1af: 3d rts diff --git a/gas/testsuite/gas/m68hc11/indexed12.s b/gas/testsuite/gas/m68hc11/indexed12.s new file mode 100644 index 00000000000..7bbbdc88b67 --- /dev/null +++ b/gas/testsuite/gas/m68hc11/indexed12.s @@ -0,0 +1,115 @@ +;; +;; This file verifies the 68HC12 indexed addressing modes +;; with a 5, 9 and 16-bit offset. +;; + .sect .text + .globl _main +_main: + nop +;;; Global check (1st) + ldab L1-_main,x ; Offset/const of these 2 insns must be + ldaa #L1-_main ; identical (likewise for 2nd global check) +;;; Test gas relax with difference of symbols (same section) + ldaa L2-L1,x ; -> ldaa 2,x (5-bit offset), text seg + adda L1-L2,y ; -> adda -2,y (5-bit offset), text seg + + orab L7-L6,sp ; -> orab 8,sp (5-bit offset), text seg + anda L8-L7,sp ; -> anda 15,sp (5-bit offset), text seg + eora L7-L8,sp ; -> eora -15,sp (5-bit offset), text seg + eorb L7-L9,sp ; -> eorb -16,sp (5-bit offset), text seg + + andb L9-L7,sp ; -> andb 16,sp (9-bit offset), text seg + staa L7-L10,x ; -> staa -17,x (9-bit offset), text seg + stab L11-L10,y ; -> stab 128,y (9-bit offset), text seg + stab L10-L11,y ; -> stab -128,y (9-bit offset), text seg + stab L11-L10+1,y ; -> stab 129,y (9-bit offset), text seg + stab L10-L11-1,y ; -> stab -129,y (9-bit offset), text seg + stab L11-1-L10,y ; -> stab 127,y (9-bit offset), text seg + stab L10-1-L11,y ; -> stab -129,y (9-bit offset), text seg + + tst L12-L10,x ; -> tst 255,x (9-bit offset), text seg + tst L10-L12,x ; -> tst -255,x (9-bit offset), text seg + tst L12-L10+1,x ; -> tst 256,x (16-bit offset), text seg + mina L13-L10,x ; -> mina 256,x (16-bit offset) + mina L10-L13,x ; -> mina -256,x (9-bit offset) + + maxa L14-L10,x ; -> maxa 257,x (16-bit offset) + maxa L10-L14,x ; -> maxa -257,x (16-bit offset) + +;;; Test gas relax with difference of symbols (different section) + ldaa D2-D1,x ; -> ldaa 2,x (5-bit offset), data seg + adda D1-D2,y ; -> adda -2,y (5-bit offset), data seg + + orab D7-D6,sp ; -> orab 8,sp (5-bit offset), data seg + anda D8-D7,sp ; -> anda 15,sp (5-bit offset), data seg + eora D7-D8,sp ; -> eora -15,sp (5-bit offset), data seg + eorb D7-D9,sp ; -> eorb -16,sp (5-bit offset), data seg + + andb D9-D7,sp ; -> andb 16,sp (9-bit offset), data seg + staa D7-D10,x ; -> staa -17,x (9-bit offset), data seg + stab D11-D10,y ; -> stab 128,y (9-bit offset), data seg + stab D10-D11,y ; -> stab -128,y (9-bit offset), data seg + stab D11-D10+1,y ; -> stab 129,y (9-bit offset), data seg + stab D10-D11+1,y ; -> stab -127,y (9-bit offset), data seg + stab D11-1-D10,y ; -> stab 127,y (9-bit offset), data seg + stab D10-1-D11,y ; -> stab -129,y (9-bit offset), data seg + + tst D12-D10,x ; -> tst 255,x (9-bit offset), data seg + tst D10-D12,x ; -> tst -255,x (9-bit offset), data seg + tst D12-D10+1,x ; -> tst 256,x (16-bit offset), data seg + mina D13-D10,x ; -> mina 256,x (16-bit offset) + mina D10-D13,x ; -> mina -256,x (9-bit offset) + + maxa D14-D10,x ; -> maxa 257,x (16-bit offset) + maxa D10-D14,x ; -> maxa -257,x (16-bit offset) + +;;; Global check (2nd) + ldab L1-_main,x + ldaa #L1-_main + +;;; Indexed addressing with external symbol + ldab _external+128,x + bra L2 +L1: + .dc.w 0xaabb +L2: +L6: + .ds.b 8, 0xa7 +L7: + .ds.b 15, 0xa7 +L8: + nop +L9: + nop +L10: + .skip 128 +L11: + .skip 127 +L12: + nop +L13: + nop +L14: + rts + + .sect .data +D1: + .dc.w 0xaabb +D2: +D6: + .ds.b 8, 0xa7 +D7: + .ds.b 15, 0xa7 +D8: + nop +D9: + nop +D10: + .skip 128 +D11: + .skip 127 +D12: + nop +D13: + nop +D14: diff --git a/gas/testsuite/gas/m68hc11/m68hc11.exp b/gas/testsuite/gas/m68hc11/m68hc11.exp new file mode 100644 index 00000000000..ea9957c02af --- /dev/null +++ b/gas/testsuite/gas/m68hc11/m68hc11.exp @@ -0,0 +1,28 @@ +# +# Some generic m68HC11 tests +# +if ![istarget "m68hc11-*-*"] then { + if ![istarget "m6811-*-*"] then { + if ![istarget "m68hc12-*-*"] then { + if ![istarget "m6812-*-*"] then { + return + } + } + } +} +run_dump_test insns +run_dump_test lbranch +run_dump_test all_insns +run_dump_test insns-dwarf2 +run_dump_test lbranch-dwarf2 + +# Compliance with Motorola Assembly Language Input Standard +run_dump_test malis + +# Some 68HC12 tests +run_dump_test opers12 +run_dump_test opers12-dwarf2 +run_dump_test branchs12 +run_dump_test insns12 +run_dump_test indexed12 +run_dump_test bug-1825