Daniel Dunbar | ed3849b | 2008-11-19 09:36:46 +0000 | [diff] [blame] | 1 | // RUN: clang -emit-llvm < %s | grep volatile | count 25 |
Eli Friedman | 1e692ac | 2008-06-13 23:01:12 +0000 | [diff] [blame] | 2 | |
| 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 | |
| 7 | int S; |
| 8 | volatile int vS; |
| 9 | |
| 10 | int* pS; |
| 11 | volatile int* pvS; |
| 12 | |
| 13 | int A[10]; |
| 14 | volatile int vA[10]; |
| 15 | |
| 16 | struct { int x; } F; |
| 17 | struct { volatile int x; } vF; |
| 18 | |
| 19 | struct { int x; } F2; |
| 20 | volatile struct { int x; } vF2; |
| 21 | volatile struct { int x; } *vpF2; |
| 22 | |
| 23 | struct { struct { int y; } x; } F3; |
| 24 | volatile struct { struct { int y; } x; } vF3; |
| 25 | |
| 26 | struct { int x:3; } BF; |
| 27 | struct { volatile int x:3; } vBF; |
| 28 | |
| 29 | typedef int v4si __attribute__ ((vector_size (16))); |
| 30 | v4si V; |
| 31 | volatile v4si vV; |
| 32 | |
| 33 | typedef __attribute__(( ext_vector_type(4) )) int extv4; |
| 34 | extv4 VE; |
| 35 | volatile extv4 vVE; |
| 36 | |
| 37 | volatile struct {int x;} aggFct(void); |
| 38 | |
| 39 | void 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 Dunbar | ed3849b | 2008-11-19 09:36:46 +0000 | [diff] [blame] | 79 | vBF.x=i; |
Eli Friedman | 1e692ac | 2008-06-13 23:01:12 +0000 | [diff] [blame] | 80 | V[3]=i; |
| 81 | vV[3]=i; |
| 82 | |
| 83 | // other ops: |
| 84 | ++S; |
| 85 | ++vS; |
| 86 | i+=S; |
| 87 | i+=vS; |
| 88 | } |