[ARM] Fix test armv8_2-fp16-move-1.c
[official-gcc.git] / gcc / testsuite / gcc.target / arm / frame-pointer-1.c
blobbf9b83c1385c67415db78c50f8ce84be97c0763b
1 /* Check local register variables using a register conventionally
2 used as the frame pointer aren't clobbered under high register pressure. */
3 /* { dg-do run } */
4 /* { dg-skip-if "incompatible options" { ! { arm_thumb1_ok || arm_thumb2_ok } } } */
5 /* { dg-options "-Os -mthumb -fomit-frame-pointer" } */
7 #include <stdlib.h>
9 int global=5;
11 void __attribute__((noinline)) foo(int p1, int p2, int p3, int p4)
13 if (global != 5 || p1 != 1 || p2 != 2 || p3 != 3 || p4 != 4)
14 abort();
17 int __attribute__((noinline)) test(int a, int b, int c, int d)
19 register unsigned long r __asm__("r7") = 0xdeadbeef;
20 int e;
22 /* ABCD are live after the call which should be enough
23 to cause r7 to be used if it weren't for the register variable. */
24 foo(a,b,c,d);
26 e = 0;
27 __asm__ __volatile__ ("mov %0, %2"
28 : "=r" (e)
29 : "0" (e), "r" (r));
31 global = a+b+c+d;
33 return e;
36 int main()
38 if (test(1, 2, 3, 4) != 0xdeadbeef)
39 abort();
40 if (global != 10)
41 abort();
42 return 0;