This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/71078] x/abs(x) -> sign(1.0,x)
- From: "prathamesh3492 at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 04 Aug 2016 11:40:03 +0000
- Subject: [Bug middle-end/71078] x/abs(x) -> sign(1.0,x)
- Auto-submitted: auto-generated
- References: <bug-71078-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71078
--- Comment #6 from prathamesh3492 at gcc dot gnu.org ---
(In reply to rguenther@suse.de from comment #5)
> On Thu, 4 Aug 2016, mwahab at gcc dot gnu.org wrote:
>
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71078
> >
> > mwahab at gcc dot gnu.org changed:
> >
> > What |Removed |Added
> > ----------------------------------------------------------------------------
> > CC| |mwahab at gcc dot gnu.org
> >
> > --- Comment #4 from mwahab at gcc dot gnu.org ---
> > (In reply to prathamesh3492 from comment #3)
> > > Fixed.
> >
> > The new test pr71078-1.c fails for arm and aarch64 because copysignl isn't
> > generated for fabsl making the expected output fail to match.
>
> Is that a non-C99 target? If so add require-effective-target c99_runtime
dg-require-effective-target c99_runtime didn't work.
Apparently for long double, it is simplified to __builtin_copysign
instead of __builtin_copysignl
Applying pattern match.pd:208, gimple-match.c:1347
gimple_simplified to t2_3 = __builtin_copysign (1.0e+0, x_1(D));
f3 (long double x)
{
long double t2;
long double t1;
<bb 2>:
t1_2 = ABS_EXPR <x_1(D)>;
t2_3 = __builtin_copysign (1.0e+0, x_1(D));
return t2_3;
}
Looks like for arm, long double and double are same
(sizeof (double) == sizeof (long double)).
Since we first match for the double case,
we end up simplifying to __builtin_copysign.
Thanks,
Prathamesh
>
> Richard.