AARCH64_WSRF,
AARCH64_WSRF64,
AARCH64_WSR128,
- AARCH64_PLD,
- AARCH64_PLDX,
- AARCH64_PLI,
- AARCH64_PLIX,
+ AARCH64_PREFETCH_PLD,
+ AARCH64_PREFETCH_PLDX,
+ AARCH64_PREFETCH_PLI,
+ AARCH64_PREFETCH_PLIX,
+ AARCH64_PREFETCH_PLDIR,
/* Armv8.9-A / Armv9.4-A builtins. */
AARCH64_BUILTIN_CHKFEAT,
AARCH64_BUILTIN_GCSPR,
AARCH64_BUILTIN_STSHH_DI,
AARCH64_BUILTIN_STSHH_SF,
AARCH64_BUILTIN_STSHH_DF,
- AARCH64_BUILTIN_PLDIR,
AARCH64_BUILTIN_MAX
};
AARCH64_INIT_RWSR_BUILTINS_DECL (WSR128, wsr128, fntype);
}
-/* Add builtins for data and instrution prefetch. */
+/* Add builtins for data and instruction prefetch. */
static void
-aarch64_init_prefetch_builtin (void)
+aarch64_init_prefetch_builtins (void)
{
-#define AARCH64_INIT_PREFETCH_BUILTIN(INDEX, N) \
- aarch64_builtin_decls[INDEX] = \
- aarch64_general_add_builtin ("__builtin_aarch64_" N, ftype, INDEX, \
- prefetch_attrs)
+#define AARCH64_INIT_PREFETCH_BUILTINS_DECL(N, F) \
+ aarch64_builtin_decls[AARCH64_PREFETCH_##F] \
+ = aarch64_general_simulate_builtin (N, ftype, \
+ AARCH64_PREFETCH_##F, \
+ prefetch_attrs);
+
tree ftype;
tree cv_argtype;
cv_argtype = build_pointer_type (cv_argtype);
ftype = build_function_type_list (void_type_node, cv_argtype, NULL);
- AARCH64_INIT_PREFETCH_BUILTIN (AARCH64_PLD, "pld");
- AARCH64_INIT_PREFETCH_BUILTIN (AARCH64_PLI, "pli");
+ AARCH64_INIT_PREFETCH_BUILTINS_DECL ("__pld", PLD);
+ AARCH64_INIT_PREFETCH_BUILTINS_DECL ("__pli", PLI);
ftype = build_function_type_list (void_type_node, unsigned_type_node,
unsigned_type_node, unsigned_type_node,
cv_argtype, NULL);
- AARCH64_INIT_PREFETCH_BUILTIN (AARCH64_PLDX, "pldx");
+ AARCH64_INIT_PREFETCH_BUILTINS_DECL ("__pldx", PLDX);
ftype = build_function_type_list (void_type_node, unsigned_type_node,
unsigned_type_node, cv_argtype, NULL);
- AARCH64_INIT_PREFETCH_BUILTIN (AARCH64_PLIX, "plix");
+ AARCH64_INIT_PREFETCH_BUILTINS_DECL ("__plix", PLIX);
+
+ ftype = build_function_type_list (void_type_node, cv_argtype, NULL_TREE);
+ AARCH64_INIT_PREFETCH_BUILTINS_DECL ("__pldir", PLDIR);
}
/* Initialize the memory tagging extension (MTE) builtins. */
aarch64_init_ls64_builtins ();
aarch64_init_tme_builtins ();
aarch64_init_memtag_builtins ();
+ aarch64_init_prefetch_builtins ();
}
/* Initialize fpsr fpcr getters and setters. */
= aarch64_general_add_builtin ("__builtin_aarch64_stshh_df", ftype,
AARCH64_BUILTIN_STSHH_DF);
- tree cv_argtype = build_qualified_type (void_type_node, TYPE_QUAL_CONST
- | TYPE_QUAL_VOLATILE);
- cv_argtype = build_pointer_type (cv_argtype);
-
- ftype = build_function_type_list (void_type_node, cv_argtype, NULL_TREE);
- aarch64_builtin_decls[AARCH64_BUILTIN_PLDIR]
- = aarch64_general_add_builtin ("__builtin_aarch64_pldir", ftype,
- AARCH64_BUILTIN_PLDIR);
}
/* Initialize all builtins in the AARCH64_BUILTIN_GENERAL group. */
aarch64_init_data_intrinsics ();
aarch64_init_rwsr_builtins ();
- aarch64_init_prefetch_builtin ();
tree ftype_jcvt
= build_function_type_list (intSI_type_node, double_type_node, NULL);
sensible defaults. */
switch (fcode)
{
- case AARCH64_PLDX:
+ case AARCH64_PREFETCH_PLDX:
break;
- case AARCH64_PLIX:
+ case AARCH64_PREFETCH_PLIX:
kind_id = 2;
break;
- case AARCH64_PLI:
- case AARCH64_PLD:
- kind_id = (fcode == AARCH64_PLD) ? 0 : 2;
+ case AARCH64_PREFETCH_PLI:
+ case AARCH64_PREFETCH_PLD:
+ kind_id = (fcode == AARCH64_PREFETCH_PLD) ? 0 : 2;
level_id = 0;
rettn_id = 0;
break;
case AARCH64_WSRF64:
case AARCH64_WSR128:
return aarch64_expand_rwsr_builtin (exp, target, fcode);
- case AARCH64_PLD:
- case AARCH64_PLDX:
- case AARCH64_PLI:
- case AARCH64_PLIX:
+ case AARCH64_PREFETCH_PLD:
+ case AARCH64_PREFETCH_PLDX:
+ case AARCH64_PREFETCH_PLI:
+ case AARCH64_PREFETCH_PLIX:
aarch64_expand_prefetch_builtin (exp, fcode);
return target;
-
+ case AARCH64_PREFETCH_PLDIR:
+ aarch64_expand_pldir_builtin (exp);
+ return target;
case AARCH64_BUILTIN_CHKFEAT:
{
rtx x16_reg = gen_rtx_REG (DImode, R16_REGNUM);
case AARCH64_BUILTIN_STSHH_DF:
aarch64_expand_stshh_builtin (exp, fcode);
return target;
-
- case AARCH64_BUILTIN_PLDIR:
- {
- aarch64_expand_pldir_builtin (exp);
- return target;
- }
- }
+ }
if (fcode >= AARCH64_SIMD_BUILTIN_BASE && fcode <= AARCH64_SIMD_BUILTIN_MAX)
return aarch64_simd_expand_builtin (fcode, exp, target);
#undef _GCC_ARM_ACLE_DATA_FN
-__extension__ extern __inline void
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__pld (void const volatile *__addr)
-{
- return __builtin_aarch64_pld (__addr);
-}
-
-__extension__ extern __inline void
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__pli (void const volatile *__addr)
-{
- return __builtin_aarch64_pli (__addr);
-}
-
-__extension__ extern __inline void
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__plix (unsigned int __cache, unsigned int __rettn,
- void const volatile *__addr)
-{
- return __builtin_aarch64_plix (__cache, __rettn, __addr);
-}
-
-__extension__ extern __inline void
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__pldx (unsigned int __access, unsigned int __cache, unsigned int __rettn,
- void const volatile *__addr)
-{
- return __builtin_aarch64_pldx (__access, __cache, __rettn, __addr);
-}
-
-__extension__ extern __inline void
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__pldir (void const volatile *__addr)
-{
- return __builtin_aarch64_pldir (__addr);
-}
-
__extension__ extern __inline unsigned long
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__revl (unsigned long __value)
--- /dev/null
+/* Check that PRFM-related bounds checks are applied correctly. */
+/* { dg-do compile } */
+#include <arm_acle.h>
+
+/* Access kind specifiers. */
+#define KIND_LOW -1
+#define KIND_HIGH 2
+/* Cache levels. */
+#define LEVEL_LOW -1
+#define LEVEL_HIGH 4
+/* Retention policies. */
+#define POLICY_LOW -1
+#define POLICY_HIGH 2
+
+void
+data_rw_prefetch_bad_bounds (void *a)
+{
+ __pldx (KIND_LOW, 0, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,1\]} } */
+ __pldx (KIND_HIGH, 0, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,1\]} } */
+ __pldx (0, LEVEL_LOW, 0, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,3\]} } */
+ __pldx (0, LEVEL_HIGH, 0, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,3\]} } */
+ __pldx (0, 0, POLICY_LOW, a); /* { dg-error {argument 3 must be a constant immediate in range \[0,1\]} } */
+ __pldx (0, 0, POLICY_HIGH, a); /* { dg-error {argument 3 must be a constant immediate in range \[0,1\]} } */
+}
+
+void
+insn_prefetch_bad_bounds (void *a)
+{
+ __plix (LEVEL_LOW, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,3\]} } */
+ __plix (LEVEL_HIGH, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,3\]} } */
+ __plix (0, POLICY_LOW, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,1\]} } */
+ __plix (0, POLICY_HIGH, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,1\]} } */
+}
+++ /dev/null
-/* Check that PRFM-related bounds checks are applied correctly. */
-/* { dg-do compile } */
-#include <arm_acle.h>
-
-/* Access kind specifiers. */
-#define KIND_LOW -1
-#define KIND_HIGH 2
-/* Cache levels. */
-#define LEVEL_LOW -1
-#define LEVEL_HIGH 4
-/* Retention policies. */
-#define POLICY_LOW -1
-#define POLICY_HIGH 2
-
-void
-data_rw_prefetch_bad_bounds (void *a)
-{
- __builtin_aarch64_pldx (KIND_LOW, 0, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,1\]} } */
- __builtin_aarch64_pldx (KIND_HIGH, 0, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,1\]} } */
- __builtin_aarch64_pldx (0, LEVEL_LOW, 0, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,3\]} } */
- __builtin_aarch64_pldx (0, LEVEL_HIGH, 0, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,3\]} } */
- __builtin_aarch64_pldx (0, 0, POLICY_LOW, a); /* { dg-error {argument 3 must be a constant immediate in range \[0,1\]} } */
- __builtin_aarch64_pldx (0, 0, POLICY_HIGH, a); /* { dg-error {argument 3 must be a constant immediate in range \[0,1\]} } */
-}
-
-void
-insn_prefetch_bad_bounds (void *a)
-{
- __builtin_aarch64_plix (LEVEL_LOW, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,3\]} } */
- __builtin_aarch64_plix (LEVEL_HIGH, 0, a); /* { dg-error {argument 1 must be a constant immediate in range \[0,3\]} } */
- __builtin_aarch64_plix (0, POLICY_LOW, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,1\]} } */
- __builtin_aarch64_plix (0, POLICY_HIGH, a); /* { dg-error {argument 2 must be a constant immediate in range \[0,1\]} } */
-}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#include <arm_acle.h>
+
+void
+test (void *a)
+{
+ __pldx (1, 1, 1, a);
+}
+/*
+** test:
+**...
+** prfm\tPSTL2STRM, \[x[0-9]+\]
+**...
+** ret
+*/