annotate gcc/testsuite/gcc.dg/torture/pr25967-2.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
2 /* { dg-skip-if "PR81693 sp not aligned to 16 bytes" { "*-*-darwin*" } } */
111
kono
parents:
diff changeset
3 /* { dg-options "-mgeneral-regs-only" } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 extern void exit (int);
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 typedef unsigned int uword_t __attribute__ ((mode (__word__)));
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 #define IP 0x12345671
kono
parents:
diff changeset
10 #define CS 0x12345672
kono
parents:
diff changeset
11 #define FLAGS 0x12345673
kono
parents:
diff changeset
12 #define SP 0x12345674
kono
parents:
diff changeset
13 #define SS 0x12345675
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 #define STRING(x) XSTRING(x)
kono
parents:
diff changeset
16 #define XSTRING(x) #x
kono
parents:
diff changeset
17 #define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname)
kono
parents:
diff changeset
18 #define ASMNAME2(prefix, cname) XSTRING (prefix) cname
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 struct interrupt_frame
kono
parents:
diff changeset
21 {
kono
parents:
diff changeset
22 uword_t ip;
kono
parents:
diff changeset
23 uword_t cs;
kono
parents:
diff changeset
24 uword_t flags;
kono
parents:
diff changeset
25 uword_t sp;
kono
parents:
diff changeset
26 uword_t ss;
kono
parents:
diff changeset
27 };
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 __attribute__((naked, used))
kono
parents:
diff changeset
30 void
kono
parents:
diff changeset
31 fn (void)
kono
parents:
diff changeset
32 {
kono
parents:
diff changeset
33 register uword_t *sp __asm__("sp");
kono
parents:
diff changeset
34 struct interrupt_frame *frame = (struct interrupt_frame *) sp;
kono
parents:
diff changeset
35 if (IP != frame->ip) /* BREAK */
kono
parents:
diff changeset
36 __builtin_abort ();
kono
parents:
diff changeset
37 if (CS != frame->cs)
kono
parents:
diff changeset
38 __builtin_abort ();
kono
parents:
diff changeset
39 if (FLAGS != frame->flags)
kono
parents:
diff changeset
40 __builtin_abort ();
kono
parents:
diff changeset
41 if (SP != frame->sp)
kono
parents:
diff changeset
42 __builtin_abort ();
kono
parents:
diff changeset
43 if (SS != frame->ss)
kono
parents:
diff changeset
44 __builtin_abort ();
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 exit (0);
kono
parents:
diff changeset
47 }
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 int
kono
parents:
diff changeset
50 main ()
kono
parents:
diff changeset
51 {
kono
parents:
diff changeset
52 asm ("push $" STRING (SS) "; \
kono
parents:
diff changeset
53 push $" STRING (SP) "; \
kono
parents:
diff changeset
54 push $" STRING (FLAGS) "; \
kono
parents:
diff changeset
55 push $" STRING (CS) "; \
kono
parents:
diff changeset
56 push $" STRING (IP) "; \
kono
parents:
diff changeset
57 jmp " ASMNAME ("fn"));
kono
parents:
diff changeset
58 return 0;
kono
parents:
diff changeset
59 }