xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/pragma-align-mac68k.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #include <stddef.h>
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc #pragma options align=mac68k
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc typedef float __attribute__((vector_size (8))) v2f_t;
9*f4a2713aSLionel Sambuc typedef float __attribute__((vector_size (16))) v4f_t;
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc extern int a0_0[__alignof(v2f_t) == 8 ? 1 : -1];
12*f4a2713aSLionel Sambuc extern int a0_1[__alignof(v4f_t) == 16 ? 1 : -1];
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc struct s1 {
15*f4a2713aSLionel Sambuc   char f0;
16*f4a2713aSLionel Sambuc   int  f1;
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc extern int a1_0[offsetof(struct s1, f0) == 0 ? 1 : -1];
19*f4a2713aSLionel Sambuc extern int a1_1[offsetof(struct s1, f1) == 2 ? 1 : -1];
20*f4a2713aSLionel Sambuc extern int a1_2[sizeof(struct s1) == 6 ? 1 : -1];
21*f4a2713aSLionel Sambuc extern int a1_3[__alignof(struct s1) == 2 ? 1 : -1];
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc struct s2 {
24*f4a2713aSLionel Sambuc   char f0;
25*f4a2713aSLionel Sambuc   double f1;
26*f4a2713aSLionel Sambuc };
27*f4a2713aSLionel Sambuc extern int a2_0[offsetof(struct s2, f0) == 0 ? 1 : -1];
28*f4a2713aSLionel Sambuc extern int a2_1[offsetof(struct s2, f1) == 2 ? 1 : -1];
29*f4a2713aSLionel Sambuc extern int a2_2[sizeof(struct s2) == 10 ? 1 : -1];
30*f4a2713aSLionel Sambuc extern int a2_3[__alignof(struct s2) == 2 ? 1 : -1];
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc struct s3 {
33*f4a2713aSLionel Sambuc   char f0;
34*f4a2713aSLionel Sambuc   v4f_t f1;
35*f4a2713aSLionel Sambuc };
36*f4a2713aSLionel Sambuc extern int a3_0[offsetof(struct s3, f0) == 0 ? 1 : -1];
37*f4a2713aSLionel Sambuc extern int a3_1[offsetof(struct s3, f1) == 2 ? 1 : -1];
38*f4a2713aSLionel Sambuc extern int a3_2[sizeof(struct s3) == 18 ? 1 : -1];
39*f4a2713aSLionel Sambuc extern int a3_3[__alignof(struct s3) == 2 ? 1 : -1];
40*f4a2713aSLionel Sambuc 
41*f4a2713aSLionel Sambuc struct s4 {
42*f4a2713aSLionel Sambuc   char f0;
43*f4a2713aSLionel Sambuc   char f1;
44*f4a2713aSLionel Sambuc };
45*f4a2713aSLionel Sambuc extern int a4_0[offsetof(struct s4, f0) == 0 ? 1 : -1];
46*f4a2713aSLionel Sambuc extern int a4_1[offsetof(struct s4, f1) == 1 ? 1 : -1];
47*f4a2713aSLionel Sambuc extern int a4_2[sizeof(struct s4) == 2 ? 1 : -1];
48*f4a2713aSLionel Sambuc extern int a4_3[__alignof(struct s4) == 2 ? 1 : -1];
49*f4a2713aSLionel Sambuc 
50*f4a2713aSLionel Sambuc struct s5 {
51*f4a2713aSLionel Sambuc   unsigned f0 : 9;
52*f4a2713aSLionel Sambuc   unsigned f1 : 9;
53*f4a2713aSLionel Sambuc };
54*f4a2713aSLionel Sambuc extern int a5_0[sizeof(struct s5) == 4 ? 1 : -1];
55*f4a2713aSLionel Sambuc extern int a5_1[__alignof(struct s5) == 2 ? 1 : -1];
56*f4a2713aSLionel Sambuc 
57*f4a2713aSLionel Sambuc struct s6 {
58*f4a2713aSLionel Sambuc   unsigned : 0;
59*f4a2713aSLionel Sambuc   unsigned : 0;
60*f4a2713aSLionel Sambuc };
61*f4a2713aSLionel Sambuc extern int a6_0[sizeof(struct s6) == 0 ? 1 : -1];
62*f4a2713aSLionel Sambuc extern int a6_1[__alignof(struct s6) == 2 ? 1 : -1];
63*f4a2713aSLionel Sambuc 
64*f4a2713aSLionel Sambuc struct s7 {
65*f4a2713aSLionel Sambuc   char : 1;
66*f4a2713aSLionel Sambuc   unsigned : 1;
67*f4a2713aSLionel Sambuc };
68*f4a2713aSLionel Sambuc extern int a7_0[sizeof(struct s7) == 2 ? 1 : -1];
69*f4a2713aSLionel Sambuc extern int a7_1[__alignof(struct s7) == 2 ? 1 : -1];
70*f4a2713aSLionel Sambuc 
71*f4a2713aSLionel Sambuc struct s8 {
72*f4a2713aSLionel Sambuc   char f0;
73*f4a2713aSLionel Sambuc   unsigned : 1;
74*f4a2713aSLionel Sambuc };
75*f4a2713aSLionel Sambuc extern int a8_0[sizeof(struct s8) == 2 ? 1 : -1];
76*f4a2713aSLionel Sambuc extern int a8_1[__alignof(struct s8) == 2 ? 1 : -1];
77*f4a2713aSLionel Sambuc 
78*f4a2713aSLionel Sambuc struct s9 {
79*f4a2713aSLionel Sambuc   char f0[3];
80*f4a2713aSLionel Sambuc   unsigned : 0;
81*f4a2713aSLionel Sambuc   char f1;
82*f4a2713aSLionel Sambuc };
83*f4a2713aSLionel Sambuc extern int a9_0[sizeof(struct s9) == 6 ? 1 : -1];
84*f4a2713aSLionel Sambuc extern int a9_1[__alignof(struct s9) == 2 ? 1 : -1];
85*f4a2713aSLionel Sambuc 
86*f4a2713aSLionel Sambuc struct s10 {
87*f4a2713aSLionel Sambuc   char f0;
88*f4a2713aSLionel Sambuc };
89*f4a2713aSLionel Sambuc extern int a10_0[sizeof(struct s10) == 2 ? 1 : -1];
90*f4a2713aSLionel Sambuc extern int a10_1[__alignof(struct s10) == 2 ? 1 : -1];
91*f4a2713aSLionel Sambuc 
92*f4a2713aSLionel Sambuc struct s11 {
93*f4a2713aSLionel Sambuc   char f0;
94*f4a2713aSLionel Sambuc   v2f_t f1;
95*f4a2713aSLionel Sambuc };
96*f4a2713aSLionel Sambuc extern int a11_0[offsetof(struct s11, f0) == 0 ? 1 : -1];
97*f4a2713aSLionel Sambuc extern int a11_1[offsetof(struct s11, f1) == 2 ? 1 : -1];
98*f4a2713aSLionel Sambuc extern int a11_2[sizeof(struct s11) == 10 ? 1 : -1];
99*f4a2713aSLionel Sambuc extern int a11_3[__alignof(struct s11) == 2 ? 1 : -1];
100*f4a2713aSLionel Sambuc 
101*f4a2713aSLionel Sambuc #pragma options align=reset
102*f4a2713aSLionel Sambuc 
f12(void)103*f4a2713aSLionel Sambuc void f12(void) {
104*f4a2713aSLionel Sambuc   #pragma options align=mac68k
105*f4a2713aSLionel Sambuc   struct s12 {
106*f4a2713aSLionel Sambuc     char f0;
107*f4a2713aSLionel Sambuc     int  f1;
108*f4a2713aSLionel Sambuc   };
109*f4a2713aSLionel Sambuc   #pragma options align=reset
110*f4a2713aSLionel Sambuc   extern int a12[sizeof(struct s12) == 6 ? 1 : -1];
111*f4a2713aSLionel Sambuc }
112