@@ -956,6 +956,16 @@ aarch64_general_add_builtin (const char *name, tree type, unsigned int code,
NULL, attrs);
}
+static tree
+aarch64_general_simulate_builtin (const char *name, tree fntype,
+ unsigned int code,
+ tree attrs = NULL_TREE)
+{
+ code = (code << AARCH64_BUILTIN_SHIFT) | AARCH64_BUILTIN_GENERAL;
+ return simulate_builtin_function_decl (input_location, name, fntype,
+ code, NULL, attrs);
+}
+
static const char *
aarch64_mangle_builtin_scalar_type (const_tree type)
{
@@ -1879,23 +1889,24 @@ aarch64_init_ls64_builtins (void)
aarch64_init_ls64_builtins_types ();
ls64_builtins_data data[4] = {
- {"__builtin_aarch64_ld64b", AARCH64_LS64_BUILTIN_LD64B,
+ {"__arm_ld64b", AARCH64_LS64_BUILTIN_LD64B,
build_function_type_list (ls64_arm_data_t,
const_ptr_type_node, NULL_TREE)},
- {"__builtin_aarch64_st64b", AARCH64_LS64_BUILTIN_ST64B,
+ {"__arm_st64b", AARCH64_LS64_BUILTIN_ST64B,
build_function_type_list (void_type_node, ptr_type_node,
ls64_arm_data_t, NULL_TREE)},
- {"__builtin_aarch64_st64bv", AARCH64_LS64_BUILTIN_ST64BV,
+ {"__arm_st64bv", AARCH64_LS64_BUILTIN_ST64BV,
build_function_type_list (uint64_type_node, ptr_type_node,
ls64_arm_data_t, NULL_TREE)},
- {"__builtin_aarch64_st64bv0", AARCH64_LS64_BUILTIN_ST64BV0,
+ {"__arm_st64bv0", AARCH64_LS64_BUILTIN_ST64BV0,
build_function_type_list (uint64_type_node, ptr_type_node,
ls64_arm_data_t, NULL_TREE)},
};
for (size_t i = 0; i < ARRAY_SIZE (data); ++i)
aarch64_builtin_decls[data[i].code]
- = aarch64_general_add_builtin (data[i].name, data[i].type, data[i].code);
+ = aarch64_general_simulate_builtin (data[i].name, data[i].type,
+ data[i].code);
}
static void
@@ -2028,6 +2039,9 @@ aarch64_general_init_builtins (void)
if (TARGET_MEMTAG)
aarch64_init_memtag_builtins ();
+
+ if (in_lto_p)
+ handle_arm_acle_h ();
}
/* Implement TARGET_BUILTIN_DECL for the AARCH64_BUILTIN_GENERAL group. */
@@ -270,40 +270,7 @@ __ttest (void)
#endif
#ifdef __ARM_FEATURE_LS64
-#pragma GCC push_options
-#pragma GCC target ("+nothing+ls64")
-
typedef __arm_data512_t data512_t;
-
-__extension__ extern __inline data512_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_ld64b (const void *__addr)
-{
- return __builtin_aarch64_ld64b (__addr);
-}
-
-__extension__ extern __inline void
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_st64b (void *__addr, data512_t __value)
-{
- __builtin_aarch64_st64b (__addr, __value);
-}
-
-__extension__ extern __inline uint64_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_st64bv (void *__addr, data512_t __value)
-{
- return __builtin_aarch64_st64bv (__addr, __value);
-}
-
-__extension__ extern __inline uint64_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_st64bv0 (void *__addr, data512_t __value)
-{
- return __builtin_aarch64_st64bv0 (__addr, __value);
-}
-
-#pragma GCC pop_options
#endif
#pragma GCC push_options
new file mode 100644
@@ -0,0 +1,35 @@
+# Copyright (C) 2014-2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an AArch64 target.
+if ![istarget aarch64*-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib g++-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+ "" ""
+
+# All done.
+dg-finish
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.7-a" } */
+#include <arm_acle.h>
+int main()
+{
+ data512_t d = __arm_ld64b ((const void *)0x1000);
+ __arm_st64b ((void *)0x2000, d);
+ uint64_t x = __arm_st64bv ((void *)0x3000, d);
+ x += __arm_st64bv0 ((void *)0x4000, d);
+}
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do link { target aarch64_asm_ls64_ok } } */
+/* { dg-additional-options "-march=armv8.7-a -flto" } */
+#include <arm_acle.h>
+int main()
+{
+ data512_t d = __arm_ld64b ((const void *)0x1000);
+ __arm_st64b ((void *)0x2000, d);
+ uint64_t x = __arm_st64bv ((void *)0x3000, d);
+ x += __arm_st64bv0 ((void *)0x4000, d);
+}
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do link { target aarch64_asm_ls64_ok } } */
+/* { dg-additional-options "-march=armv8.7-a -flto" } */
+#include <arm_acle.h>
+int main(void)
+{
+ data512_t d = __arm_ld64b ((const void *)0x1000);
+ __arm_st64b ((void *)0x2000, d);
+ uint64_t x = __arm_st64bv ((void *)0x3000, d);
+ x += __arm_st64bv0 ((void *)0x4000, d);
+}
new file mode 100644
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.7-a" } */
+
+/* Check that ls64 builtins can be invoked using a preprocesed testcase
+ without triggering bogus builtin warnings, see PR110132.
+
+ Note that this is purely to test GCC internals and user code should
+ include arm_acle.h to make use of these builtins. */
+
+#pragma GCC aarch64 "arm_acle.h"
+typedef __arm_data512_t data512_t;
+void f(void *p, data512_t d)
+{
+ __arm_st64b (p, d);
+}
@@ -10965,7 +10965,7 @@ proc check_effective_target_aarch64_tiny { } {
# various architecture extensions via the .arch_extension pseudo-op.
foreach { aarch64_ext } { "fp" "simd" "crypto" "crc" "lse" "dotprod" "sve"
- "i8mm" "f32mm" "f64mm" "bf16" "sb" "sve2" } {
+ "i8mm" "f32mm" "f64mm" "bf16" "sb" "sve2" "ls64" } {
eval [string map [list FUNC $aarch64_ext] {
proc check_effective_target_aarch64_asm_FUNC_ok { } {
if { [istarget aarch64*-*-*] } {