@@ -259,6 +259,8 @@ static bool arm_array_mode_supported_p (
unsigned HOST_WIDE_INT);
static enum machine_mode arm_preferred_simd_mode (enum machine_mode);
static bool arm_class_likely_spilled_p (reg_class_t);
+static HOST_WIDE_INT arm_vector_alignment (const_tree type,
+ HOST_WIDE_INT align);
static bool arm_vector_alignment_reachable (const_tree type, bool is_packed);
static bool arm_builtin_support_vector_misalignment (enum machine_mode mode,
const_tree type,
@@ -607,6 +609,9 @@ static const struct attribute_spec arm_a
#undef TARGET_CLASS_LIKELY_SPILLED_P
#define TARGET_CLASS_LIKELY_SPILLED_P arm_class_likely_spilled_p
+#undef TARGET_VECTOR_ALIGNMENT
+#define TARGET_VECTOR_ALIGNMENT arm_vector_alignment
+
#undef TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
#define TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE \
arm_vector_alignment_reachable
@@ -24850,6 +25292,15 @@ arm_have_conditional_execution (void)
return !TARGET_THUMB1;
}
+/* The AAPCS sets the maximum alignment of a vector to 64 bits. */
+static HOST_WIDE_INT
+arm_vector_alignment (const_tree type ATTRIBUTE_UNUSED, HOST_WIDE_INT align)
+{
+ if (TARGET_AAPCS_BASED)
+ return MIN (align, 64);
+ return align;
+}
+
static unsigned int
arm_autovectorize_vector_sizes (void)
{
@@ -1099,6 +1099,12 @@ make it all fit in fewer cache lines.
If the value of this macro has a type, it should be an unsigned type.
@end defmac
+@deftypefn {Target Hook} HOST_WIDE_INT TARGET_VECTOR_ALIGNMENT (const_tree @var{type}, HOST_WIDE_INT @var{align})
+This hook can be used to limit the alignment for a vector of type
+@var{type}, in order to comply with a platform ABI. The default is to
+return @var{align}.
+@end deftypefn
+
@defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align})
If defined, a C expression to compute the alignment for stack slot.
@var{type} is the data type, @var{mode} is the widest mode available,
@@ -1087,6 +1087,8 @@ make it all fit in fewer cache lines.
If the value of this macro has a type, it should be an unsigned type.
@end defmac
+@hook TARGET_VECTOR_ALIGNMENT
+
@defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align})
If defined, a C expression to compute the alignment for stack slot.
@var{type} is the data type, @var{mode} is the widest mode available,
@@ -1615,6 +1615,14 @@ DEFHOOK
bool, (enum machine_mode mode),
hook_bool_mode_false)
+DEFHOOK
+(vector_alignment,
+ "This hook can be used to limit the alignment for a vector of type\n\
+@var{type}, in order to comply with a platform ABI. The default is to\n\
+return @var{align}.",
+ HOST_WIDE_INT, (const_tree type, HOST_WIDE_INT align),
+ default_vector_alignment)
+
/* True if we should try to use a scalar mode to represent an array,
overriding the usual MAX_FIXED_MODE limit. */
DEFHOOK
@@ -939,6 +939,13 @@ tree default_mangle_decl_assembler_name
return id;
}
+HOST_WIDE_INT
+default_vector_alignment (const_tree type ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT align)
+{
+ return align;
+}
+
bool
default_builtin_vector_alignment_reachable (const_tree type, bool is_packed)
{