1 // RUN: clang-cc -emit-llvm < %s -o %t &&
2 // RUN: grep volatile %t | count 25 &&
3 // RUN: grep memcpy %t | count 7
4 
5 // The number 25 comes from the current codegen for volatile loads;
6 // if this number changes, it's not necessarily something wrong, but
7 // something has changed to affect volatile load/store codegen
8 
9 int S;
10 volatile int vS;
11 
12 int* pS;
13 volatile int* pvS;
14 
15 int A[10];
16 volatile int vA[10];
17 
18 struct { int x; } F;
19 struct { volatile int x; } vF;
20 
21 struct { int x; } F2;
22 volatile struct { int x; } vF2;
23 volatile struct { int x; } *vpF2;
24 
25 struct { struct { int y; } x; } F3;
26 volatile struct { struct { int y; } x; } vF3;
27 
28 struct { int x:3; } BF;
29 struct { volatile int x:3; } vBF;
30 
31 typedef int v4si __attribute__ ((vector_size (16)));
32 v4si V;
33 volatile v4si vV;
34 
35 typedef __attribute__(( ext_vector_type(4) )) int extv4;
36 extv4 VE;
37 volatile extv4 vVE;
38 
39 volatile struct {int x;} aggFct(void);
40 
41 int main() {
42   int i;
43 
44   // load
45   i=S;
46   i=vS;
47   i=*pS;
48   i=*pvS;
49   i=A[2];
50   i=vA[2];
51   i=F.x;
52   i=vF.x;
53   i=F2.x;
54   i=vF2.x;
55   i=vpF2->x;
56   i=F3.x.y;
57   i=vF3.x.y;
58   i=BF.x;
59   i=vBF.x;
60   i=V[3];
61   i=vV[3];
62   i=VE.yx[1];
63   i=vVE.zy[1];
64   i = aggFct().x;
65 
66 
67   // store
68   S=i;
69   vS=i;
70   *pS=i;
71   *pvS=i;
72   A[2]=i;
73   vA[2]=i;
74   F.x=i;
75   vF.x=i;
76   F2.x=i;
77   vF2.x=i;
78   vpF2->x=i;
79   vF3.x.y=i;
80   BF.x=i;
81   vBF.x=i;
82   V[3]=i;
83   vV[3]=i;
84 
85   // other ops:
86   ++S;
87   ++vS;
88   i+=S;
89   i+=vS;
90   (void)vF2;
91   vF2 = vF2;
92   vF2 = vF2 = vF2;
93   vF2 = (vF2, vF2);
94 }
95