This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR57371] transform (double)i eq/ne 0 to i eq/ne 0
- From: Richard Biener <rguenther at suse dot de>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 3 Aug 2016 14:21:47 +0200 (CEST)
- Subject: Re: [PR57371] transform (double)i eq/ne 0 to i eq/ne 0
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjMmLtpzra0hpkfMHaBsYd3pLmd5y+1t3gQ6YgFgS1ruong@mail.gmail.com>
On Wed, 3 Aug 2016, Prathamesh Kulkarni wrote:
> Hi,
> The attached patch tries to transform
> (double)i eq/ne 0 to i eq/ne 0
> AFAIU from Joseph's comment 1 in PR, the transform should be safe with
> -fno-trapping-math ?
> Bootstrap+tested on x86_64-unknown-linux-gnu in progress.
Couldn't this even be
(cmp (float @0) REAL_CST@1)
(with
{
HOST_WIDE_INT n = real_to_integer (TREE_REAL_CST (@1));
REAL_VALUE_TYPE cint;
real_from_integer (&cint, VOIDmode, n, SIGNED);
}
(if (real_identical (&c, &cint))
(cmp @0 { build_int_cst (TREE_TYPE (@0), n); }))))
with some additional type checks to make sure n fits the type of @0
(and otherwise fold to true/false directly).
Not sure whether we need to restrict it to float types that can
represent all values of the type of @0 exactly.
Richard.