]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: Add test cases for PR118591.
authorGeorg-Johann Lay <avr@gjlay.de>
Wed, 22 Jan 2025 11:02:16 +0000 (12:02 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Wed, 22 Jan 2025 11:05:02 +0000 (12:05 +0100)
gcc/testsuite/
PR rtl-optimization/118591
* gcc.target/avr/torture/pr118591-1.c: New test.
* gcc.target/avr/torture/pr118591-2.c: New test.

gcc/testsuite/gcc.target/avr/torture/pr118591-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/pr118591-2.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/avr/torture/pr118591-1.c b/gcc/testsuite/gcc.target/avr/torture/pr118591-1.c
new file mode 100644 (file)
index 0000000..814f041
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do run { target { ! avr_tiny } } } */
+/* { dg-additional-options "-std=c99 -mlra" } */
+
+__attribute__((noipa))
+void func2 (long long a1, long long a2, long b)
+{
+  static unsigned char count = 0;
+  if (b != count++)
+    __builtin_abort ();
+}
+
+int main (void)
+{
+  for (long b = 0; b < 5; ++b)
+    {
+      __asm ("" ::: "r5", "r9", "r24", "r20", "r16", "r12", "r30");
+
+      func2 (0, 0, b);
+    }
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr118591-2.c b/gcc/testsuite/gcc.target/avr/torture/pr118591-2.c
new file mode 100644 (file)
index 0000000..83d3606
--- /dev/null
@@ -0,0 +1,21 @@
+/* Test case failed on avrtiny.  */
+/* { dg-do run } */
+/* { dg-additional-options "-std=c99 -mlra" } */
+
+__attribute__((noipa))
+void func2 (long a, long b)
+{
+  static unsigned char count = 0;
+  if (b != count++)
+    __builtin_abort ();
+}
+
+int main (void)
+{
+  for (long b = 0; b < 5; ++b)
+    {
+      func2 (0, b);
+    }
+
+  return 0;
+}