xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.arch/i386-sse-stack-align.c (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1 /* Copyright 2012-2023 Free Software Foundation, Inc.
2 
3    This file is part of GDB.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 typedef float V __attribute__((vector_size(16)));
19 
20 static V
21 foo (V a, V b)
22 {
23   return a + b * a;
24 }
25 
26 static __attribute__((noinline, noclone)) int
27 f (void)
28 {
29   volatile V a = { 1, 2, 3, 4 };
30   volatile V b;
31 
32   b = foo (a, a);
33   return b[0];
34 }
35 
36 static __attribute__((noinline, noclone)) int
37 test_g0 (void)
38 {
39   return f ();
40 }
41 
42 static __attribute__((noinline, noclone)) int
43 test_g1 (int p1)
44 {
45   return f ();
46 }
47 
48 static __attribute__((noinline, noclone)) int
49 test_g2 (int p1, int p2)
50 {
51   return f ();
52 }
53 
54 static __attribute__((noinline, noclone)) int
55 test_g3 (int p1, int p2, int p3)
56 {
57   return f ();
58 }
59 
60 static __attribute__((noinline, noclone)) int
61 test_g4 (int p1, int p2, int p3, int p4)
62 {
63   return f ();
64 }
65 
66 int
67 main (void)
68 {
69   return (test_g0 () + test_g1 (1) + test_g2 (1, 2) + test_g3 (1, 2, 3)
70 	  + test_g4 (1, 2, 3, 4);
71 }
72