]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: target/85624 - Fix non-matching alignment in clrmem* insns.
authorGeorg-Johann Lay <avr@gjlay.de>
Mon, 12 Aug 2024 12:39:24 +0000 (14:39 +0200)
committerGeorg-Johann Lay <avr@gjlay.de>
Mon, 12 Aug 2024 12:52:19 +0000 (14:52 +0200)
The clrmem* patterns don't use the provided alignment information,
hence the setmemhi expander can just pass down 0 as alignment to
the clrmem* insns.

PR target/85624
gcc/
* config/avr/avr.md (setmemhi): Set alignment to 0.

gcc/testsuite/
* gcc.target/avr/torture/pr85624.c: New test.

gcc/config/avr/avr.md
gcc/testsuite/gcc.target/avr/torture/pr85624.c [new file with mode: 0644]

index 84dfe4c40ecf86e0c6cb5febb69e6565d654858c..359343e563d5d72ac682747b553047546f755710 100644 (file)
                                     gen_int_mode (INTVAL (operands[1]), mode));
     rtx addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
     operands[0] = gen_rtx_MEM (BLKmode, addr0);
+    // Alignment is unused; just set it to 0.
+    operands[3] = const0_rtx;
   })
 
 
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr85624.c b/gcc/testsuite/gcc.target/avr/torture/pr85624.c
new file mode 100644 (file)
index 0000000..b183d45
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+int foo (void)
+{
+  volatile int arr[3] __attribute__((aligned(128))) = { 0 };
+  return arr[2];
+}