[PATCH v2 9/9] aarch64: Handle alignment when it is bigger than BIGGEST_ALIGNMENT
Evgeny Karpov
Evgeny.Karpov@microsoft.com
Fri Sep 6 12:04:32 GMT 2024
In some cases, the alignment can be bigger than BIGGEST_ALIGNMENT.
The issue was detected while building FFmpeg.
It creates structures, most likely for AVX optimization.
For instance:
float __attribute__((aligned (32))) large_aligned_array[3];
BIGGEST_ALIGNMENT could be up to 512 bits on x64.
This patch has been added to cover this case without needing to
change the FFmpeg code.
gcc/ChangeLog:
* config/aarch64/aarch64-coff.h (ASM_OUTPUT_ALIGNED_LOCAL):
Change alignment.
---
gcc/config/aarch64/aarch64-coff.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h
index 17f346fe540..bf8e30b9c08 100644
--- a/gcc/config/aarch64/aarch64-coff.h
+++ b/gcc/config/aarch64/aarch64-coff.h
@@ -58,6 +58,16 @@
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%lu\n", (ROUNDED)))
+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNMENT) \
+ { \
+ unsigned HOST_WIDE_INT rounded = MAX ((SIZE), 1); \
+ unsigned HOST_WIDE_INT alignment = MAX ((ALIGNMENT), BIGGEST_ALIGNMENT); \
+ rounded += (alignment / BITS_PER_UNIT) - 1; \
+ rounded = (rounded / (alignment / BITS_PER_UNIT) \
+ * (alignment / BITS_PER_UNIT)); \
+ ASM_OUTPUT_LOCAL (FILE, NAME, SIZE, rounded); \
+ }
+
#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
fprintf (STREAM, "\t.space\t%d // skip\n", (int) (NBYTES))
--
2.34.1
More information about the Gcc-patches
mailing list