Debian Codegraph @

gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c

raw
1 /* PR middle-end/37009 */
2 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
3 /* { dg-additional-options "-mmmx -msse2" } */
4 /* { dg-require-effective-target sse2_runtime } */
5
6 #include <emmintrin.h>
7 #include "check.h"
8
9 #ifndef ALIGNMENT
10 #define ALIGNMENT 16
11 #endif
12
13 typedef int aligned __attribute__((aligned(ALIGNMENT)));
14
15 void
16 bar (char *p, int size)
17 {
18 __builtin_strncpy (p, "good", size);
19 }
20
21 void
22 __attribute__ ((noinline))
23 foo (__m128 x, __m128 y ,__m128 z , int size)
24 {
25 char *p = __builtin_alloca (size + 1);
26 aligned i;
27
28 bar (p, size);
29 if (__builtin_strncmp (p, "good", size) != 0)
30 {
31 #ifdef DEBUG
32 p[size] = '\0';
33 printf ("Failed: %s != good\n", p);
34 #endif
35 abort ();
36 }
37
38 if (check_int (&i, __alignof__(i)) != i)
39 abort ();
40 }
41
42 int
43 main (void)
44 {
45 __m128 x = { 1.0 };
46 foo (x, x, x, 5);
47
48 return 0;
49 }