+2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
+
+ * config/tc-mips.c (match_mips16_insn): Don't update
+ `forced_insn_length' or the instruction opcode if an operand
+ requires an extended instruction form, but an unextended one
+ has been requested.
+ * testsuite/gas/mips/mips16-relax-unextended-1.d: New test.
+ * testsuite/gas/mips/mips16-relax-unextended-2.d: New test.
+ * testsuite/gas/mips/mips16-relax-unextended-1.l: New stderr
+ output.
+ * testsuite/gas/mips/mips16-relax-unextended-2.l: New stderr
+ output.
+ * testsuite/gas/mips/mips16-relax-unextended-1.s: New test
+ source.
+ * testsuite/gas/mips/mips16-relax-unextended-2.s: New test
+ source.
+ * testsuite/gas/mips/mips.exp: Run the new tests.
+
2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
* config/tc-mips.c (mips16_macro_build): Replace `0' and `4'
{
if (required_insn_length == 2)
set_insn_error (0, _("invalid unextended operand value"));
- forced_insn_length = 4;
- insn->insn_opcode |= MIPS16_EXTEND;
+ else
+ {
+ forced_insn_length = 4;
+ insn->insn_opcode |= MIPS16_EXTEND;
+ }
}
else if (relax_char)
*offset_reloc = (int) BFD_RELOC_UNUSED + relax_char;
run_dump_test "mips16-branch-unextended-1"
run_dump_test "mips16-branch-unextended-2"
+ run_dump_test "mips16-relax-unextended-1"
+ run_dump_test "mips16-relax-unextended-2"
run_dump_test "mips16-jal-t"
run_dump_test "mips16-jal-e"
--- /dev/null
+#name: MIPS16 relaxation with unextended instructions forced 1
+#as: -32
+#error-output: mips16-relax-unextended-1.l
--- /dev/null
+.*: Assembler messages:
+.*:6: Error: invalid unextended operand value
+.*:8: Error: invalid unextended operand value
+.*:10: Error: invalid unextended operand value
+.*:13: Error: invalid unextended operand value
+.*:15: Error: invalid unextended operand value `lb\.t \$4,%hi\(baz\)\(\$5\)'
+.*:16: Error: invalid unextended operand value
+.*:23: Error: invalid unextended operand value
+.*:25: Error: invalid unextended operand value `sd\.t \$31,%lo\(baz\)\(\$29\)'
+.*:26: Error: invalid unextended operand value
+.*:28: Error: invalid unextended operand value `sd\.t \$4,%lo\(baz\)\(\$29\)'
+.*:31: Error: invalid unextended operand value
+.*:33: Error: invalid unextended operand value
+.*:35: Error: invalid unextended operand value `lh\.t \$6,%lo\(baz\)\(\$7\)'
+.*:36: Error: invalid unextended operand value
+.*:38: Error: invalid unextended operand value `addiu\.t \$29,%lo\(baz\)'
+.*:39: Error: invalid unextended operand value
+.*:41: Error: invalid unextended operand value `cmpi\.t \$2,%hi\(baz\)'
+.*:42: Error: invalid unextended operand value
+.*:44: Error: invalid unextended operand value `addiu\.t \$3,\$pc,%lo\(baz\)'
+.*:45: Error: invalid unextended operand value
+.*:47: Error: invalid unextended operand value `daddiu\.t \$4,\$pc,%lo\(baz\)'
+.*:49: Error: invalid unextended operand value
+.*:51: Error: invalid unextended operand value `daddiu\.t \$5,%lo\(baz\)'
+.*:52: Error: invalid unextended operand value
+.*:54: Error: invalid unextended operand value `addiu\.t \$2,%lo\(baz\)'
+.*:7: Error: invalid unextended operand value
+.*:9: Error: invalid unextended operand value
+.*:11: Error: invalid unextended operand value
+.*:14: Error: invalid unextended operand value
+.*:17: Error: invalid unextended operand value
+.*:19: Error: invalid unextended operand value
+.*:20: Error: invalid unextended operand value
+.*:21: Error: invalid unextended operand value
+.*:22: Error: invalid unextended operand value
+.*:24: Error: invalid unextended operand value
+.*:27: Error: invalid unextended operand value
+.*:29: Error: invalid unextended operand value
+.*:30: Error: invalid unextended operand value
+.*:32: Error: invalid unextended operand value
+.*:34: Error: invalid unextended operand value
+.*:37: Error: invalid unextended operand value
+.*:40: Error: invalid unextended operand value
+.*:43: Error: invalid unextended operand value
+.*:46: Error: invalid unextended operand value
+.*:50: Error: invalid unextended operand value
+.*:53: Error: invalid unextended operand value
+.*:55: Error: invalid unextended operand value
+.*:56: Error: invalid unextended operand value
--- /dev/null
+ .module mips3
+ .set mips16
+ .set autoextend
+foo:
+ # Operand code:
+ sll.t $2, $3, 17 # <
+ sll.t $2, $3, bar
+ dsll.t $4, $5, 17 # [
+ dsll.t $4, $5, bar
+ dsrl.t $6, 17 # ]
+ dsrl.t $6, bar
+
+ lb.t $4, 0x1234($5) # 5
+ lb.t $4, bar($5)
+ lb.t $4, %hi(baz)($5)
+ slti.t $6, 0x5678 # 8
+ slti.t $6, bar
+
+ la.t $2, . + 0x1234 # A
+ la.t $2, . + bar
+ ld.t $3, . + 0x5678 # B
+ ld.t $3, . + bar
+ sd.t $31, 0x5678($29) # C
+ sd.t $31, bar($29)
+ sd.t $31, %lo(baz)($29)
+ sd.t $4, 0x5678($29) # D
+ sd.t $4, bar($29)
+ sd.t $4, %lo(baz)($29)
+ dla.t $5, . + 0x5678 # E
+ dla.t $5, . + bar
+ daddiu.t $2, $3, 0x5678 # F
+ daddiu.t $2, $3, bar
+ lh.t $6, 0x1234($7) # H
+ lh.t $6, bar($7)
+ lh.t $6, %lo(baz)($7)
+ addiu.t $29, 0x5678 # K
+ addiu.t $29, bar
+ addiu.t $29, %lo(baz)
+ cmpi.t $2, 0x1234 # U
+ cmpi.t $2, bar
+ cmpi.t $2, %hi(baz)
+ addiu.t $3, $pc, 0x5678 # V
+ addiu.t $3, $pc, bar
+ addiu.t $3, $pc, %lo(baz)
+ daddiu.t $4, $pc, 0x5678 # W
+ daddiu.t $4, $pc, bar
+ daddiu.t $4, $pc, %lo(baz)
+
+ daddiu.t $5, 0x5678 # j
+ daddiu.t $5, bar
+ daddiu.t $5, %lo(baz)
+ addiu.t $6, 0x1234 # k
+ addiu.t $6, bar
+ addiu.t $2, %lo(baz)
+ beqz.t $7, . + 0x5678 # p
+ b.t . + 0x1234 # q
+
+ .set bar, 0x5678
--- /dev/null
+#name: MIPS16 relaxation with unextended instructions forced 2
+#as: -32
+#error-output: mips16-relax-unextended-2.l
--- /dev/null
+.*: Assembler messages:
+.*:6: Error: invalid unextended operand value
+.*:8: Error: invalid unextended operand value
+.*:10: Error: invalid unextended operand value
+.*:13: Error: invalid unextended operand value
+.*:15: Error: invalid unextended operand value `lb \$4,%hi\(baz\)\(\$5\)'
+.*:16: Error: invalid unextended operand value
+.*:23: Error: invalid unextended operand value
+.*:25: Error: invalid unextended operand value `sd \$31,%lo\(baz\)\(\$29\)'
+.*:26: Error: invalid unextended operand value
+.*:28: Error: invalid unextended operand value `sd \$4,%lo\(baz\)\(\$29\)'
+.*:31: Error: invalid unextended operand value
+.*:33: Error: invalid unextended operand value
+.*:35: Error: invalid unextended operand value `lh \$6,%lo\(baz\)\(\$7\)'
+.*:36: Error: invalid unextended operand value
+.*:38: Error: invalid unextended operand value `addiu \$29,%lo\(baz\)'
+.*:39: Error: invalid unextended operand value
+.*:41: Error: invalid unextended operand value `cmpi \$2,%hi\(baz\)'
+.*:42: Error: invalid unextended operand value
+.*:44: Error: invalid unextended operand value `addiu \$3,\$pc,%lo\(baz\)'
+.*:45: Error: invalid unextended operand value
+.*:47: Error: invalid unextended operand value `daddiu \$4,\$pc,%lo\(baz\)'
+.*:49: Error: invalid unextended operand value
+.*:51: Error: invalid unextended operand value `daddiu \$5,%lo\(baz\)'
+.*:52: Error: invalid unextended operand value
+.*:54: Error: invalid unextended operand value `addiu \$2,%lo\(baz\)'
+.*:7: Error: invalid unextended operand value
+.*:9: Error: invalid unextended operand value
+.*:11: Error: invalid unextended operand value
+.*:14: Error: invalid unextended operand value
+.*:17: Error: invalid unextended operand value
+.*:19: Error: invalid unextended operand value
+.*:20: Error: invalid unextended operand value
+.*:21: Error: invalid unextended operand value
+.*:22: Error: invalid unextended operand value
+.*:24: Error: invalid unextended operand value
+.*:27: Error: invalid unextended operand value
+.*:29: Error: invalid unextended operand value
+.*:30: Error: invalid unextended operand value
+.*:32: Error: invalid unextended operand value
+.*:34: Error: invalid unextended operand value
+.*:37: Error: invalid unextended operand value
+.*:40: Error: invalid unextended operand value
+.*:43: Error: invalid unextended operand value
+.*:46: Error: invalid unextended operand value
+.*:50: Error: invalid unextended operand value
+.*:53: Error: invalid unextended operand value
+.*:55: Error: invalid unextended operand value
+.*:56: Error: invalid unextended operand value
--- /dev/null
+ .module mips3
+ .set mips16
+ .set noautoextend
+foo:
+ # Operand code:
+ sll $2, $3, 17 # <
+ sll $2, $3, bar
+ dsll $4, $5, 17 # [
+ dsll $4, $5, bar
+ dsrl $6, 17 # ]
+ dsrl $6, bar
+
+ lb $4, 0x1234($5) # 5
+ lb $4, bar($5)
+ lb $4, %hi(baz)($5)
+ slti $6, 0x5678 # 8
+ slti $6, bar
+
+ la $2, . + 0x1234 # A
+ la $2, . + bar
+ ld $3, . + 0x5678 # B
+ ld $3, . + bar
+ sd $31, 0x5678($29) # C
+ sd $31, bar($29)
+ sd $31, %lo(baz)($29)
+ sd $4, 0x5678($29) # D
+ sd $4, bar($29)
+ sd $4, %lo(baz)($29)
+ dla $5, . + 0x5678 # E
+ dla $5, . + bar
+ daddiu $2, $3, 0x5678 # F
+ daddiu $2, $3, bar
+ lh $6, 0x1234($7) # H
+ lh $6, bar($7)
+ lh $6, %lo(baz)($7)
+ addiu $29, 0x5678 # K
+ addiu $29, bar
+ addiu $29, %lo(baz)
+ cmpi $2, 0x1234 # U
+ cmpi $2, bar
+ cmpi $2, %hi(baz)
+ addiu $3, $pc, 0x5678 # V
+ addiu $3, $pc, bar
+ addiu $3, $pc, %lo(baz)
+ daddiu $4, $pc, 0x5678 # W
+ daddiu $4, $pc, bar
+ daddiu $4, $pc, %lo(baz)
+
+ daddiu $5, 0x5678 # j
+ daddiu $5, bar
+ daddiu $5, %lo(baz)
+ addiu $6, 0x1234 # k
+ addiu $6, bar
+ addiu $2, %lo(baz)
+ beqz $7, . + 0x5678 # p
+ b . + 0x1234 # q
+
+ .set bar, 0x5678