This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][GCC][AArch64] Inline calls to lrint when possible
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Tamar Christina <Tamar dot Christina at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>
- Date: Thu, 8 Jun 2017 17:50:34 +0100
- Subject: Re: [PATCH][GCC][AArch64] Inline calls to lrint when possible
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com;
- Nodisclaimer: True
- References: <VI1PR0801MB20312637867C59D802147A5CFFC80@VI1PR0801MB2031.eurprd08.prod.outlook.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Wed, Jun 07, 2017 at 12:38:27PM +0100, Tamar Christina wrote:
> Hi All,
>
> This patch allows the inlining of lrint when -fno-math-errno
> assuming that errno does not need to be set when the rounded value
> is not representable as a long.
>
> The case
>
> void f(double *a, long *b, double x)
> {
> *a = __builtin_rint(x);
> *b = __builtin_lrint(x);
> }
>
> now generates with -fno-math-errno:
>
> f:
> frintx d0, d0
> fcvtzs x2, d0
> str d0, [x0]
> str x2, [x1]
> ret
>
> When the flag is not used the same function call is emitted as before:
>
> f:
> stp x29, x30, [sp, -32]!
> frintx d1, d0
> add x29, sp, 0
> str x19, [sp, 16]
> mov x19, x1
> str d1, [x0]
> bl lrint
> str x0, [x19]
> ldr x19, [sp, 16]
> ldp x29, x30, [sp], 32
> ret
>
> Bootstrapped and regtested on aarch64-none-linux-gnu and no regressions.
> The patch also has no regressions on Spec2006.
>
> Ok for trunk?
OK.
Thanks,
James
>
> gcc/
> 2017-06-07 Tamar Christina <tamar.christina@arm.com>
>
> * config/aarch64/aarch64.md (lrint<GPF:mode><GPI:mode>2): New.
>
> gcc/testsuite/
> 2017-06-07 Tamar Christina <tamar.christina@arm.com>
>
> * gcc.target/aarch64/lrint-matherr.h: New.
> * gcc.target/aarch64/inline-lrint_1.c: New.
> * gcc.target/aarch64/inline-lrint_2.c: New.
> * gcc.target/aarch64/no-inline-lrint_1.c: New.
> * gcc.target/aarch64/no-inline-lrint_2.c: New.