diff options
| -rw-r--r-- | src/arch/avx2.h | 25 | ||||
| -rw-r--r-- | src/arch/common.h | 28 | ||||
| -rw-r--r-- | src/arch/neon.h | 29 | ||||
| -rw-r--r-- | src/arch/portable.h | 23 |
4 files changed, 35 insertions, 70 deletions
diff --git a/src/arch/avx2.h b/src/arch/avx2.h index 59a0d6c..b1a7ab7 100644 --- a/src/arch/avx2.h +++ b/src/arch/avx2.h | |||
| @@ -286,30 +286,9 @@ _static_inline cube_t | |||
| 286 | invcoord_esep(int64_t esep) | 286 | invcoord_esep(int64_t esep) |
| 287 | { | 287 | { |
| 288 | cube_t eee, ret; | 288 | cube_t eee, ret; |
| 289 | int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1, set1, set2; | 289 | uint8_t mem[32] = {0}; |
| 290 | uint8_t mem[32]; | ||
| 291 | uint8_t slice[3] = {0}; | ||
| 292 | 290 | ||
| 293 | set1 = esep % 70; | 291 | invcoord_esep_array(esep % 70, esep / 70, mem+16); |
| 294 | set2 = esep / 70; | ||
| 295 | |||
| 296 | for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) { | ||
| 297 | v = binomial[11-i][k]; | ||
| 298 | jj = j < 8; | ||
| 299 | w = jj * binomial[7-(j*jj)][l]; | ||
| 300 | bit2 = set2 >= v; | ||
| 301 | bit1 = set1 >= w; | ||
| 302 | is1 = (1 - bit2) * bit1; | ||
| 303 | |||
| 304 | set2 -= bit2 * v; | ||
| 305 | k -= bit2; | ||
| 306 | set1 -= is1 * w; | ||
| 307 | l -= is1; | ||
| 308 | j += (1-bit2); | ||
| 309 | s = 2*bit2 + (1-bit2)*bit1; | ||
| 310 | |||
| 311 | mem[i+16] = (slice[s]++) | (uint8_t)(s << 2); | ||
| 312 | } | ||
| 313 | 292 | ||
| 314 | ret = solved; | 293 | ret = solved; |
| 315 | eee = _mm256_loadu_si256((__m256i_u *)&mem); | 294 | eee = _mm256_loadu_si256((__m256i_u *)&mem); |
diff --git a/src/arch/common.h b/src/arch/common.h index cd2d36e..d8d2305 100644 --- a/src/arch/common.h +++ b/src/arch/common.h | |||
| @@ -17,3 +17,31 @@ _static_inline void copy_corners(cube_t *, cube_t); | |||
| 17 | _static_inline void copy_edges(cube_t *, cube_t); | 17 | _static_inline void copy_edges(cube_t *, cube_t); |
| 18 | _static_inline void set_eo(cube_t *, int64_t); | 18 | _static_inline void set_eo(cube_t *, int64_t); |
| 19 | _static_inline cube_t invcoord_esep(int64_t); | 19 | _static_inline cube_t invcoord_esep(int64_t); |
| 20 | |||
| 21 | _static_inline void invcoord_esep_array(int64_t, int64_t, uint8_t[static 12]); | ||
| 22 | |||
| 23 | _static_inline void | ||
| 24 | invcoord_esep_array(int64_t set1, int64_t set2, uint8_t mem[static 12]) | ||
| 25 | { | ||
| 26 | int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1; | ||
| 27 | uint8_t slice[3] = {0}; | ||
| 28 | |||
| 29 | for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) | ||
| 30 | { | ||
| 31 | v = binomial[11 - i][k]; | ||
| 32 | jj = j < 8; | ||
| 33 | w = jj * binomial[7 - (j * jj)][l]; | ||
| 34 | bit2 = set2 >= v; | ||
| 35 | bit1 = set1 >= w; | ||
| 36 | is1 = (1 - bit2) * bit1; | ||
| 37 | |||
| 38 | set2 -= bit2 * v; | ||
| 39 | k -= bit2; | ||
| 40 | set1 -= is1 * w; | ||
| 41 | l -= is1; | ||
| 42 | j += (1 - bit2); | ||
| 43 | s = 2 * bit2 + (1 - bit2) * bit1; | ||
| 44 | |||
| 45 | mem[i] = (slice[s]++) | (uint8_t)(s << 2); | ||
| 46 | } | ||
| 47 | } | ||
diff --git a/src/arch/neon.h b/src/arch/neon.h index a75f86d..b44664b 100644 --- a/src/arch/neon.h +++ b/src/arch/neon.h | |||
| @@ -316,33 +316,12 @@ _static_inline cube_t | |||
| 316 | invcoord_esep(int64_t esep) | 316 | invcoord_esep(int64_t esep) |
| 317 | { | 317 | { |
| 318 | cube_t ret; | 318 | cube_t ret; |
| 319 | int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1, set1, set2; | 319 | uint8_t mem[16] = {0}; |
| 320 | uint8_t slice[3] = {0}; | ||
| 321 | 320 | ||
| 322 | ret = solved; | 321 | invcoord_esep_array(esep % 70, esep / 70, mem); |
| 323 | uint8_t mem[16]; | ||
| 324 | set1 = esep % 70; | ||
| 325 | set2 = esep / 70; | ||
| 326 | |||
| 327 | for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) | ||
| 328 | { | ||
| 329 | v = binomial[11 - i][k]; | ||
| 330 | jj = j < 8; | ||
| 331 | w = jj * binomial[7 - (j * jj)][l]; | ||
| 332 | bit2 = set2 >= v; | ||
| 333 | bit1 = set1 >= w; | ||
| 334 | is1 = (1 - bit2) * bit1; | ||
| 335 | |||
| 336 | set2 -= bit2 * v; | ||
| 337 | k -= bit2; | ||
| 338 | set1 -= is1 * w; | ||
| 339 | l -= is1; | ||
| 340 | j += (1 - bit2); | ||
| 341 | s = 2 * bit2 + (1 - bit2) * bit1; | ||
| 342 | |||
| 343 | mem[i] = (slice[s]++) | (uint8_t)(s << 2); | ||
| 344 | } | ||
| 345 | 322 | ||
| 323 | ret = solved; | ||
| 346 | ret.edge = vld1q_u8(mem); | 324 | ret.edge = vld1q_u8(mem); |
| 325 | |||
| 347 | return ret; | 326 | return ret; |
| 348 | } | 327 | } |
diff --git a/src/arch/portable.h b/src/arch/portable.h index b8330af..f6e5301 100644 --- a/src/arch/portable.h +++ b/src/arch/portable.h | |||
| @@ -243,30 +243,9 @@ _static_inline cube_t | |||
| 243 | invcoord_esep(int64_t esep) | 243 | invcoord_esep(int64_t esep) |
| 244 | { | 244 | { |
| 245 | cube_t ret; | 245 | cube_t ret; |
| 246 | int64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1, set1, set2; | ||
| 247 | uint8_t slice[3] = {0}; | ||
| 248 | 246 | ||
| 249 | ret = solved; | 247 | ret = solved; |
| 250 | set1 = esep % 70; | 248 | invcoord_esep_array(esep % 70, esep / 70, ret.edge); |
| 251 | set2 = esep / 70; | ||
| 252 | |||
| 253 | for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) { | ||
| 254 | v = binomial[11-i][k]; | ||
| 255 | jj = j < 8; | ||
| 256 | w = jj * binomial[7-(j*jj)][l]; | ||
| 257 | bit2 = set2 >= v; | ||
| 258 | bit1 = set1 >= w; | ||
| 259 | is1 = (1 - bit2) * bit1; | ||
| 260 | |||
| 261 | set2 -= bit2 * v; | ||
| 262 | k -= bit2; | ||
| 263 | set1 -= is1 * w; | ||
| 264 | l -= is1; | ||
| 265 | j += (1-bit2); | ||
| 266 | s = 2*bit2 + (1-bit2)*bit1; | ||
| 267 | |||
| 268 | ret.edge[i] = (slice[s]++) | (uint8_t)(s << 2); | ||
| 269 | } | ||
| 270 | 249 | ||
| 271 | return ret; | 250 | return ret; |
| 272 | } | 251 | } |
