Add 32-byte memory alignment check for Arm NEON
ALIGN_SIZE is defined to be 32 bytes in order to accommodate AVX2's
alignment requirements. Arm NEON only requires 16-byte alignment but
software optimizations are possible if 32-byte alignment is assumed
for memory allocated by jmemmgr.c.
This patch introduces a compile-time check to make sure that
ALIGN_SIZE is a multiple of 32 bytes for Arm NEON systems.
Optimizations relying on this assumption for Arm NEON will follow
this CL.
Bug: 922430
Change-Id: I57f349eeffa704ec6c440f356a607964fc4fc8cc
diff --git a/jmemmgr.c b/jmemmgr.c
index 8765bb4..deffc9c 100644
--- a/jmemmgr.c
+++ b/jmemmgr.c
@@ -101,6 +101,10 @@
#endif
#if defined(__AVX2__) && (ALIGN_SIZE % 32)
#error "AVX2 requires 32-byte alignment. ALIGN_SIZE is not a multiple of 32 bytes."
+#elif defined(__ARM_NEON) && (ALIGN_SIZE % 32)
+ /* 32-byte alignment allows us to extract more performance from */
+ /* fancy-upsampling algorithms when using NEON. */
+ #error "NEON optimizations rely on 32-byte alignment. ALIGN_SIZE is not a multiple of 32 bytes."
#endif
#endif