source:
CIVL/examples/omp/simplifier/simd_safelen_ptr.c
| Last change on this file was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 427 bytes | |
| Rev | Line | |
|---|---|---|
| [c5f07b7] | 1 | #include<assert.h> |
| 2 | int main() { | |
| [4501911] | 3 | struct T { |
| 4 | int a[32]; | |
| 5 | int b[16]; | |
| 6 | } t; | |
| [c5f07b7] | 7 | int * p, * q, * r; |
| 8 | ||
| [4501911] | 9 | p = t.a; |
| [c5f07b7] | 10 | q = p + 16; |
| [4501911] | 11 | r = t.b; |
| 12 | #pragma omp simd safelen(8) | |
| [c5f07b7] | 13 | for (int i = 0; i < 8; i++) { |
| [4501911] | 14 | p[i] = 0; |
| [c5f07b7] | 15 | p[i + 8] = 0; |
| 16 | q[i] = 0; | |
| 17 | q[i + 8] = 0; | |
| 18 | r[i] = 0; | |
| 19 | r[i + 8] = 0; | |
| 20 | } | |
| 21 | ||
| 22 | for (int i = 0; i < 32; i++) | |
| [4501911] | 23 | assert(t.a[i] == 0); |
| [c5f07b7] | 24 | for (int i = 0; i < 16; i++) |
| [4501911] | 25 | assert(t.b[i] == 0); |
| [c5f07b7] | 26 | } |
Note:
See TracBrowser
for help on using the repository browser.
