[PATCH][AArch64] Use target builtin instead of __builtin_sqrt for vsqrt_f64
James Greenhalgh
james.greenhalgh@arm.com
Mon Jan 19 15:50:00 GMT 2015
On Mon, Jan 12, 2015 at 05:30:46PM +0000, Andrew Pinski wrote:
> On Mon, Jan 12, 2015 at 7:52 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> > Hi all,
> >
> > As raised in https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01237.html and
> > discussed in that thread, using __builtin_sqrt for vsqrt_f64 may end up in a
> > call to the library sqrt at -O0. To avoid that this patch uses a target
> > builtin for sqrt on DF mode and uses that to implement the intrinsic.
> >
> > With this patch I don't see sqrt calls being created at -O0 on a large
> > arm_neon.h testcase where they were generated before.
> > aarch64-none-elf testing and the intrinsics testsuite in particular are
> > clean.
> > Ok for trunk?
>
> Maybe have a target fold which folds this into sqrt if -fno-math-errno
> is supplied. This might be useful the -ffast-math case.
> Maybe also fold it when a constant is supplied too.
Given that we are now in Stage 4, I'd rather see this fixed for GCC 5.0
in the way Kyrill proposed than languishing on a TODO list. Though an
IOU ticket on bugzilla for the missed optimization seems a good idea
to me.
Unless Kyrill already has something in the works to address your
comment, this looks like the right short-term solution to me
(Though Marcus/Richard will have to approve it).
Thanks,
James
> > 2015-01-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
> >
> > * config/aarch64/aarch64-simd-builtins.def (sqrt): Use BUILTIN_VDQF_DF.
> > * config/aarch64/arm_neon.h (vsqrt_f64): Use __builtin_aarch64_sqrtdf
> > instead of __builtin_sqrt.
>
More information about the Gcc-patches
mailing list