libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr68037-3.c
bloba985d26a7be521b71fcde5f151bb5d1f77c32ebc
1 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
2 /* { dg-skip-if "PR81210 sp not aligned to 16 bytes" { *-*-darwin* } } */
3 /* { dg-options "-mgeneral-regs-only" } */
5 #include <stddef.h>
7 extern void exit (int);
9 typedef unsigned int uword_t __attribute__ ((mode (__word__)));
10 typedef int aligned __attribute__((aligned(64)));
12 #define IP 0x12345671
13 #define CS 0x12345672
14 #define FLAGS 0x12345673
15 #define SP 0x12345674
16 #define SS 0x12345675
18 #define STRING(x) XSTRING(x)
19 #define XSTRING(x) #x
20 #define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
21 #define ASMNAME2(prefix, cname) XSTRING (prefix) cname
23 struct interrupt_frame
25 uword_t ip;
26 uword_t cs;
27 uword_t flags;
28 uword_t sp;
29 uword_t ss;
32 int
33 check_int (int *i, int align)
35 *i = 20;
36 if ((((ptrdiff_t) i) & (align - 1)) != 0)
37 __builtin_abort ();
38 return *i;
41 __attribute__((interrupt, used))
42 void
43 fn (struct interrupt_frame *frame)
45 aligned i;
46 if (check_int (&i, __alignof__(i)) != i)
47 __builtin_abort ();
49 if (IP != frame->ip)
50 __builtin_abort ();
51 if (CS != frame->cs)
52 __builtin_abort ();
53 if (FLAGS != frame->flags)
54 __builtin_abort ();
55 if (SP != frame->sp)
56 __builtin_abort ();
57 if (SS != frame->ss)
58 __builtin_abort ();
60 exit (0);
63 int
64 main ()
66 asm ("push $" STRING (SS) "; \
67 push $" STRING (SP) "; \
68 push $" STRING (FLAGS) "; \
69 push $" STRING (CS) "; \
70 push $" STRING (IP) "; \
71 jmp " ASMNAME ("fn"));
72 return 0;