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][PR90106] Builtin call transformation changes in cdce pass


On Thu, May 9, 2019 at 5:31 AM Jeff Law <law@redhat.com> wrote:
>
> On 5/8/19 6:28 AM, Richard Biener wrote:
> > On Wed, May 8, 2019 at 12:09 PM JunMa <JunMa@linux.alibaba.com> wrote:
> >>
> >> Hi
> >>
> >> As PR90106 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90106),
> >> when gcc meets builtin function call like:
> >>
> >>    y = sqrt (x);
> >>
> >> The cdce pass tries to transform the call into an internal function
> >> call and conditionally executes call with a simple range check on the
> >> arguments which can detect most cases and the errno does not need
> >> to be set. It looks like:
> >>
> >>    y = IFN_SQRT (x);
> >>    if (__builtin_isless (x, 0))
> >>      sqrt (x);
> >>
> >> However, If the call is in tail position, for example:
> >>
> >>    y =  sqrt (x);
> >>    return y;
> >>
> >> will become:
> >>
> >>    y = IFN_SQRT (x);
> >>    if (__builtin_isless (x, 0))
> >>      sqrt (x);
> >>    return y;
> >>
> >> This transformation breaks tailcall pattern, and prevents
> >> later tailcall optimizations.
> >>
> >> So This patch transform builtin call with return value into
> >> if-then-else part, which looks like:
> >>
> >>    y =  sqrt (x);
> >>     ==>
> >>    if (__builtin_isless (x, 0))
> >>      y = sqrt (x);
> >>    else
> >>      y = IFN_SQRT (x);
> >>
> >> BTW, y = sqrt (x) can also transform like:
> >>
> >>    y = IFN_SQRT (x);
> >>    if (__builtin_isless (x, 0))
> >>      y = sqrt (x);
> >>
> >> We don‘t choose this pattern because it emits worse assemble
> >> code(more move instruction and use more registers) in x86_64.
> >>
> >> Bootstrapped/regtested on x86_64-linux, ok for trunk?
> >
> > OK.
> JunMa -- do you have a copyright assignment on file and write access to
> the repository?  If not we should take care of that before proceeding
> further.
Hi Jeff,
Thanks very much for helping.
Yes, he is under Alibaba's copyright assignment.  What else should we
do other than noticing in this mailing list message?
BTW, I think JunMa needs to apply write-access though.

Thanks,
bin
>
> Jeff


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