1 // RUN: %clang_cc1 -emit-llvm < %s -o %t 2 // RUN: grep volatile %t | count 28 3 // RUN: grep memcpy %t | count 7 4 5 // The number 28 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 typedef volatile int volatile_int; 42 volatile_int vtS; 43 main()44int main() { 45 int i; 46 47 // load 48 i=S; 49 i=vS; 50 i=*pS; 51 i=*pvS; 52 i=A[2]; 53 i=vA[2]; 54 i=F.x; 55 i=vF.x; 56 i=F2.x; 57 i=vF2.x; 58 i=vpF2->x; 59 i=F3.x.y; 60 i=vF3.x.y; 61 i=BF.x; 62 i=vBF.x; 63 i=V[3]; 64 i=vV[3]; 65 i=VE.yx[1]; 66 i=vVE.zy[1]; 67 i = aggFct().x; // Note: not volatile 68 i=vtS; 69 70 71 // store 72 S=i; 73 vS=i; 74 *pS=i; 75 *pvS=i; 76 A[2]=i; 77 vA[2]=i; 78 F.x=i; 79 vF.x=i; 80 F2.x=i; 81 vF2.x=i; 82 vpF2->x=i; 83 vF3.x.y=i; 84 BF.x=i; 85 vBF.x=i; 86 V[3]=i; 87 vV[3]=i; 88 vtS=i; 89 90 // other ops: 91 ++S; 92 ++vS; 93 i+=S; 94 i+=vS; 95 ++vtS; 96 (void)vF2; 97 vF2 = vF2; 98 vF2 = vF2 = vF2; 99 vF2 = (vF2, vF2); 100 } 101