This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [ARM] Allow MOV/MOV.W to accept all possible immediates
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Jiong Wang <jiong dot wang at foss dot arm dot com>, Binutils <binutils at sourceware dot org>
- Cc: <nd at arm dot com>
- Date: Thu, 5 Jan 2017 10:45:33 +0000
- Subject: Re: [ARM] Allow MOV/MOV.W to accept all possible immediates
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <27959ba0-3b6f-185d-1c8b-55a28d7e286c@foss.arm.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 01/11/16 12:21, Jiong Wang wrote:
> Hi,
>
> AArch32 MOV Rd, #imm should accept all immediates which can be encoded into
> available encoding, A1/A2 for ARM, T1/T2/T3 for Thumb/Thumb2, and MOV is the
> preferred disassembly syntax. See latest ARM Architecture Reference Manual for
> ARMv8-A, section F6.1.108 and for ARMv8-M, section C2.4.89.
>
> The same for MOV.W under Thumb mode. It should try all possible 32-bit Thumb
> encoding instead of T2 only.
>
> This patch let MOV/MOV.W accept more immediate formats while their currently
> supported immediate formats are not affected, so there is no backward compatibility
> issue, also this patch haven't touched the disassembler.
>
> I think this patch brings GAS closer to ARM Architecture Reference Manual.
>
> OK for master?
>
> gas/
> 2016-11-01 Jiong Wang <jiong.wang@arm.com>
> * config/tc-arm.c (SBIT_SHIFT): New.
> (T2_SBIT_SHIFT): Likewise.
> (t32_insn_ok): Return TRUE for MOV in ARMv8-M Baseline.
> (md_apply_fix): Try UINT16 encoding when ARM/Thumb modified immediate
> encoding failed.
> * testsuite/gas/arm/archv6t2-bad.s: New error case.
> * testsuite/gas/arm/archv6t2-bad.l: New error match.
> * testsuite/gas/arm/archv6t2.s: New testcase.
> * testsuite/gas/arm/archv6t2.d: New expected result.
> * testsuite/gas/arm/archv8m.s: New testcase
> * testsuite/gas/arm/archv8m-base.d: New expected result.
> * testsuite/gas/arm/archv8m-main.d: Likewise.
> * testsuite/gas/arm/archv8m-main-dsp-1.d: Likewise.
this caused
$ cat bug.s
.syntax unified
.text
.arch armv7-a
mov r3,#1
.arch armv4t
.eabi_attribute 6,2
bx lr
$ arm-none-linux-gnueabihf-as -mthumb bug.s
bug.s: Assembler messages:
bug.s:4: Error: invalid constant (1) after fixup
previously this worked, but i'm not sure if the mix
of .arch directives and .syntax unified is valid here.