Update test files to avoid illegal pairings.
+2003-11-25 Asgari Jinia <asgarij@kpitcummins.com>
+
+ * config/tc-h8300.c (md_assemble): Check operands validity for
+ ldm/stm.
+ (get_operand): Check register pair's validity as per technical
+ note TN-H8*-193A/E from Renesas for H8s and for H8Sx manual.
+
2003-11-24 Kazu Hirata <kazu@cs.umass.edu>
* listing.c: Convert to ISO-C.
low = src[2] - '0';
high = src[6] - '0';
- if (high == low)
+ /* Check register pair's validity as per tech note TN-H8*-193A/E
+ from Renesas for H8S and H8SX hardware manual. */
+ if ( !(low == 0 && (high == 1 || high == 2 || high == 3))
+ && !(low == 1 && (high == 2 || high == 3 || high == 4) && SXmode)
+ && !(low == 2 && (high == 3 || ((high == 4 || high == 5) && SXmode)))
+ && !(low == 3 && (high == 4 || high == 5 || high == 6) && SXmode)
+ && !(low == 4 && (high == 5 || high == 6))
+ && !(low == 5 && (high == 6 || high == 7) && SXmode)
+ && !(low == 6 && high == 7 && SXmode))
as_bad (_("Invalid register list for ldm/stm\n"));
- if (high < low)
- as_bad (_("Invalid register list for ldm/stm\n"));
-
- if (high - low > 3)
- as_bad (_("Invalid register list for ldm/stm)\n"));
-
/* Even sicker. We encode two registers into op->reg. One
for the low register to save, the other for the high
register to save; we also set the high bit in op->reg
*op_end = c;
prev_instruction = instruction;
+ /* Now we have operands from instruction.
+ Let's check them out for ldm and stm. */
+ if (OP_KIND (instruction->opcode->how) == O_LDM)
+ {
+ /* The first operand must be @er7+, and the
+ second operand must be a register pair. */
+ if ((operand[0].mode != RSINC)
+ || (operand[0].reg != 7)
+ || ((operand[1].reg & 0x80000000) == 0))
+ as_bad (_("invalid operand in ldm"));
+ }
+ else if (OP_KIND (instruction->opcode->how) == O_STM)
+ {
+ /* The first operand must be a register pair,
+ and the second operand must be @-er7. */
+ if (((operand[0].reg & 0x80000000) == 0)
+ || (operand[1].mode != RDDEC)
+ || (operand[1].reg != 7))
+ as_bad (_("invalid operand in stm"));
+ }
+
size = SN;
if (dot)
{
+2003-11-25 Asgari Jinia <asgarij@kpitcummins.com>
+
+ * gas/h8300/multiples.s : Add instructions for H8s.
+ * gas/h8300/h8300.exp (do_h8300s_multiple) : Add more test
+ conditions for instructions for H8s.
+ * gas/h8300/t01_mov.s: Correct illegal ldm/stm register pairings.
+ * gas/h8300/t01_mov.exp: Update expected results.
+
2003-11-22 Alan Modra <amodra@bigpond.net.au>
* gas/i386/divide.s: New.
-re " +\[0-9\]+ 000c 01106DF0\[^\n\]*\n" { set x [expr $x+1] }
-re " +\[0-9\]+ 0010 01206DF0\[^\n\]*\n" { set x [expr $x+1] }
-re " +\[0-9\]+ 0014 01306DF0\[^\n\]*\n" { set x [expr $x+1] }
+ -re " +\[0-9\]+ 0018 01106D73\[^\n\]*\n" { set x [expr $x+1] }
+ -re " +\[0-9\]+ 001c 01106DF2\[^\n\]*\n" { set x [expr $x+1] }
+ -re " +\[0-9\]+ 0020 01106D75\[^\n\]*\n" { set x [expr $x+1] }
+ -re " +\[0-9\]+ 0024 01206D76\[^\n\]*\n" { set x [expr $x+1] }
+ -re " +\[0-9\]+ 0028 01106DF4\[^\n\]*\n" { set x [expr $x+1] }
+ -re " +\[0-9\]+ 002c 01206DF4\[^\n\]*\n" { set x [expr $x+1] }
+
eof { break }
}
}
gas_finish
# Did we find what we were looking for? If not, flunk it.
- if [expr $x == 6] then { pass $testname } else { fail $testname }
+ if [expr $x == 12] then { pass $testname } else { fail $testname }
}
proc do_h8300h_mov32bug {} {
stm.l er0-er1,@-sp
stm.l er0-er2,@-sp
stm.l er0-er3,@-sp
+ ldm.l @sp+,er2-er3
+ stm.l er2-er3,@-sp
+ ldm.l @sp+,er4-er5
+ ldm.l @sp+,er4-er6
+ stm.l er4-er5,@-sp
+ stm.l er4-er6,@-sp
+
set x 0
expect {
- -re ".* 7 0000 F312" { set x [expr $x+1]; exp_continue; }
+ -re ".* 7 0000 F312" { set x [expr $x+1]; exp_continue; }
-re ".* 8 0002 017D0312" { set x [expr $x+1]; exp_continue; }
-re ".* 9 0006 017D1312" { set x [expr $x+1]; exp_continue; }
-re ".* 10 000a 017DB312" { set x [expr $x+1]; exp_continue; }
-re ".* 12 0012 017DA312" { set x [expr $x+1]; exp_continue; }
-re ".* 13 0016 017D9312" { set x [expr $x+1]; exp_continue; }
-re ".* 14 001a 017DC312" { set x [expr $x+1]; exp_continue; }
- -re ".* 14 1234" { set x [expr $x+1]; exp_continue; }
+ -re ".* 14 1234" { set x [expr $x+1]; exp_continue; }
-re ".* 15 0020 017DCB12" { set x [expr $x+1]; exp_continue; }
-re ".* 15 12345678" { set x [expr $x+1]; exp_continue; }
-re ".* 16 0028 017DD312" { set x [expr $x+1]; exp_continue; }
- -re ".* 16 1234" { set x [expr $x+1]; exp_continue; }
+ -re ".* 16 1234" { set x [expr $x+1]; exp_continue; }
-re ".* 17 002e 017DE312" { set x [expr $x+1]; exp_continue; }
- -re ".* 17 1234" { set x [expr $x+1]; exp_continue; }
+ -re ".* 17 1234" { set x [expr $x+1]; exp_continue; }
-re ".* 18 0034 017DF312" { set x [expr $x+1]; exp_continue; }
- -re ".* 18 1234" { set x [expr $x+1]; exp_continue; }
+ -re ".* 18 1234" { set x [expr $x+1]; exp_continue; }
-re ".* 19 003a 017DDB12" { set x [expr $x+1]; exp_continue; }
-re ".* 19 12345678" { set x [expr $x+1]; exp_continue; }
-re ".* 20 0042 017DEB12" { set x [expr $x+1]; exp_continue; }
-re ".* 21 004a 017DFB12" { set x [expr $x+1]; exp_continue; }
-re ".* 21 12345678" { set x [expr $x+1]; exp_continue; }
-re ".* 22 0052 017D4012" { set x [expr $x+1]; exp_continue; }
- -re ".* 22 1234" { set x [expr $x+1]; exp_continue; }
+ -re ".* 22 1234" { set x [expr $x+1]; exp_continue; }
-re ".* 23 0058 017D4812" { set x [expr $x+1]; exp_continue; }
-re ".* 23 12345678" { set x [expr $x+1]; exp_continue; }
-re ".* 24 " {
-re ".* 1067 1c60 01306D74" { set x [expr $x+1]; exp_continue; }
-re ".* 1068 1c64 01306D75" { set x [expr $x+1]; exp_continue; }
-re ".* 1069 1c68 01306D76" { set x [expr $x+1]; exp_continue; }
- -re ".* 1070 1c6c 01306D77" { set x [expr $x+1]; exp_continue; }
+ -re ".* 1070 1c6c 01206D77" { set x [expr $x+1]; exp_continue; }
-re ".* 1071 " {
if [expr $x == 5] then {
pass "$testname: ldm @sp+,(er0-er3)"
-re ".* 1088 1ca8 01306DF1" { set x [expr $x+1]; exp_continue; }
-re ".* 1089 1cac 01306DF2" { set x [expr $x+1]; exp_continue; }
-re ".* 1090 1cb0 01306DF3" { set x [expr $x+1]; exp_continue; }
- -re ".* 1091 1cb4 01306DF4" { set x [expr $x+1]; exp_continue; }
+ -re ".* 1091 1cb4 01206DF5" { set x [expr $x+1]; exp_continue; }
-re ".* 1092 " {
if [expr $x == 5] then {
pass "$testname: stm (er0-er3),@-sp"
ldm @sp+,(er1-er4) ;01306d74\r
ldm @sp+,(er2-er5) ;01306d75\r
ldm @sp+,(er3-er6) ;01306d76\r
- ldm @sp+,(er4-er7) ;01306d77\r
+ ldm @sp+,(er5-er7) ;01206d77\r
\r
stm (er0-er1),@-sp ;01106df0\r
stm (er1-er2),@-sp ;01106df1\r
stm (er1-er4),@-sp ;01306df1\r
stm (er2-er5),@-sp ;01306df2\r
stm (er3-er6),@-sp ;01306df3\r
- stm (er4-er7),@-sp ;01306df4\r
+ stm (er5-er7),@-sp ;01206df5\r
\r
eepmov.b ;7b5c598f\r
\r