aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2024-12-03 09:54:01 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2024-12-03 09:54:01 +0000
commit83f22c1c526368cafc3d32f03462ecd7847f054f (patch)
tree70db03faedcc250533bb824cfc806072ec655d90
parenta07a2b8c9e7c2d123f0178875c9110eaf9770b7a (diff)
downloadgcc-83f22c1c526368cafc3d32f03462ecd7847f054f.zip
gcc-83f22c1c526368cafc3d32f03462ecd7847f054f.tar.gz
gcc-83f22c1c526368cafc3d32f03462ecd7847f054f.tar.bz2
aarch64: Add flags field to aarch64-simd-pragma-builtins.def
This patch adds a flags field to aarch64-simd-pragma-builtins.def and uses it to add attributes to the function declaration. gcc/ * config/aarch64/aarch64-simd-pragma-builtins.def: Add a flags field to each entry. * config/aarch64/aarch64-builtins.cc: Update includes accordingly. (aarch64_pragma_builtins_data): Add a flags field. (aarch64_init_pragma_builtins): Use the flags field to add attributes to the function declaration.
-rw-r--r--gcc/config/aarch64/aarch64-builtins.cc12
-rw-r--r--gcc/config/aarch64/aarch64-simd-pragma-builtins.def59
2 files changed, 42 insertions, 29 deletions
diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc
index f8c8a27..22f8216 100644
--- a/gcc/config/aarch64/aarch64-builtins.cc
+++ b/gcc/config/aarch64/aarch64-builtins.cc
@@ -782,7 +782,7 @@ typedef struct
AARCH64_SIMD_BUILTIN_##T##_##N##A,
#undef ENTRY
-#define ENTRY(N, S, T0, T1, T2, U) \
+#define ENTRY(N, S, T0, T1, T2, U, F) \
AARCH64_##N,
enum aarch64_builtins
@@ -1651,9 +1651,10 @@ namespace simd_types {
}
#undef ENTRY
-#define ENTRY(N, S, T0, T1, T2, U) \
+#define ENTRY(N, S, T0, T1, T2, U, F) \
{#N, aarch64_builtin_signatures::S, simd_types::T0, simd_types::T1, \
- simd_types::T2, U, aarch64_required_extensions::REQUIRED_EXTENSIONS},
+ simd_types::T2, U, aarch64_required_extensions::REQUIRED_EXTENSIONS, \
+ FLAG_##F},
/* Initialize pragma builtins. */
@@ -1664,6 +1665,7 @@ struct aarch64_pragma_builtins_data
simd_type types[3];
int unspec;
aarch64_required_extensions required_extensions;
+ unsigned int flags;
};
static aarch64_pragma_builtins_data aarch64_pragma_builtins[] = {
@@ -1708,8 +1710,10 @@ aarch64_init_pragma_builtins ()
auto data = aarch64_pragma_builtins[i];
auto fntype = aarch64_fntype (data);
auto code = AARCH64_PRAGMA_BUILTIN_START + i + 1;
+ auto flag_mode = data.types[0].mode;
+ auto attrs = aarch64_get_attributes (data.flags, flag_mode);
aarch64_builtin_decls[code]
- = aarch64_general_simulate_builtin (data.name, fntype, code);
+ = aarch64_general_simulate_builtin (data.name, fntype, code, attrs);
}
}
diff --git a/gcc/config/aarch64/aarch64-simd-pragma-builtins.def b/gcc/config/aarch64/aarch64-simd-pragma-builtins.def
index db40745..ae8732b 100644
--- a/gcc/config/aarch64/aarch64-simd-pragma-builtins.def
+++ b/gcc/config/aarch64/aarch64-simd-pragma-builtins.def
@@ -19,46 +19,55 @@
<http://www.gnu.org/licenses/>. */
#undef ENTRY_BINARY
-#define ENTRY_BINARY(N, T0, T1, T2, U) \
- ENTRY (N, binary, T0, T1, T2, U)
+#define ENTRY_BINARY(N, T0, T1, T2, U, F) \
+ ENTRY (N, binary, T0, T1, T2, U, F)
#undef ENTRY_BINARY_LANE
-#define ENTRY_BINARY_LANE(N, T0, T1, T2, U) \
- ENTRY (N, binary_lane, T0, T1, T2, U)
+#define ENTRY_BINARY_LANE(N, T0, T1, T2, U, F) \
+ ENTRY (N, binary_lane, T0, T1, T2, U, F)
#undef ENTRY_BINARY_VHSDF
-#define ENTRY_BINARY_VHSDF(NAME, UNSPEC) \
- ENTRY_BINARY (NAME##_f16, f16, f16, f16, UNSPEC) \
- ENTRY_BINARY (NAME##q_f16, f16q, f16q, f16q, UNSPEC) \
- ENTRY_BINARY (NAME##_f32, f32, f32, f32, UNSPEC) \
- ENTRY_BINARY (NAME##q_f32, f32q, f32q, f32q, UNSPEC) \
- ENTRY_BINARY (NAME##q_f64, f64q, f64q, f64q, UNSPEC)
+#define ENTRY_BINARY_VHSDF(NAME, UNSPEC, FLAGS) \
+ ENTRY_BINARY (NAME##_f16, f16, f16, f16, UNSPEC, FLAGS) \
+ ENTRY_BINARY (NAME##q_f16, f16q, f16q, f16q, UNSPEC, FLAGS) \
+ ENTRY_BINARY (NAME##_f32, f32, f32, f32, UNSPEC, FLAGS) \
+ ENTRY_BINARY (NAME##q_f32, f32q, f32q, f32q, UNSPEC, FLAGS) \
+ ENTRY_BINARY (NAME##q_f64, f64q, f64q, f64q, UNSPEC, FLAGS)
#undef ENTRY_TERNARY_VLUT8
-#define ENTRY_TERNARY_VLUT8(T) \
- ENTRY_BINARY_LANE (vluti2_lane_##T##8, T##8q, T##8, u8, UNSPEC_LUTI2) \
- ENTRY_BINARY_LANE (vluti2_laneq_##T##8, T##8q, T##8, u8q, UNSPEC_LUTI2) \
- ENTRY_BINARY_LANE (vluti2q_lane_##T##8, T##8q, T##8q, u8, UNSPEC_LUTI2) \
- ENTRY_BINARY_LANE (vluti2q_laneq_##T##8, T##8q, T##8q, u8q, UNSPEC_LUTI2) \
- ENTRY_BINARY_LANE (vluti4q_lane_##T##8, T##8q, T##8q, u8, UNSPEC_LUTI4) \
- ENTRY_BINARY_LANE (vluti4q_laneq_##T##8, T##8q, T##8q, u8q, UNSPEC_LUTI4)
+#define ENTRY_TERNARY_VLUT8(T) \
+ ENTRY_BINARY_LANE (vluti2_lane_##T##8, T##8q, T##8, u8, \
+ UNSPEC_LUTI2, NONE) \
+ ENTRY_BINARY_LANE (vluti2_laneq_##T##8, T##8q, T##8, u8q, \
+ UNSPEC_LUTI2, NONE) \
+ ENTRY_BINARY_LANE (vluti2q_lane_##T##8, T##8q, T##8q, u8, \
+ UNSPEC_LUTI2, NONE) \
+ ENTRY_BINARY_LANE (vluti2q_laneq_##T##8, T##8q, T##8q, u8q, \
+ UNSPEC_LUTI2, NONE) \
+ ENTRY_BINARY_LANE (vluti4q_lane_##T##8, T##8q, T##8q, u8, \
+ UNSPEC_LUTI4, NONE) \
+ ENTRY_BINARY_LANE (vluti4q_laneq_##T##8, T##8q, T##8q, u8q, \
+ UNSPEC_LUTI4, NONE)
#undef ENTRY_TERNARY_VLUT16
#define ENTRY_TERNARY_VLUT16(T) \
- ENTRY_BINARY_LANE (vluti2_lane_##T##16, T##16q, T##16, u8, UNSPEC_LUTI2) \
- ENTRY_BINARY_LANE (vluti2_laneq_##T##16, T##16q, T##16, u8q, UNSPEC_LUTI2) \
- ENTRY_BINARY_LANE (vluti2q_lane_##T##16, T##16q, T##16q, u8, UNSPEC_LUTI2) \
+ ENTRY_BINARY_LANE (vluti2_lane_##T##16, T##16q, T##16, u8, \
+ UNSPEC_LUTI2, NONE) \
+ ENTRY_BINARY_LANE (vluti2_laneq_##T##16, T##16q, T##16, u8q, \
+ UNSPEC_LUTI2, NONE) \
+ ENTRY_BINARY_LANE (vluti2q_lane_##T##16, T##16q, T##16q, u8, \
+ UNSPEC_LUTI2, NONE) \
ENTRY_BINARY_LANE (vluti2q_laneq_##T##16, T##16q, T##16q, u8q, \
- UNSPEC_LUTI2) \
+ UNSPEC_LUTI2, NONE) \
ENTRY_BINARY_LANE (vluti4q_lane_##T##16_x2, T##16q, T##16qx2, u8, \
- UNSPEC_LUTI4) \
+ UNSPEC_LUTI4, NONE) \
ENTRY_BINARY_LANE (vluti4q_laneq_##T##16_x2, T##16q, T##16qx2, u8q, \
- UNSPEC_LUTI4)
+ UNSPEC_LUTI4, NONE)
// faminmax
#define REQUIRED_EXTENSIONS nonstreaming_only (AARCH64_FL_FAMINMAX)
-ENTRY_BINARY_VHSDF (vamax, UNSPEC_FAMAX)
-ENTRY_BINARY_VHSDF (vamin, UNSPEC_FAMIN)
+ENTRY_BINARY_VHSDF (vamax, UNSPEC_FAMAX, FP)
+ENTRY_BINARY_VHSDF (vamin, UNSPEC_FAMIN, FP)
#undef REQUIRED_EXTENSIONS
// lut