This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/71078] x/abs(x) -> sign(1.0,x)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71078

--- Comment #9 from prathamesh3492 at gcc dot gnu.org ---
(In reply to rguenther@suse.de from comment #8)
> On Thu, 4 Aug 2016, prathamesh3492 at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71078
> > 
> > --- Comment #7 from prathamesh3492 at gcc dot gnu.org ---
> > (In reply to prathamesh3492 from comment #6)
> > > (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.
> > 
> > I wonder if this is a bug in the pattern or in test-case ?
> 
> I think this is what is expected and correct for long double == double 
> targets.
> 
> > If double and long double are same, then I suppose it shouldn't
> > matter if copysign would get called for long double ?
> > In that case, should I add following target-effective-checks
> > to the test-case ?
> > dg-require-effective-target large_long_double
> > dg-require-effective-target large_double
> > 
> > Adding
> > /* { dg-require-effective-target large_long_double } */
> > to the test-case makes it unsupported on arm-linux-gnueabihf.
> 
> If you go down that route (and not simply scan for three times
> copysign) please split the testacse into three.
Committed r239149 which splits the test-case into three.

Thanks,
Prathamesh
> 
> Richard.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]