Skip to content

Commit dbf847d

Browse files
committed
aarch64: -mstrict-align vs __arm_data512_t [PR113657]
After r14-1187-gd6b756447cd58b, simplify_gen_subreg can return NULL for "unaligned" memory subreg. Since V8DI has an alignment of 8 bytes, using TImode causes simplify_gen_subreg to return NULL. This fixes the issue by using DImode instead for the loop. And then we will have later on the STP/LDP pass combine it back into STP/LDP if needed. Since strict align is less important (usually used for firmware and early boot only), not doing LDP/STP here is ok. Built and tested for aarch64-linux-gnu with no regressions. PR target/113657 gcc/ChangeLog: * config/aarch64/aarch64-simd.md (split for movv8di): For strict aligned mode, use DImode instead of TImode. gcc/testsuite/ChangeLog: * gcc.target/aarch64/acle/ls64_strict_align.c: New test. Signed-off-by: Andrew Pinski <[email protected]>
1 parent cc7aebf commit dbf847d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

gcc/config/aarch64/aarch64-simd.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -8221,14 +8221,17 @@
82218221
|| (memory_operand (operands[0], V8DImode)
82228222
&& register_operand (operands[1], V8DImode)))
82238223
{
8224+
/* V8DI only guarantees 8-byte alignment, whereas TImode requires 16. */
8225+
auto mode = STRICT_ALIGNMENT ? DImode : TImode;
8226+
int increment = GET_MODE_SIZE (mode);
82248227
std::pair<rtx, rtx> last_pair = {};
8225-
for (int offset = 0; offset < 64; offset += 16)
8228+
for (int offset = 0; offset < 64; offset += increment)
82268229
{
82278230
std::pair<rtx, rtx> pair = {
8228-
simplify_gen_subreg (TImode, operands[0], V8DImode, offset),
8229-
simplify_gen_subreg (TImode, operands[1], V8DImode, offset)
8231+
simplify_gen_subreg (mode, operands[0], V8DImode, offset),
8232+
simplify_gen_subreg (mode, operands[1], V8DImode, offset)
82308233
};
8231-
if (register_operand (pair.first, TImode)
8234+
if (register_operand (pair.first, mode)
82328235
&& reg_overlap_mentioned_p (pair.first, pair.second))
82338236
last_pair = pair;
82348237
else
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* { dg-do compile } */
2+
/* { dg-options "-mstrict-align" } */
3+
/* PR target/113657 */
4+
5+
#pragma GCC target "+ls64"
6+
#pragma GCC aarch64 "arm_acle.h"
7+
__arm_data512_t foo(__arm_data512_t* ptr) { return *ptr; }

0 commit comments

Comments
 (0)