[PATCH] ARM: gas not detecting invalid operands for Thumb2 ADD{S} and SUB{S}

Paul Brook paul@codesourcery.com
Fri Mar 11 13:26:00 GMT 2011


> In ARMv6T2 and ARMv7 Thumb2, the ADD, ADDS, SUB, and SUBS instructions
> added several new instruction forms. One of the new forms allowed is:
> 
>     ADD{S}<c>.W <Rd>,SP,<Rm>{,<shift>}
>     SUB{S}<c>.W <Rd>,SP,<Rm>{,<shift>}

The "added new forms" is mainly an artifact of how the new documentation is 
structured.  If you're starting from the ARM instruction set (or from the 
encodings) then it's actually new restrictions on where r13 (aka SP) may be 
used.

The patch looks ok, though I think the testcases could use some 
reorganisation.  I'd prefer two assembly files, one with insns valid in both 
ARM and Thumb mode, the other which is only valid in ARM mode.  Assemble both 
in both modes.  There should already be existing tests
(e.g. sp-pc-usage-t) that cover the former.

> +@ test case of ADD{S} and SUB{S} instructions in ARM mode

Too vague.  You're testing use of SP in these insns.

> +	.file	"s6163c.c"

Looks bogus.

Paul



More information about the Binutils mailing list