2005-09-02 Paul Brook <paul@codesourcery.com>
+ * config/tc-arm.c (do_rn_rd): Enforce SWP operand constraints.
+
+2005-09-02 Paul Brook <paul@codesourcery.com>
+
* config/tc-arm.c (encode_arm_cp_address): Use
BFD_RELOC_ARM_T32_CP_OFF_IMM in thumb mode.
(do_iwmmxt_wldstbh): Use BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 in thumb
static void
do_rd_rm_rn (void)
{
+ unsigned Rn = inst.operands[2].reg;
+ /* Enforce resutrictions on SWP instruction. */
+ if ((inst.instruction & 0x0fbfffff) == 0x01000090)
+ constraint (Rn == inst.operands[0].reg || Rn == inst.operands[1].reg,
+ _("Rn must not overlap other operands"));
inst.instruction |= inst.operands[0].reg << 12;
inst.instruction |= inst.operands[1].reg;
- inst.instruction |= inst.operands[2].reg << 16;
+ inst.instruction |= Rn << 16;
}
static void
2005-09-02 Paul Brook <paul@codesourcery.com>
+ * gas/arm/arm3-bad.s: New test.
+ * gas/arm/arm3-bad.d: New test.
+ * gas/arm/arm3.s: Avoid illegal instructions.
+ * gas/arm/arm3.d: Ditto.
+
+2005-09-02 Paul Brook <paul@codesourcery.com>
+
* gas/arm/vfp-bad_t2.d, gas/arm/vfp-bad_t2.l, arm/vfp-bad_t2.s,
gas/arm/vfp1_t2.d, gas/arm/vfp1_t2.s, gas/arm/vfp1xD_t2.d,
gas/arm/vfp1xD_t2.s, gas/arm/vfp2_t2.d, gas/arm/vfp2_t2.s): New files.
--- /dev/null
+# name: ARM 3 errors
+# as: -mcpu=arm3
+# error-output: arm3-bad.l
--- /dev/null
+.*arm3-bad.s: Assembler messages:
+.*arm3-bad.s:4: Error: Rn must not overlap other operands -- `swp r0,r1,\[r0\]'
+.*arm3-bad.s:5: Error: Rn must not overlap other operands -- `swp r1,r0,\[r0\]'
--- /dev/null
+ .text
+ .align 0
+l:
+ swp r0, r1, [r0]
+ swp r1, r0, [r0]
+ nop
+ nop
Disassembly of section .text:
0+0 <[^>]*> e1080091 ? swp r0, r1, \[r8\]
-0+4 <[^>]*> e1432093 ? swpb r2, r3, \[r3\]
-0+8 <[^>]*> a1444091 ? swpgeb r4, r1, \[r4\]
+0+4 <[^>]*> e1423093 ? swpb r3, r3, \[r2\]
+0+8 <[^>]*> a1454091 ? swpgeb r4, r1, \[r5\]
0+c <[^>]*> e1a00000 ? nop \(mov r0,r0\)
.align 0
l:
swp r0, r1, [r8]
- swpb r2, r3, [r3]
- swpgeb r4, r1, [r4]
+ swpb r3, r3, [r2]
+ swpgeb r4, r1, [r5]
nop