This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][AArch64] Use target builtin instead of __builtin_sqrt for vsqrt_f64
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Kyrylo Tkachov <Kyrylo dot Tkachov at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Mon, 19 Jan 2015 15:44:06 +0000
- Subject: Re: [PATCH][AArch64] Use target builtin instead of __builtin_sqrt for vsqrt_f64
- Authentication-results: sourceware.org; auth=none
- References: <54B3EDC9 dot 7080004 at arm dot com> <CA+=Sn1=iNLFprn-5w036KV6uATsrggmXj99qKAovEFoxcbd1=w at mail dot gmail dot com>
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.
>