Loading Single_Core_Optimization/examples/prefetching/ex_1__explicit_prefetching/prefetching.c +2 −2 Changes for Single_Core_Optimization/examples/prefetching/ex_1__explicit_prefetching/prefetching.c: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -119,9 +119,9 @@ int mybsearch ( const int *data, int N, int Key ) int flag = ( data[mid] > Key ) - ( data[mid] < Key ); #if defined(BRANCHLESS) // no branch on the direction: the core cannot guess it and run ahead, // so every level waits for its load (compiles to cmov) // so every level waits for its load (should compile to cmov) if ( flag == 0 ) return mid; int m = -( flag < 0 ); // all 1s if we go right, 0 if we go left int m = -( flag < 0 ); // all 1s if it is right, all 0s if it is left low = ( m & ( mid + 1 ) ) | ( ~m & low ); high = ( m & high ) | ( ~m & ( mid - 1 ) ); #else Loading Loading
Single_Core_Optimization/examples/prefetching/ex_1__explicit_prefetching/prefetching.c +2 −2 Changes for Single_Core_Optimization/examples/prefetching/ex_1__explicit_prefetching/prefetching.c: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -119,9 +119,9 @@ int mybsearch ( const int *data, int N, int Key ) int flag = ( data[mid] > Key ) - ( data[mid] < Key ); #if defined(BRANCHLESS) // no branch on the direction: the core cannot guess it and run ahead, // so every level waits for its load (compiles to cmov) // so every level waits for its load (should compile to cmov) if ( flag == 0 ) return mid; int m = -( flag < 0 ); // all 1s if we go right, 0 if we go left int m = -( flag < 0 ); // all 1s if it is right, all 0s if it is left low = ( m & ( mid + 1 ) ) | ( ~m & low ); high = ( m & high ) | ( ~m & ( mid - 1 ) ); #else Loading