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