- File:
-
- 1 edited
-
tests/array-container/array-md-sbscr-cases.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/array-container/array-md-sbscr-cases.cfa
r938885d3 rb9dae14c 27 27 } 28 28 29 // Work around a compiler optimization that can lead to false failures.30 // Think of `valExpected` as a constant local to each test function.31 // When implemented that way, an optimization, run on some hardware, makes32 // its value be off-by-a-little, compared with the values that have been33 // stored-loaded (in the array under test). This effect has been observed34 // on x86-32 with -O3. Declaring it as below forces the expected value35 // to be stored-loaded too, which keeps the (admittedly lazily done)36 // `assert(f1 == f2)` checks passing, when the intended <w,x,y,z> location37 // is recovered, which is the point of all these tests.38 volatile float valExpected = 0.0;39 40 29 // Tests all the ways to split dimensions into CFA-supported chunks, by the only order that C supports: coarsest to finest stride. 41 30 forall( [Nw], [Nx], [Ny], [Nz] ) … … 47 36 ptrdiff_t iw = 2, ix = 3, iy=4, iz=5; 48 37 49 valExpected = getMagicNumber(iw, ix, iy, iz); 50 float valGot = wxyz[iw][ix][iy][iz]; 51 assert( valGot == valExpected ); 38 const float valExpected = getMagicNumber(iw, ix, iy, iz); 39 assert( wxyz[iw][ix][iy][iz] == valExpected ); 52 40 53 41 // order wxyz, natural split (4-0 or 0-4, no intermediate to declare) … … 98 86 ptrdiff_t iw = 2, ix = 3, iy=4, iz=5; 99 87 100 valExpected = getMagicNumber(iw, ix, iy, iz);88 const float valExpected = getMagicNumber(iw, ix, iy, iz); 101 89 assert( wxyz[iw][ix][iy][iz] == valExpected ); 102 90 … … 120 108 121 109 // order wxzy: wx*z, y 122 #if 0 123 // not working on 32-bit 110 124 111 assert(( wxyz[[iw , ix , all , iz ]][iy ] == valExpected )); 125 112 assert(( wxyz[[iw , ix , all , iz-1]][iy ] != valExpected )); 126 113 assert(( wxyz[[iw , ix , all , iz ]][iy-1] != valExpected )); 127 #endif128 114 } 129 115 … … 141 127 ptrdiff_t iw = 2, ix = 3, iy=4, iz=5; 142 128 143 valExpected = getMagicNumber(iw, ix, iy, iz);129 const float valExpected = getMagicNumber(iw, ix, iy, iz); 144 130 assert( wxyz[iw][ix][iy][iz] == valExpected ); 145 131 … … 237 223 fillHelloData(wxyz); 238 224 239 valExpected = getMagicNumber(2, 3, 4, 5);225 const float valExpected = getMagicNumber(2, 3, 4, 5); 240 226 assert(( wxyz [2] [3] [4] [5] == valExpected )); 241 227 assert(( wxyz[[2, 3]][4] [5] == valExpected ));
Note:
See TracChangeset
for help on using the changeset viewer.