* [PATCH]AArch64 fix ls64 intrinsics expansion [PR104409]
@ 2022-04-07 15:04 Tamar Christina
2022-04-07 15:17 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2022-04-07 15:04 UTC (permalink / raw)
To: nd, GCC Patches
Cc: Richard Earnshaw, Marcus Shawcroft, Kyrylo Tkachov,
Richard Sandiford, Richard Sandiford
[-- Attachment #1: Type: text/plain, Size: 3317 bytes --]
Hi All,
The LS64 intrinsics used a machinery that's not safe to use unless being
called from a pragma instantiation.
This moves the initialization code to a new pragma for arm_acle.h.
Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
I didn't add the testcase from the PR as it's 65kb but valgrind shows the memory
error is gone.
Ok for master?
Thanks,
Tamar
gcc/ChangeLog:
PR target/104409
* config/aarch64/aarch64-builtins.cc (handle_arm_acle_h): New.
(aarch64_general_init_builtins): Move LS64 code.
* config/aarch64/aarch64-c.cc (aarch64_pragma_aarch64): Support
arm_acle.h
* config/aarch64/aarch64-protos.h (handle_arm_acle_h): New.
* config/aarch64/arm_acle.h: Add pragma GCC aarch64 "arm_acle.h".
--- inline copy of patch --
diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc
index 5217dbdb2ac78bba0a669d22af6d769d1fe91a3d..65d09afc008b891d8b67a443140b4157cfa84c44 100644
--- a/gcc/config/aarch64/aarch64-builtins.cc
+++ b/gcc/config/aarch64/aarch64-builtins.cc
@@ -1641,6 +1641,14 @@ aarch64_init_ls64_builtins (void)
= aarch64_general_add_builtin (data[i].name, data[i].type, data[i].code);
}
+/* Implement #pragma GCC aarch64 "arm_acle.h". */
+void
+handle_arm_acle_h (void)
+{
+ if (TARGET_LS64)
+ aarch64_init_ls64_builtins ();
+}
+
/* Initialize fpsr fpcr getters and setters. */
static void
@@ -1730,9 +1738,6 @@ aarch64_general_init_builtins (void)
if (TARGET_MEMTAG)
aarch64_init_memtag_builtins ();
-
- if (TARGET_LS64)
- aarch64_init_ls64_builtins ();
}
/* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */
diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc
index caf8e332ea0da0a34f4e96f12a934a5eaeaa1fb2..767ee0c763c56a022089a647c7425afb00644644 100644
--- a/gcc/config/aarch64/aarch64-c.cc
+++ b/gcc/config/aarch64/aarch64-c.cc
@@ -302,6 +302,8 @@ aarch64_pragma_aarch64 (cpp_reader *)
aarch64_sve::handle_arm_sve_h ();
else if (strcmp (name, "arm_neon.h") == 0)
handle_arm_neon_h ();
+ else if (strcmp (name, "arm_acle.h") == 0)
+ handle_arm_acle_h ();
else
error ("unknown %<#pragma GCC aarch64%> option %qs", name);
}
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 46bade28ed6056bea90067d3af1311f300cea559..c478bb59ae1208329facc74200fe98d00bf93f7c 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -982,6 +982,7 @@ rtx aarch64_general_expand_builtin (unsigned int, tree, rtx, int);
tree aarch64_general_builtin_decl (unsigned, bool);
tree aarch64_general_builtin_rsqrt (unsigned int);
tree aarch64_builtin_vectorized_function (unsigned int, tree, tree);
+void handle_arm_acle_h (void);
void handle_arm_neon_h (void);
namespace aarch64_sve {
diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h
index ecd852f8a46d87787912e6573bf363619812e48f..9775a48c65825b424d3eb442384f5ab87b734fd7 100644
--- a/gcc/config/aarch64/arm_acle.h
+++ b/gcc/config/aarch64/arm_acle.h
@@ -29,6 +29,8 @@
#include <stdint.h>
+#pragma GCC aarch64 "arm_acle.h"
+
#ifdef __cplusplus
extern "C" {
#endif
--
[-- Attachment #2: rb15521.patch --]
[-- Type: text/plain, Size: 2519 bytes --]
diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc
index 5217dbdb2ac78bba0a669d22af6d769d1fe91a3d..65d09afc008b891d8b67a443140b4157cfa84c44 100644
--- a/gcc/config/aarch64/aarch64-builtins.cc
+++ b/gcc/config/aarch64/aarch64-builtins.cc
@@ -1641,6 +1641,14 @@ aarch64_init_ls64_builtins (void)
= aarch64_general_add_builtin (data[i].name, data[i].type, data[i].code);
}
+/* Implement #pragma GCC aarch64 "arm_acle.h". */
+void
+handle_arm_acle_h (void)
+{
+ if (TARGET_LS64)
+ aarch64_init_ls64_builtins ();
+}
+
/* Initialize fpsr fpcr getters and setters. */
static void
@@ -1730,9 +1738,6 @@ aarch64_general_init_builtins (void)
if (TARGET_MEMTAG)
aarch64_init_memtag_builtins ();
-
- if (TARGET_LS64)
- aarch64_init_ls64_builtins ();
}
/* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */
diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc
index caf8e332ea0da0a34f4e96f12a934a5eaeaa1fb2..767ee0c763c56a022089a647c7425afb00644644 100644
--- a/gcc/config/aarch64/aarch64-c.cc
+++ b/gcc/config/aarch64/aarch64-c.cc
@@ -302,6 +302,8 @@ aarch64_pragma_aarch64 (cpp_reader *)
aarch64_sve::handle_arm_sve_h ();
else if (strcmp (name, "arm_neon.h") == 0)
handle_arm_neon_h ();
+ else if (strcmp (name, "arm_acle.h") == 0)
+ handle_arm_acle_h ();
else
error ("unknown %<#pragma GCC aarch64%> option %qs", name);
}
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 46bade28ed6056bea90067d3af1311f300cea559..c478bb59ae1208329facc74200fe98d00bf93f7c 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -982,6 +982,7 @@ rtx aarch64_general_expand_builtin (unsigned int, tree, rtx, int);
tree aarch64_general_builtin_decl (unsigned, bool);
tree aarch64_general_builtin_rsqrt (unsigned int);
tree aarch64_builtin_vectorized_function (unsigned int, tree, tree);
+void handle_arm_acle_h (void);
void handle_arm_neon_h (void);
namespace aarch64_sve {
diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h
index ecd852f8a46d87787912e6573bf363619812e48f..9775a48c65825b424d3eb442384f5ab87b734fd7 100644
--- a/gcc/config/aarch64/arm_acle.h
+++ b/gcc/config/aarch64/arm_acle.h
@@ -29,6 +29,8 @@
#include <stdint.h>
+#pragma GCC aarch64 "arm_acle.h"
+
#ifdef __cplusplus
extern "C" {
#endif
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]AArch64 fix ls64 intrinsics expansion [PR104409]
2022-04-07 15:04 [PATCH]AArch64 fix ls64 intrinsics expansion [PR104409] Tamar Christina
@ 2022-04-07 15:17 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2022-04-07 15:17 UTC (permalink / raw)
To: Tamar Christina
Cc: nd, GCC Patches, Richard Earnshaw, Marcus Shawcroft, Kyrylo Tkachov
Tamar Christina <Tamar.Christina@arm.com> writes:
> Hi All,
>
> The LS64 intrinsics used a machinery that's not safe to use unless being
> called from a pragma instantiation.
>
> This moves the initialization code to a new pragma for arm_acle.h.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
>
> I didn't add the testcase from the PR as it's 65kb but valgrind shows the memory
> error is gone.
>
> Ok for master?
OK, thanks.
Richard
>
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> PR target/104409
> * config/aarch64/aarch64-builtins.cc (handle_arm_acle_h): New.
> (aarch64_general_init_builtins): Move LS64 code.
> * config/aarch64/aarch64-c.cc (aarch64_pragma_aarch64): Support
> arm_acle.h
> * config/aarch64/aarch64-protos.h (handle_arm_acle_h): New.
> * config/aarch64/arm_acle.h: Add pragma GCC aarch64 "arm_acle.h".
>
> --- inline copy of patch --
> diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc
> index 5217dbdb2ac78bba0a669d22af6d769d1fe91a3d..65d09afc008b891d8b67a443140b4157cfa84c44 100644
> --- a/gcc/config/aarch64/aarch64-builtins.cc
> +++ b/gcc/config/aarch64/aarch64-builtins.cc
> @@ -1641,6 +1641,14 @@ aarch64_init_ls64_builtins (void)
> = aarch64_general_add_builtin (data[i].name, data[i].type, data[i].code);
> }
>
> +/* Implement #pragma GCC aarch64 "arm_acle.h". */
> +void
> +handle_arm_acle_h (void)
> +{
> + if (TARGET_LS64)
> + aarch64_init_ls64_builtins ();
> +}
> +
> /* Initialize fpsr fpcr getters and setters. */
>
> static void
> @@ -1730,9 +1738,6 @@ aarch64_general_init_builtins (void)
>
> if (TARGET_MEMTAG)
> aarch64_init_memtag_builtins ();
> -
> - if (TARGET_LS64)
> - aarch64_init_ls64_builtins ();
> }
>
> /* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */
> diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc
> index caf8e332ea0da0a34f4e96f12a934a5eaeaa1fb2..767ee0c763c56a022089a647c7425afb00644644 100644
> --- a/gcc/config/aarch64/aarch64-c.cc
> +++ b/gcc/config/aarch64/aarch64-c.cc
> @@ -302,6 +302,8 @@ aarch64_pragma_aarch64 (cpp_reader *)
> aarch64_sve::handle_arm_sve_h ();
> else if (strcmp (name, "arm_neon.h") == 0)
> handle_arm_neon_h ();
> + else if (strcmp (name, "arm_acle.h") == 0)
> + handle_arm_acle_h ();
> else
> error ("unknown %<#pragma GCC aarch64%> option %qs", name);
> }
> diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
> index 46bade28ed6056bea90067d3af1311f300cea559..c478bb59ae1208329facc74200fe98d00bf93f7c 100644
> --- a/gcc/config/aarch64/aarch64-protos.h
> +++ b/gcc/config/aarch64/aarch64-protos.h
> @@ -982,6 +982,7 @@ rtx aarch64_general_expand_builtin (unsigned int, tree, rtx, int);
> tree aarch64_general_builtin_decl (unsigned, bool);
> tree aarch64_general_builtin_rsqrt (unsigned int);
> tree aarch64_builtin_vectorized_function (unsigned int, tree, tree);
> +void handle_arm_acle_h (void);
> void handle_arm_neon_h (void);
>
> namespace aarch64_sve {
> diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h
> index ecd852f8a46d87787912e6573bf363619812e48f..9775a48c65825b424d3eb442384f5ab87b734fd7 100644
> --- a/gcc/config/aarch64/arm_acle.h
> +++ b/gcc/config/aarch64/arm_acle.h
> @@ -29,6 +29,8 @@
>
> #include <stdint.h>
>
> +#pragma GCC aarch64 "arm_acle.h"
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
>
>
> --
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-07 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 15:04 [PATCH]AArch64 fix ls64 intrinsics expansion [PR104409] Tamar Christina
2022-04-07 15:17 ` Richard Sandiford
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).