This fixes an unrecognizable insn ICE when alignments >= 128
were passed from setmemhi to clrmemqi*. Alignment is unused,
hence set it to 0 so that the patterns match for big alignments.
Johann
---
AVR: target/85624 - Fix non-matching alignment in clrmem* insns.
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.
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 84dfe4c40ec..359343e563d 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -1355,6 +1355,8 @@ (define_expand "setmemhi"
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
index 00000000000..b183d4558df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr85624.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+int foo (void)
+{
+ volatile int arr[3] __attribute__((aligned(128))) = { 0 };
+ return arr[2];
+}