diff options
Diffstat (limited to 'src/arch/avx2.h')
| -rw-r--r-- | src/arch/avx2.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/arch/avx2.h b/src/arch/avx2.h index b1a7ab7..8d53f8f 100644 --- a/src/arch/avx2.h +++ b/src/arch/avx2.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #define solved static_cube( \ | 16 | #define solved static_cube( \ |
| 17 | 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) | 17 | 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) |
| 18 | 18 | ||
| 19 | _static void | 19 | STATIC void |
| 20 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) | 20 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) |
| 21 | { | 21 | { |
| 22 | uint8_t aux[32]; | 22 | uint8_t aux[32]; |
| @@ -26,7 +26,7 @@ pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) | |||
| 26 | memcpy(e, aux+16, 12); | 26 | memcpy(e, aux+16, 12); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | _static_inline bool | 29 | STATIC_INLINE bool |
| 30 | equal(cube_t c1, cube_t c2) | 30 | equal(cube_t c1, cube_t c2) |
| 31 | { | 31 | { |
| 32 | int32_t mask; | 32 | int32_t mask; |
| @@ -38,7 +38,7 @@ equal(cube_t c1, cube_t c2) | |||
| 38 | return mask == ~0; | 38 | return mask == ~0; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | _static_inline cube_t | 41 | STATIC_INLINE cube_t |
| 42 | invertco(cube_t c) | 42 | invertco(cube_t c) |
| 43 | { | 43 | { |
| 44 | cube_t co, shleft, shright, summed, newco, cleanco, ret; | 44 | cube_t co, shleft, shright, summed, newco, cleanco, ret; |
| @@ -54,7 +54,7 @@ invertco(cube_t c) | |||
| 54 | return ret; | 54 | return ret; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | _static_inline cube_t | 57 | STATIC_INLINE cube_t |
| 58 | compose_epcpeo(cube_t c1, cube_t c2) | 58 | compose_epcpeo(cube_t c1, cube_t c2) |
| 59 | { | 59 | { |
| 60 | cube_t b, s, eo2; | 60 | cube_t b, s, eo2; |
| @@ -74,13 +74,13 @@ compose_epcpeo(cube_t c1, cube_t c2) | |||
| 74 | return s; | 74 | return s; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | _static_inline cube_t | 77 | STATIC_INLINE cube_t |
| 78 | compose_edges(cube_t c1, cube_t c2) | 78 | compose_edges(cube_t c1, cube_t c2) |
| 79 | { | 79 | { |
| 80 | return compose_epcpeo(c1, c2); | 80 | return compose_epcpeo(c1, c2); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | _static_inline cube_t | 83 | STATIC_INLINE cube_t |
| 84 | compose_corners(cube_t c1, cube_t c2) | 84 | compose_corners(cube_t c1, cube_t c2) |
| 85 | { | 85 | { |
| 86 | /* | 86 | /* |
| @@ -91,7 +91,7 @@ compose_corners(cube_t c1, cube_t c2) | |||
| 91 | return compose(c1, c2); | 91 | return compose(c1, c2); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | _static_inline cube_t | 94 | STATIC_INLINE cube_t |
| 95 | compose(cube_t c1, cube_t c2) | 95 | compose(cube_t c1, cube_t c2) |
| 96 | { | 96 | { |
| 97 | cube_t s, co1, co2, aux, auy1, auy2, auz1, auz2; | 97 | cube_t s, co1, co2, aux, auy1, auy2, auz1, auz2; |
| @@ -114,7 +114,7 @@ compose(cube_t c1, cube_t c2) | |||
| 114 | return s; | 114 | return s; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | _static_inline cube_t | 117 | STATIC_INLINE cube_t |
| 118 | cleanaftershuffle(cube_t c) | 118 | cleanaftershuffle(cube_t c) |
| 119 | { | 119 | { |
| 120 | __m256i b; | 120 | __m256i b; |
| @@ -127,7 +127,7 @@ cleanaftershuffle(cube_t c) | |||
| 127 | return _mm256_andnot_si256(b, c); | 127 | return _mm256_andnot_si256(b, c); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | _static_inline cube_t | 130 | STATIC_INLINE cube_t |
| 131 | inverse(cube_t c) | 131 | inverse(cube_t c) |
| 132 | { | 132 | { |
| 133 | /* Method taken from Andrew Skalski's vcube[1]. The addition sequence | 133 | /* Method taken from Andrew Skalski's vcube[1]. The addition sequence |
| @@ -166,7 +166,7 @@ inverse(cube_t c) | |||
| 166 | return invertco(ret); | 166 | return invertco(ret); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | _static_inline int64_t | 169 | STATIC_INLINE int64_t |
| 170 | coord_co(cube_t c) | 170 | coord_co(cube_t c) |
| 171 | { | 171 | { |
| 172 | cube_t co; | 172 | cube_t co; |
| @@ -182,7 +182,7 @@ coord_co(cube_t c) | |||
| 182 | return ret; | 182 | return ret; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | _static_inline int64_t | 185 | STATIC_INLINE int64_t |
| 186 | coord_csep(cube_t c) | 186 | coord_csep(cube_t c) |
| 187 | { | 187 | { |
| 188 | cube_t cp, shifted; | 188 | cube_t cp, shifted; |
| @@ -195,13 +195,13 @@ coord_csep(cube_t c) | |||
| 195 | return mask & 0x7F; | 195 | return mask & 0x7F; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | _static_inline int64_t | 198 | STATIC_INLINE int64_t |
| 199 | coord_cocsep(cube_t c) | 199 | coord_cocsep(cube_t c) |
| 200 | { | 200 | { |
| 201 | return (coord_co(c) << 7) + coord_csep(c); | 201 | return (coord_co(c) << 7) + coord_csep(c); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | _static_inline int64_t | 204 | STATIC_INLINE int64_t |
| 205 | coord_eo(cube_t c) | 205 | coord_eo(cube_t c) |
| 206 | { | 206 | { |
| 207 | cube_t eo, shifted; | 207 | cube_t eo, shifted; |
| @@ -214,7 +214,7 @@ coord_eo(cube_t c) | |||
| 214 | return mask >> 17; | 214 | return mask >> 17; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | _static_inline int64_t | 217 | STATIC_INLINE int64_t |
| 218 | coord_esep(cube_t c) | 218 | coord_esep(cube_t c) |
| 219 | { | 219 | { |
| 220 | cube_t ep; | 220 | cube_t ep; |
| @@ -229,8 +229,8 @@ coord_esep(cube_t c) | |||
| 229 | for (i = 0, j = 0; i < 12; i++, mem[i/8 + 2] >>= 8) { | 229 | for (i = 0, j = 0; i < 12; i++, mem[i/8 + 2] >>= 8) { |
| 230 | e = mem[i/8 + 2]; | 230 | e = mem[i/8 + 2]; |
| 231 | 231 | ||
| 232 | bit1 = (e & _esepbit1) >> 2; | 232 | bit1 = (e & ESEPBIT_1) >> 2; |
| 233 | bit2 = (e & _esepbit2) >> 3; | 233 | bit2 = (e & ESEPBIT_2) >> 3; |
| 234 | is1 = (1 - bit2) * bit1; | 234 | is1 = (1 - bit2) * bit1; |
| 235 | 235 | ||
| 236 | ret1 += bit2 * binomial[11-i][k]; | 236 | ret1 += bit2 * binomial[11-i][k]; |
| @@ -245,19 +245,19 @@ coord_esep(cube_t c) | |||
| 245 | return ret1 * 70 + ret2; | 245 | return ret1 * 70 + ret2; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | _static_inline void | 248 | STATIC_INLINE void |
| 249 | copy_corners(cube_t *dest, cube_t src) | 249 | copy_corners(cube_t *dest, cube_t src) |
| 250 | { | 250 | { |
| 251 | *dest = _mm256_blend_epi32(*dest, src, 0x0F); | 251 | *dest = _mm256_blend_epi32(*dest, src, 0x0F); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | _static_inline void | 254 | STATIC_INLINE void |
| 255 | copy_edges(cube_t *dest, cube_t src) | 255 | copy_edges(cube_t *dest, cube_t src) |
| 256 | { | 256 | { |
| 257 | *dest = _mm256_blend_epi32(*dest, src, 0xF0); | 257 | *dest = _mm256_blend_epi32(*dest, src, 0xF0); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | _static_inline void | 260 | STATIC_INLINE void |
| 261 | set_eo(cube_t *cube, int64_t eo) | 261 | set_eo(cube_t *cube, int64_t eo) |
| 262 | { | 262 | { |
| 263 | int64_t eo12, eotop, eobot; | 263 | int64_t eo12, eotop, eobot; |
| @@ -282,7 +282,7 @@ set_eo(cube_t *cube, int64_t eo) | |||
| 282 | *cube = _mm256_or_si256(*cube, veo); | 282 | *cube = _mm256_or_si256(*cube, veo); |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | _static_inline cube_t | 285 | 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; |
