]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[AArch64] Reject -0.0 as an 8-bit FP immediate
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 11 Aug 2016 08:14:45 +0000 (09:14 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 11 Aug 2016 08:14:45 +0000 (09:14 +0100)
parse_aarch64_imm_float was accepting -0.0 even though that's not
a valid immediate for any instruction.  The FPIMM0 caller rejected
it, but the FPIMM one would silently treat it as -2.0.

This patch rejects -0.0 and adds testcases to illegal.[sd].

Before the patch, the final error emitted for illegal.s was:

        Error: cannot do 16-byte relocation

which was matched by:

        [^:]*:569: Error: .*

The error was reported against the last line of the file rather than
the instruction that required the reloc.  Adding more instructions
meant that the line number also changed.

Reporting against the wrong line isn't good from a QoI perspective
but isn't what I'm trying to fix here.  Until it's fixed, I thought
it would be better to adjust the match to be against an end-of-file
comment rather than against whatever the last instruction happens to be.

gas/
* config/tc-aarch64.c (parse_aarch64_imm_float): Reject -0.0.
* testsuite/gas/aarch64/illegal.s, testsuite/gas/aarch64/illegal.l:
Add tests for -0.0.  Add an end-of-file comment.

gas/ChangeLog
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/illegal.l
gas/testsuite/gas/aarch64/illegal.s

index 792ba877c6a30f6e76b2f47e80c6dbd98a4995fb..403f122cb3a1a42370545f7449b2323eb7709e78 100644 (file)
@@ -1,3 +1,9 @@
+2016-08-11  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * config/tc-aarch64.c (parse_aarch64_imm_float): Reject -0.0.
+       * testsuite/gas/aarch64/illegal.s, testsuite/gas/aarch64/illegal.l:
+       Add tests for -0.0.  Add an end-of-file comment.
+
 2016-08-05  Nick Clifton  <nickc@redhat.com>
 
        PR gas/20429
index e221ef47377e6f7288735017f6eca3aba1262777..34fdc53e1211858a0e8f2cda73abf39b95aa4d7d 100644 (file)
@@ -2240,7 +2240,7 @@ parse_aarch64_imm_float (char **ccp, int *immed, bfd_boolean dp_p)
        }
     }
 
-  if (aarch64_imm_float_p (fpword) || (fpword & 0x7fffffff) == 0)
+  if (aarch64_imm_float_p (fpword) || fpword == 0)
     {
       *immed = fpword;
       *ccp = str;
index 61190655c4dee6697605a896c332543b28bbdb1d..a0985cea501c8e7f5db7feb04836097b19ac34c2 100644 (file)
 [^:]*:567: Error: .*`mrs x7,S1_1_C16_C6_6'
 [^:]*:568: Error: .*`mrs x8,S2_2_C15_C16_7'
 [^:]*:569: Error: .*`mrs x9,S3_3_C14_C15_8'
-[^:]*:569: Error: .*
+[^:]*:571: Error: .*`fmov s0,#-0\.0'
+[^:]*:573: Error: .*`fmov s0,#0x80000000'
+[^:]*:575: Error: .*`fmov d0,#-0\.0'
+[^:]*:577: Error: .*`fmov d0,#0x8000000000000000'
+[^:]*:582: Error: .*`fcmgt v0\.4s,v0\.4s,#-0\.0'
+[^:]*:585: Error: .*`fcmgt v0\.2d,v0\.2d,#-0\.0'
+[^:]*:587: Error: .*
index a315a6de859b74e23616c141052400bffc44f8c1..df31895491b45922797437241031ef4f3ef5b757 100644 (file)
@@ -567,3 +567,21 @@ one_label:
        mrs     x7, S1_1_C16_C6_6
        mrs     x8, S2_2_C15_C16_7
        mrs     x9, S3_3_C14_C15_8
+
+       fmov    s0, #-0.0
+       fmov    s0, #0x40000000 // OK
+       fmov    s0, #0x80000000
+       fmov    s0, #0xc0000000 // OK
+       fmov    d0, #-0.0
+       fmov    d0, #0x4000000000000000 // OK
+       fmov    d0, #0x8000000000000000
+       fmov    d0, #0xc000000000000000 // OK
+
+       fcmgt   v0.4s, v0.4s, #0.0 // OK
+       fcmgt   v0.4s, v0.4s, #0 // OK
+       fcmgt   v0.4s, v0.4s, #-0.0
+       fcmgt   v0.2d, v0.2d, #0.0 // OK
+       fcmgt   v0.2d, v0.2d, #0 // OK
+       fcmgt   v0.2d, v0.2d, #-0.0
+
+       // End (for errors during literal pool generation)