This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP
- From: Thomas Preudhomme <thomas dot preudhomme at foss dot arm dot com>
- To: binutils at sourceware dot org, Richard Earnshaw <richard dot earnshaw at arm dot com>, Nick Clifton <nickc at redhat dot com>, Alan Modra <amodra at gmail dot com>
- Date: Fri, 3 Feb 2017 17:28:10 +0000
- Subject: [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP
- Authentication-results: sourceware.org; auth=none
Hi,
Instruction Set Syntax section in GNU as documentation for ARM says
about the unified syntax that "immediate operands do not require a #
prefix". However, vcmp.f32 s0, 0.0 currently fails to assemble. This is
because the parse_ifimm_zero function is used to parse the immediate and
this function expects an immediate prefix unconditionally.
This patch change the logic to only fail in the absence of a prefix if
not in unified syntax and only skip the prefix if one was found.
ChangeLog entry is as follows:
*** gas/ChangeLog ***
2017-02-02 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (parse_ifimm_zero): Make prefix optional in unified
syntax.
* testsuite/gas/arm/vcmp-noprefix-imm.d: New file.
* testsuite/gas/arm/vcmp-noprefix-imm.s: New file.
Testing: after the patch the example assembles fine and the testsuite
shows no regression.
Is this ok for master?
Best regards,
Thomas
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 66b0ca8034ba16ff78d6c40ba8c77af21c067bbb..8d09a2412732da96243e070d3e6d218afd9c8999 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -4972,9 +4972,13 @@ parse_ifimm_zero (char **in)
int error_code;
if (!is_immediate_prefix (**in))
- return FALSE;
-
- ++*in;
+ {
+ /* In unified syntax, all prefixes are optional. */
+ if (!unified_syntax)
+ return FALSE;
+ }
+ else
+ ++*in;
/* Accept #0x0 as a synonym for #0. */
if (strncmp (*in, "0x", 2) == 0)
diff --git a/gas/testsuite/gas/arm/vcmp-noprefix-imm.d b/gas/testsuite/gas/arm/vcmp-noprefix-imm.d
new file mode 100644
index 0000000000000000000000000000000000000000..2e4f6ba787e51d5e2eb625275d20c704c31a60df
--- /dev/null
+++ b/gas/testsuite/gas/arm/vcmp-noprefix-imm.d
@@ -0,0 +1,8 @@
+#name: VCMP immediate without prefix
+#as:
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> eeb5 0a40 vcmp.f32 s0, #0.0
diff --git a/gas/testsuite/gas/arm/vcmp-noprefix-imm.s b/gas/testsuite/gas/arm/vcmp-noprefix-imm.s
new file mode 100644
index 0000000000000000000000000000000000000000..114ddada8288e5bc44f1f8e01588d16224dc4cb9
--- /dev/null
+++ b/gas/testsuite/gas/arm/vcmp-noprefix-imm.s
@@ -0,0 +1,7 @@
+.syntax unified
+.arch armv7e-m
+.fpu fpv5-d16
+.thumb
+.thumb_func
+
+vcmp.f32 s0, 0.0