summaryrefslogtreecommitdiff
path: root/jmemmgr.c
diff options
context:
space:
mode:
authorJonathan Wright <jonathan.wright@arm.com>2019-05-30 14:48:11 +0100
committerJonathan Wright <jonathan.wright@arm.com>2019-05-30 16:36:19 +0100
commit0aabb3f90fc8f4e477609a2c15d18804f14fb218 (patch)
treee46245212bea0faca979fab18d23d0f0e1c84b6f /jmemmgr.c
parentfdcaeede1eae1dc9898212fdb963b0ae98ec43c8 (diff)
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
Diffstat (limited to 'jmemmgr.c')
-rw-r--r--jmemmgr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/jmemmgr.c b/jmemmgr.c
index 8765bb4..deffc9c 100644
--- a/jmemmgr.c
+++ b/jmemmgr.c
@@ -101,6 +101,10 @@ round_up_pow2(size_t a, size_t b)
#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