cmake/cxx_tests/restrict_egcs.cpp
raw| 1 | void add(int length,double* __restrict__ a,const double* __restrict__ b,const double* __restrict__ c) { |
| 2 | for (int i=0;i<length;++i) |
| 3 | a[i] = b[i] + c[i]; |
| 4 | } |
| 5 | |
| 6 | int main() { |
| 7 | double a[10], b[10], c[10]; |
| 8 | for (int i=0;i<10;++i) { |
| 9 | a[i] = 0.0; |
| 10 | b[i] = 0.0; |
| 11 | c[i] = 0.0; |
| 12 | } |
| 13 | add(10,a,b,c); |
| 14 | return 0; |
| 15 | } |