PR c++/67273
[official-gcc.git] / gcc / testsuite / gcc.target / arm / thumb-find-work-register.c
blobe67a627ea314ec340247330fd0e2f4a7a82da298
1 /* Wrong method to get number of arg reg will cause argument corruption. */
2 /* { dg-do run } */
3 /* { dg-skip-if "incompatible options" { ! { arm_thumb1_ok || arm_thumb2_ok } } { "*" } { "" } } */
4 /* { dg-require-effective-target arm_eabi } */
5 /* { dg-options "-mthumb -O1" } */
7 extern void abort (void);
9 int foo (int, int, int, int) __attribute__((noinline));
11 int
12 foo (int a, int b, int c, int d)
14 register int m asm ("r8");
16 m = a;
17 m += b;
18 m += c;
19 m += d;
21 asm ("" : "=r" (m) : "0" (m));
23 return m;
26 int
27 main ()
29 volatile int a = 10;
30 volatile int b = 20;
31 volatile int c = 30;
32 volatile int d = 40;
33 volatile int sum = 0;
35 sum = foo (a, b, c, d);
37 if (sum != 100)
38 abort ();
40 return 0;