public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP
@ 2017-02-03 17:28 Thomas Preudhomme
  2017-02-13 15:04 ` Thomas Preudhomme
  2017-02-13 15:34 ` Nick Clifton
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Preudhomme @ 2017-02-03 17:28 UTC (permalink / raw)
  To: binutils, Richard Earnshaw, Nick Clifton, Alan Modra

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

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

[-- Attachment #2: allow_vcmp_imm_without_prefix_unified_syntax.patch --]
[-- Type: text/x-patch, Size: 1429 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP
  2017-02-03 17:28 [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP Thomas Preudhomme
@ 2017-02-13 15:04 ` Thomas Preudhomme
  2017-02-13 15:34 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Preudhomme @ 2017-02-13 15:04 UTC (permalink / raw)
  To: binutils, Richard Earnshaw, Nick Clifton, Alan Modra

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

Ping?

Best regards,

Thomas

On 03/02/17 17:28, Thomas Preudhomme wrote:
> 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

[-- Attachment #2: allow_vcmp_imm_without_prefix_unified_syntax.patch --]
[-- Type: text/x-patch, Size: 1429 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP
  2017-02-03 17:28 [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP Thomas Preudhomme
  2017-02-13 15:04 ` Thomas Preudhomme
@ 2017-02-13 15:34 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2017-02-13 15:34 UTC (permalink / raw)
  To: Thomas Preudhomme, binutils, Richard Earnshaw, Alan Modra

Hi Thomas,

> 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.

Approved - please apply.  (Sorry for the delay in reviewing).

Cheers
  Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-13 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-03 17:28 [PATCH, GAS/ARM] Allow immediate without prefix in unified syntax for VCMP Thomas Preudhomme
2017-02-13 15:04 ` Thomas Preudhomme
2017-02-13 15:34 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).