From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24026 invoked by alias); 18 Jun 2019 12:30:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 23907 invoked by uid 89); 18 Jun 2019 12:30:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1403 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Jun 2019 12:30:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 871882B; Tue, 18 Jun 2019 05:30:06 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B17F83F246; Tue, 18 Jun 2019 05:30:05 -0700 (PDT) From: Richard Sandiford To: Wilco Dijkstra Mail-Followup-To: Wilco Dijkstra ,Richard Earnshaw , Joel Hutton , nd , GCC Patches , richard.sandiford@arm.com Cc: Richard Earnshaw , Joel Hutton , nd , GCC Patches Subject: Re: [AArch64] Use scvtf fbits option where appropriate References: <3157239f-48e6-bbd6-122c-d173b361bebd@arm.com> Date: Tue, 18 Jun 2019 12:30:00 -0000 In-Reply-To: (Wilco Dijkstra's message of "Tue, 18 Jun 2019 11:12:10 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-06/txt/msg01040.txt.bz2 Wilco Dijkstra writes: > > +/* If X is a positive CONST_DOUBLE with a value that is the reciproca= l of a > > +=C2=A0=C2=A0 power of 2 (i.e 1/2^n) return the number of float bits. = e.g. for x=3D=3D(1/2^n) > > +=C2=A0=C2=A0 return n. Otherwise return -1.=C2=A0 */ > > +int > > +aarch64_fpconst_pow2_recip (rtx x) > > +{ > > +=C2=A0 REAL_VALUE_TYPE r0; > > + > > +=C2=A0 if (!CONST_DOUBLE_P (x)) > > +=C2=A0=C2=A0=C2=A0 return -1; >=20=20 >> CONST_DOUBLE can be used for things other than floating point.=C2=A0 You >> should really check that the mode on the double in is in class MODE_FLOA= T. >=20=20 > Several other functions (eg aarch64_fpconst_pow_of_2) do the same since > this function is only called with HF/SF/DF mode. We could add an assert f= or > SCALAR_FLOAT_MODE_P (but then aarch64_fpconst_pow_of_2 should do > the same). IMO we should leave it as-is. aarch64.h has: #define TARGET_SUPPORTS_WIDE_INT 1 which makes it invalid to use CONST_DOUBLE for anything other than floating-point constants. The handling of CONST_DOUBLEs with integer modes is effectively compiled out in key places so it would be very hard to create one accidentally. And even if somehow we did, it would fail noisily in other ways. So I think it would be redundant to assert that CONST_DOUBLE has a float mode here, much like we (rightly) don't assert that CONST_VECTORs have vector modes. Thanks, Richard