Vectorizer generates unaligned access when -mno-unaligned-access is enabled
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro GCC |
Fix Committed
|
Undecided
|
Kugan Vivekanandarajah |
Bug Description
I have recently ran into a problem after trying to simultaneously enable
both -mno-unaligned-
$ arm-v7a15v5r0-
$ scp a.out root@myboard:/
and then on target board:
# /a.out
Bus error
The error is caused by unaligned vector load via two vldr instructions:
$ cat repro.s
...
.L3:
vldr d16, [r3, #-16]
vldr d17, [r3, #-8]
...
After some investigation I found possible source of this bug in ARM backend.
It looks that even if -mno-unaligned-
vectorizer that it supports misaligned accesses
via TARGET_
expands to arm_builtin_
At the same time backend will disable RTL patterns to handle misaligned
acceses in neon.md:
(define_expand "movmisalign<mode>"
...
"TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access"
(note the "&& unaligned_access" part).
This will force vectorizer to generated an unaligned vector load
which will be handled by standard "neon_mov<mode>" pattern.
This pattern will generate erroneous vldr instructions (in output_move_neon).
The relevant code (arm_builtin_
has not changed in 4.9 so it probably makes sense to fix this directly in 4.9.
Changed in gcc-linaro: | |
assignee: | nobody → Kugan Vivekanandarajah (kugan-vivekanandarajah) |
Changed in gcc-linaro: | |
status: | New → Fix Committed |
Re-attaching patch in unified diff format.