diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-m68k.c | 56 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/m68k/all.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/m68k/mcf-coproc.d | 50 | ||||
-rw-r--r-- | gas/testsuite/gas/m68k/mcf-coproc.s | 47 |
6 files changed, 162 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index a9b0868..704e6f9 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2007-07-03 Nathan Sidwell <nathan@codesourcery.com> + + * config/tc-m68k.c (m68k_ip): Add j & K operand types. + (install_operand): Add E encoding. + (md_begin): Check and skip initial '.' arg character. + (get_num): Add 0..511 case. + 2007-07-03 Alan Modra <amodra@bigpond.net.au> PR 4713 diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index a2c356b..32c9853 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -1965,6 +1965,22 @@ m68k_ip (char *instring) losing++; break; + case 'j': + if (opP->mode != IMMED) + losing++; + else if (opP->disp.exp.X_op != O_constant + || TRUNC (opP->disp.exp.X_add_number) - 1 > 7) + losing++; + break; + + case 'K': + if (opP->mode != IMMED) + losing++; + else if (opP->disp.exp.X_op != O_constant + || TRUNC (opP->disp.exp.X_add_number) > 511) + losing++; + break; + /* JF these are out of order. We could put them in order if we were willing to put up with bunches of #ifdef m68851s in the code. @@ -3482,6 +3498,14 @@ m68k_ip (char *instring) tmpreg = 0; install_operand (s[1], tmpreg); break; + case 'j': + tmpreg = get_num (&opP->disp, 10); + install_operand (s[1], tmpreg - 1); + break; + case 'K': + tmpreg = get_num (&opP->disp, 65); + install_operand (s[1], tmpreg); + break; default: abort (); } @@ -3550,6 +3574,9 @@ install_operand (int mode, int val) case 'd': the_ins.opcode[0] |= val << 9; break; + case 'E': + the_ins.opcode[1] |= val << 9; + break; case '1': the_ins.opcode[1] |= val << 12; break; @@ -4362,14 +4389,28 @@ md_begin (void) { ins = m68k_sorted_opcodes[i]; - /* We *could* ignore insns that don't match our - arch here by just leaving them out of the hash. */ + /* We must enter all insns into the table, because .arch and + .cpu directives can change things. */ slak->m_operands = ins->args; - slak->m_opnum = strlen (slak->m_operands) / 2; slak->m_arch = ins->arch; slak->m_opcode = ins->opcode; - /* This is kludgey. */ - slak->m_codenum = ((ins->match) & 0xffffL) ? 2 : 1; + + /* In most cases we can determine the number of opcode words + by checking the second word of the mask. Unfortunately + some instructions have 2 opcode words, but no fixed bits + in the second word. A leading dot in the operands + string also indicates 2 opcodes. */ + if (*slak->m_operands == '.') + { + slak->m_operands++; + slak->m_codenum = 2; + } + else if (ins->match & 0xffffL) + slak->m_codenum = 2; + else + slak->m_codenum = 1; + slak->m_opnum = strlen (slak->m_operands) / 2; + if (i + 1 != m68k_numopcodes && !strcmp (ins->name, m68k_sorted_opcodes[i + 1]->name)) { @@ -5229,6 +5270,7 @@ md_create_long_jump (char *ptr, addressT from_addr, addressT to_addr, 50: absolute 0:127 only 55: absolute -64:63 only 60: absolute -128:127 only + 65: absolute 0:511 only 70: absolute 0:4095 only 80: absolute -1, 1:7 only 90: No bignums. */ @@ -5284,6 +5326,10 @@ get_num (struct m68k_exp *exp, int ok) if ((valueT) SEXT (offs (exp)) + 128 > 255) goto outrange; break; + case 65: + if ((valueT) TRUNC (offs (exp)) > 511) + goto outrange; + break; case 70: if ((valueT) TRUNC (offs (exp)) > 4095) { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 4eea75c..f6e6691d 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-07-03 Nathan Sidwell <nathan@codesourcery.com> + + * gas/m68k/mcf-coproc.d: New. + * gas/m68k/mcf-coproc.s: New. + * gas/m68k/all.exp: Add it. + 2007-06-29 M R Swami Reddy <MR.Swami.Reddy@nsc.com> * gas/cr16: New directory diff --git a/gas/testsuite/gas/m68k/all.exp b/gas/testsuite/gas/m68k/all.exp index d4c0cdc..ae9f993 100644 --- a/gas/testsuite/gas/m68k/all.exp +++ b/gas/testsuite/gas/m68k/all.exp @@ -52,6 +52,7 @@ if { [istarget m68*-*-*] || [istarget fido*-*-*] } then { run_dump_test mode5 run_dump_test mcf-mac run_dump_test mcf-emac + run_dump_test mcf-coproc run_dump_test mcf-fpu run_dump_test mcf-trap run_dump_test mcf-wdebug diff --git a/gas/testsuite/gas/m68k/mcf-coproc.d b/gas/testsuite/gas/m68k/mcf-coproc.d new file mode 100644 index 0000000..86401cb --- /dev/null +++ b/gas/testsuite/gas/m68k/mcf-coproc.d @@ -0,0 +1,50 @@ +#objdump: -d +#as: -mcpu=5475 + +.*: file format .* + +Disassembly of section .text: + +0+ <start>: +[ 0-9a-f]+: fcc0 0050 cp0bcbusy [0-9a-f]+ <zero> +[ 0-9a-f]+: fc80 2123 cp0ldl %d0,%d2,#1,#291 +[ 0-9a-f]+: fc88 a201 cp0ldl %a0,%a2,#2,#1 +[ 0-9a-f]+: fc50 a401 cp0ldw %a0@,%a2,#3,#1 +[ 0-9a-f]+: fc18 aa01 cp0ldb %a0@\+,%a2,#6,#1 +[ 0-9a-f]+: fca0 ac01 cp0ldl %a0@-,%a2,#7,#1 +[ 0-9a-f]+: fca8 ae01 0010 cp0ldl %a0@\(16\),%a2,#8,#1 +[ 0-9a-f]+: fd80 2123 cp0stl %d2,%d0,#1,#291 +[ 0-9a-f]+: fd88 a201 cp0stl %a2,%a0,#2,#1 +[ 0-9a-f]+: fd50 a401 cp0stw %a2,%a0@,#3,#1 +[ 0-9a-f]+: fd18 aa01 cp0stb %a2,%a0@\+,#6,#1 +[ 0-9a-f]+: fda0 ac01 cp0stl %a2,%a0@-,#7,#1 +[ 0-9a-f]+: fda8 ae01 0010 cp0stl %a2,%a0@\(16\),#8,#1 +[ 0-9a-f]+: fc00 0e00 cp0nop #8 +[ 0-9a-f]+: fc80 0400 cp0nop #3 +[ 0-9a-f]+: fc80 1400 cp0ldl %d0,%d1,#3,#0 +[ 0-9a-f]+: fc88 0400 cp0ldl %a0,%d0,#3,#0 +[ 0-9a-f]+: fc90 0400 cp0ldl %a0@,%d0,#3,#0 +[ 0-9a-f]+: fca8 0400 0010 cp0ldl %a0@\(16\),%d0,#3,#0 +[ 0-9a-f]+ <zero>: +[ 0-9a-f]+: 4e71 nop +[ 0-9a-f]+: fec0 0050 cp1bcbusy [0-9a-f]+ <one> +[ 0-9a-f]+: fe80 2123 cp1ldl %d0,%d2,#1,#291 +[ 0-9a-f]+: fe88 a201 cp1ldl %a0,%a2,#2,#1 +[ 0-9a-f]+: fe50 a401 cp1ldw %a0@,%a2,#3,#1 +[ 0-9a-f]+: fe18 aa01 cp1ldb %a0@\+,%a2,#6,#1 +[ 0-9a-f]+: fea0 ac01 cp1ldl %a0@-,%a2,#7,#1 +[ 0-9a-f]+: fea8 ae01 0010 cp1ldl %a0@\(16\),%a2,#8,#1 +[ 0-9a-f]+: ff80 2123 cp1stl %d2,%d0,#1,#291 +[ 0-9a-f]+: ff88 a201 cp1stl %a2,%a0,#2,#1 +[ 0-9a-f]+: ff50 a401 cp1stw %a2,%a0@,#3,#1 +[ 0-9a-f]+: ff18 aa01 cp1stb %a2,%a0@\+,#6,#1 +[ 0-9a-f]+: ffa0 ac01 cp1stl %a2,%a0@-,#7,#1 +[ 0-9a-f]+: ffa8 ae01 0010 cp1stl %a2,%a0@\(16\),#8,#1 +[ 0-9a-f]+: fe00 0e00 cp1nop #8 +[ 0-9a-f]+: fe80 0400 cp1nop #3 +[ 0-9a-f]+: fe80 1400 cp1ldl %d0,%d1,#3,#0 +[ 0-9a-f]+: fe88 0400 cp1ldl %a0,%d0,#3,#0 +[ 0-9a-f]+: fe90 0400 cp1ldl %a0@,%d0,#3,#0 +[ 0-9a-f]+: fea8 0400 0010 cp1ldl %a0@\(16\),%d0,#3,#0 +[ 0-9a-f]+ <one>: +[ 0-9a-f]+: 4e71 nop diff --git a/gas/testsuite/gas/m68k/mcf-coproc.s b/gas/testsuite/gas/m68k/mcf-coproc.s new file mode 100644 index 0000000..6173d6ac --- /dev/null +++ b/gas/testsuite/gas/m68k/mcf-coproc.s @@ -0,0 +1,47 @@ + +start: + cp0bcbusy zero + cp0ld %d0,%d2,#1,#0x123 + cp0ldl %a0,%a2,#2,#0x1 + cp0ldw (%a0),%a2,#3,#0x1 + cp0ldb (%a0)+,%a2,#6,#0x1 + cp0ldl -(%a0),%a2,#7,#0x1 + cp0ldl 16(%a0),%a2,#8,#0x1 + + cp0st %d2,%d0,#1,#0x123 + cp0stl %a2,%a0,#2,#0x1 + cp0stw %a2,(%a0),#3,#0x1 + cp0stb %a2,(%a0)+,#6,#0x1 + cp0stl %a2,-(%a0),#7,#0x1 + cp0stl %a2,16(%a0),#8,#0x1 + + cp0nop #8 + cp0ld %d0,%d0,#3,#0 + cp0ld %d0,%d1,#3,#0 + cp0ld %a0,%d0,#3,#0 + cp0ld (%a0),%d0,#3,#0 + cp0ld 16(%a0),%d0,#3,#0 +zero: nop + + cp1bcbusy one + cp1ld %d0,%d2,#1,#0x123 + cp1ldl %a0,%a2,#2,#0x1 + cp1ldw (%a0),%a2,#3,#0x1 + cp1ldb (%a0)+,%a2,#6,#0x1 + cp1ldl -(%a0),%a2,#7,#0x1 + cp1ldl 16(%a0),%a2,#8,#0x1 + + cp1st %d2,%d0,#1,#0x123 + cp1stl %a2,%a0,#2,#0x1 + cp1stw %a2,(%a0),#3,#0x1 + cp1stb %a2,(%a0)+,#6,#0x1 + cp1stl %a2,-(%a0),#7,#0x1 + cp1stl %a2,16(%a0),#8,#0x1 + + cp1nop #8 + cp1ld %d0,%d0,#3,#0 + cp1ld %d0,%d1,#3,#0 + cp1ld %a0,%d0,#3,#0 + cp1ld (%a0),%d0,#3,#0 + cp1ld 16(%a0),%d0,#3,#0 +one: nop |