Debian Codegraph @

gcc/testsuite/gcc.dg/torture/stackalign/regparm-1.c

raw
1 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
2
3 #include "check.h"
4
5 #ifndef ALIGNMENT
6 #define ALIGNMENT 64
7 #endif
8
9 typedef int aligned __attribute__((aligned(ALIGNMENT)));
10
11 int test_nested (int i)
12 {
13 aligned y;
14
15 int __attribute__ ((__noinline__, __regparm__(2))) foo (int j, int k, int l)
16 {
17 aligned x;
18
19 if (check_int (&x, __alignof__(x)) != x)
20 abort ();
21
22 if (x != 20)
23 abort ();
24
25 return i + j + k + l;
26 }
27
28 if (check_int (&y, __alignof__(y)) != y)
29 abort ();
30
31 if (y != 20)
32 abort ();
33
34 return foo(i, i+1, i+2) * i;
35 }
36
37 int __attribute__ ((__noinline__, __regparm__(3), __force_align_arg_pointer__))
38 test_realigned (int j, int k, int l)
39 {
40 aligned y;
41
42 if (check_int (&y, __alignof__(y)) != y)
43 abort ();
44
45 if (y != 20)
46 abort ();
47
48 return j + k + l;
49 }
50
51 int main ()
52 {
53 if (test_nested(10) != 430)
54 abort ();
55
56 if (test_realigned(10, 11, 12) != 33)
57 abort ();
58
59 return 0;
60 }