From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96805 invoked by alias); 2 Aug 2016 10:53:37 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 96781 invoked by uid 89); 2 Aug 2016 10:53:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3191, mrs X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 Aug 2016 10:53:26 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8BD1728; Tue, 2 Aug 2016 03:54:45 -0700 (PDT) Received: from e105689-lin.cambridge.arm.com (e105689-lin.cambridge.arm.com [10.2.207.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 43B033F213; Tue, 2 Aug 2016 03:53:23 -0700 (PDT) Subject: Re: [AArch64] Reject -0.0 as an 8-bit FP immediate To: binutils@sourceware.org, richard.sandiford@arm.com References: <871t28a5xh.fsf@e105548-lin.cambridge.arm.com> From: "Richard Earnshaw (lists)" Message-ID: Date: Tue, 02 Aug 2016 10:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <871t28a5xh.fsf@e105548-lin.cambridge.arm.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2016-08/txt/msg00007.txt.bz2 On 01/08/16 16:02, Richard Sandiford wrote: > 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 try 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. > > Tested on aarch64-linux-gnu. OK to install? > OK. R. > Thanks, > Richard > > > 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. > > diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c > index 2d491f6..18539dc 100644 > --- a/gas/config/tc-aarch64.c > +++ b/gas/config/tc-aarch64.c > @@ -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; > diff --git a/gas/testsuite/gas/aarch64/illegal.l b/gas/testsuite/gas/aarch64/illegal.l > index 6119065..a0985ce 100644 > --- a/gas/testsuite/gas/aarch64/illegal.l > +++ b/gas/testsuite/gas/aarch64/illegal.l > @@ -567,4 +567,10 @@ > [^:]*: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: .* > diff --git a/gas/testsuite/gas/aarch64/illegal.s b/gas/testsuite/gas/aarch64/illegal.s > index a315a6d..df31895 100644 > --- a/gas/testsuite/gas/aarch64/illegal.s > +++ b/gas/testsuite/gas/aarch64/illegal.s > @@ -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) >