-mcpu=cortex-m33 does not set -munaligned-access #59560
Closed
Description
Cortex-M33 is ARMv8-M Mainline, which supports unaligned access unless explicitly disabled. It appears to be correct in ARM.td, but as you can see below the output depends on the flag being explictly passed.
Test case:
int ttt(short a[2], short b[2]) {
return (int)a[0] * (int)b[0] + (int)a[1] * (int)b[1];
}Output with clang --target=arm-none-eabi -mcpu=cortex-m33 -O3 -S -o- testcase.c:
ldrsh.w r2, [r0]
ldrsh.w r0, [r0, #2]
ldrsh.w r3, [r1, #2]
ldrsh.w r1, [r1]
muls r0, r3, r0
smlabb r0, r1, r2, r0
bx lrOutput with clang --target=arm-none-eabi -mcpu=cortex-m33 -munaligned-access -O3 -S -o- testcase.c:
ldr r0, [r0]
ldr r1, [r1]
movs r2, #0
smlad r0, r1, r0, r2
bx lrVersion: Homebrew clang version 15.0.6
Activity