This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix PR55152


On Tue, Oct 4, 2016 at 2:50 AM, Richard Biener <rguenther@suse.de> wrote:
> On Tue, 4 Oct 2016, Marc Glisse wrote:
>
>> On Tue, 4 Oct 2016, Richard Biener wrote:
>>
>> > Possibly.  Though then for FP we also want - abs (a) -> copysign (a, -1).
>>
>> I thought this might fix PR 62055, but at least on x86_64, we generate much
>> worse code for copysign(,-1) than for -abs :-(
>
> I would have expected copysign(,-1) to be a simple IOR ...
>
> double foo (double x)
> {
>   return __builtin_copysign (x, -1.);
> }
>
> foo:
> .LFB0:
>         .cfi_startproc
>         movsd   .LC0(%rip), %xmm1
>         movapd  %xmm1, %xmm2
>         andpd   .LC2(%rip), %xmm2
>         andpd   .LC1(%rip), %xmm0
>         orpd    %xmm2, %xmm0
>         ret
>
> ICK. -fabs (x) yields
>
> foo:
> .LFB0:
>         .cfi_startproc
>         andpd  .LC0(%rip), %xmm0
>         xorpd  .LC1(%rip), %xmm0
>         ret
>
> I expected a simple orpd .LC0(%rip), %xmm0 ...

That is recorded already as PR62055 :).

Thanks,
Andrew

>
> Richard.


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