Skip to content

sns: disable tree vectorization for Arm MVE GCC builds - #95

Open
vignesh-aerlync wants to merge 1 commit into
google:mainfrom
vignesh-aerlync:fix-cortex-m55-sns-vectorization
Open

vignesh-aerlync wants to merge 1 commit into
google:mainfrom
vignesh-aerlync:fix-cortex-m55-sns-vectorization

Conversation

@vignesh-aerlync

Copy link
Copy Markdown

When compiling src/sns.c at -O3 for Arm Cortex-M55 / Armv8.1-M with Helium/MVE (-mcpu=cortex-m55) using GCC 14 (e.g. arm-none-eabi-gcc or arm-zephyr-eabi-gcc), loop vectorization unrolls the loops in lc3_sns_analyze() and generates floating-point constants in literal pools located farther than the 1020-byte immediate displacement limit for vldr instructions.

This leads to the GNU assembler error:

/tmp/cc...s: Assembler messages:
 /tmp/cc...s:1985: Error: co-processor offset out of range
 /tmp/cc...s:1986: Error: co-processor offset out of range

Solution

Add a targeted #pragma GCC optimize("no-tree-vectorize") inside src/sns.c guarded by (__ARM_FEATURE_MVE & 1) and
defined(GNUC) && !defined(clang).

• Prevents GCC from emitting out-of-range literal pool offsets on Arm MVE targets.
• Preserves full -O3 optimizations across the rest of the file and library.
• Completely inert on non-MVE architectures, Clang builds, and existing x86/ARM platforms.

Fixes #94

At -O3 with GCC 14, loop vectorization in sns.c generates literal pool
constants located farther than the 1020-byte immediate displacement limit
for vldr instructions on Cortex-M55 (Armv8.1-M MVE).

This results in the GNU assembler error:
'Error: co-processor offset out of range'.

Disable tree vectorization specifically for Arm GCC builds with
__ARM_FEATURE_MVE in sns.c to prevent this assembler failure while
preserving -O3 optimization across the rest of the library.

Signed-off-by: Vignesh Pandian <vignesh@aerlync.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cortex-M55: Assembler error "co-processor offset out of range" in sns.c with GCC 14 at -O3

1 participant