public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic
@ 2015-01-27 9:43 ktkachov at gcc dot gnu.org
2015-02-16 0:42 ` [Bug target/64821] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2015-01-27 9:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
Bug ID: 64821
Summary: [AArch64] Improve target folding for vsqrt_f64
intrinsic
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: minor
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Following the implementation of vsqrt_f64 with a target builtin:
https://gcc.gnu.org/ml/gcc-patches/2015-01/msg00699.html
it was suggested to add some target folding code into a sqrt when
-fno-math-errno is given:
https://gcc.gnu.org/ml/gcc-patches/2015-01/msg00710.html
This issue tracks that work that should be done for GCC 6
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
@ 2015-02-16 0:42 ` pinskia at gcc dot gnu.org
2022-01-10 1:05 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-02-16 0:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-16
Ever confirmed|0 |1
Severity|minor |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
2015-02-16 0:42 ` [Bug target/64821] " pinskia at gcc dot gnu.org
@ 2022-01-10 1:05 ` pinskia at gcc dot gnu.org
2022-01-10 1:19 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 1:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2015-02-16 00:00:00 |2022-1-9
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a testcase:
#include <arm_neon.h>
float64x1_t f(float64x1_t a)
{
return vsqrt_f64 (a);
}
We should fold the __builtin_aarch64_sqrtdf into the internal function .SQRT
which is indepdent of -fno-math-errno .
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
2015-02-16 0:42 ` [Bug target/64821] " pinskia at gcc dot gnu.org
2022-01-10 1:05 ` pinskia at gcc dot gnu.org
@ 2022-01-10 1:19 ` pinskia at gcc dot gnu.org
2022-01-10 7:15 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 1:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am going to fix this but maybe not until stage 1.
I think this is enough too:
diff --git a/gcc/config/aarch64/aarch64-builtins.c
b/gcc/config/aarch64/aarch64-builtins.c
index 58bcbd9875f..1bf487477eb 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -2820,6 +2820,13 @@ aarch64_general_gimple_fold_builtin (unsigned int fcode,
gcall *stmt,
gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
break;
+ /* Lower sqrt builtins to gimple/internal function sqrt. */
+ BUILTIN_VHSDF_DF (UNOP, sqrt, 2, FP)
+ new_stmt = gimple_build_call_internal (IFN_SQRT,
+ 1, args[0]);
+ gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
+ break;
+
/*lower store and load neon builtins to gimple. */
BUILTIN_VALL_F16 (LOAD1, ld1, 0, LOAD)
BUILTIN_VDQ_I (LOAD1_U, ld1, 0, LOAD)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
` (2 preceding siblings ...)
2022-01-10 1:19 ` pinskia at gcc dot gnu.org
@ 2022-01-10 7:15 ` pinskia at gcc dot gnu.org
2022-01-10 7:35 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 7:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> I am going to fix this but maybe not until stage 1.
>
> I think this is enough too:
It is.
A testcase too:
/* { dg-do compile } */
/* { dg-options "-fdump-tree-optimized" } */
#include <arm_neon.h>
/* { dg-final { scan-tree-dump-times "__builtin_aarch64" 0 "optimized" } } */
/* { dg-final { scan-tree-dump-times ".SQRT" 4 "optimized" } } */
float64x1_t f64(float64x1_t a)
{
return vsqrt_f64 (a);
}
float64x2_t f64q(float64x2_t a)
{
return vsqrtq_f64 (a);
}
float32x2_t f32(float32x2_t a)
{
return vsqrt_f32 (a);
}
float32x4_t f32q(float32x4_t a)
{
return vsqrtq_f32 (a);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
` (3 preceding siblings ...)
2022-01-10 7:15 ` pinskia at gcc dot gnu.org
@ 2022-01-10 7:35 ` pinskia at gcc dot gnu.org
2022-01-10 7:53 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 7:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
One more testcase where we get folding now:
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times ".SQRT" 0 "optimized" } } */
/* { dg-final { scan-tree-dump-times "2.0" 1 "optimized" } } */
/* { dg-final { scan-assembler-times "fsqrt" 0 } } */
/* We should produce a fmov to d0 with 2.0 but currently don't, see PR 103959.
*/
/* { dg-final { scan-assembler-times "\n\tfmov\td0, 2.0e.0" 1 { xfail *-*-* } }
} */
#include <arm_neon.h>
float64x1_t f64(void)
{
float64x1_t a = (float64x1_t){4.0};
return vsqrt_f64 (a);
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
` (4 preceding siblings ...)
2022-01-10 7:35 ` pinskia at gcc dot gnu.org
@ 2022-01-10 7:53 ` pinskia at gcc dot gnu.org
2022-01-10 11:35 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 7:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 52151
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52151&action=edit
Patch which is in testing
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
` (5 preceding siblings ...)
2022-01-10 7:53 ` pinskia at gcc dot gnu.org
@ 2022-01-10 11:35 ` pinskia at gcc dot gnu.org
2022-01-23 22:18 ` cvs-commit at gcc dot gnu.org
2022-01-23 22:19 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 11:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2022-January
| |/588012.html
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588012.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
` (6 preceding siblings ...)
2022-01-10 11:35 ` pinskia at gcc dot gnu.org
@ 2022-01-23 22:18 ` cvs-commit at gcc dot gnu.org
2022-01-23 22:19 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-23 22:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:cbcf4a50fa21abd7a4a50a7ce47ada80b115febc
commit r12-6824-gcbcf4a50fa21abd7a4a50a7ce47ada80b115febc
Author: Andrew Pinski <apinski@marvell.com>
Date: Sun Jan 9 23:39:31 2022 -0800
[aarch64/64821]: Simplify __builtin_aarch64_sqrt* into internal function
.SQRT.
This is a simple patch which simplifies the __builtin_aarch64_sqrt*
builtins
into the internal function SQRT which allows for constant folding and other
optimizations at the gimple level. It was originally suggested we do to
__builtin_sqrt just for __builtin_aarch64_sqrtdf when -fno-math-errno
but since r6-4969-g686ee9719a4 we have the internal function SQRT which
does
the same so it makes we don't need to check -fno-math-errno either now.
Applied as approved after bootstrapped and tested on aarch64-linux-gnu with
no regressions.
PR target/64821
gcc/ChangeLog:
* config/aarch64/aarch64-builtins.cc
(aarch64_general_gimple_fold_builtin): Handle
__builtin_aarch64_sqrt* and simplify into SQRT internal
function.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/vsqrt-1.c: New test.
* gcc.target/aarch64/vsqrt-2.c: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/64821] [AArch64] Improve target folding for vsqrt_f64 intrinsic
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
` (7 preceding siblings ...)
2022-01-23 22:18 ` cvs-commit at gcc dot gnu.org
@ 2022-01-23 22:19 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-23 22:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64821
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|--- |12.0
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-01-23 22:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 9:43 [Bug target/64821] New: [AArch64] Improve target folding for vsqrt_f64 intrinsic ktkachov at gcc dot gnu.org
2015-02-16 0:42 ` [Bug target/64821] " pinskia at gcc dot gnu.org
2022-01-10 1:05 ` pinskia at gcc dot gnu.org
2022-01-10 1:19 ` pinskia at gcc dot gnu.org
2022-01-10 7:15 ` pinskia at gcc dot gnu.org
2022-01-10 7:35 ` pinskia at gcc dot gnu.org
2022-01-10 7:53 ` pinskia at gcc dot gnu.org
2022-01-10 11:35 ` pinskia at gcc dot gnu.org
2022-01-23 22:18 ` cvs-commit at gcc dot gnu.org
2022-01-23 22:19 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).