diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-25 11:50:16 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-25 11:50:16 +0200 |
| commit | 43020af69d6932c7af0bc53b59c492775835a14e (patch) | |
| tree | bf6d07a6ff2b5f37734fb1d1311a7468ad5acce9 /src/cube_avx2.h | |
| parent | 0ebba869512abc8e37e461e7587f686fe7c91c6c (diff) | |
| download | nissy-core-43020af69d6932c7af0bc53b59c492775835a14e.tar.gz nissy-core-43020af69d6932c7af0bc53b59c492775835a14e.zip | |
Small performance improvement in h48 coordinate / transform
Diffstat (limited to 'src/cube_avx2.h')
| -rw-r--r-- | src/cube_avx2.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/cube_avx2.h b/src/cube_avx2.h index 934737c..ad4aadb 100644 --- a/src/cube_avx2.h +++ b/src/cube_avx2.h | |||
| @@ -17,6 +17,9 @@ _static cube_t fasttocube(cube_fast_t); | |||
| 17 | _static_inline bool equal_fast(cube_fast_t, cube_fast_t); | 17 | _static_inline bool equal_fast(cube_fast_t, cube_fast_t); |
| 18 | _static_inline bool issolved_fast(cube_fast_t); | 18 | _static_inline bool issolved_fast(cube_fast_t); |
| 19 | _static_inline cube_fast_t invertco_fast(cube_fast_t); | 19 | _static_inline cube_fast_t invertco_fast(cube_fast_t); |
| 20 | _static_inline cube_fast_t compose_epcpeo(cube_fast_t, cube_fast_t); | ||
| 21 | _static_inline cube_fast_t compose_fast_edges(cube_fast_t, cube_fast_t); | ||
| 22 | _static_inline cube_fast_t compose_fast_corners(cube_fast_t, cube_fast_t); | ||
| 20 | _static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t); | 23 | _static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t); |
| 21 | 24 | ||
| 22 | _static_inline int64_t coord_fast_co(cube_fast_t); | 25 | _static_inline int64_t coord_fast_co(cube_fast_t); |
| @@ -123,9 +126,9 @@ invertco_fast(cube_fast_t c) | |||
| 123 | } | 126 | } |
| 124 | 127 | ||
| 125 | _static_inline cube_fast_t | 128 | _static_inline cube_fast_t |
| 126 | compose_fast(cube_fast_t c1, cube_fast_t c2) | 129 | compose_epcpeo(cube_fast_t c1, cube_fast_t c2) |
| 127 | { | 130 | { |
| 128 | cube_fast_t s, b, eo2, co1, co2, aux, auy1, auy2, auz1, auz2; | 131 | cube_fast_t b, s, eo2; |
| 129 | 132 | ||
| 130 | /* Permute and clean unused bits */ | 133 | /* Permute and clean unused bits */ |
| 131 | s = _mm256_shuffle_epi8(c1, c2); | 134 | s = _mm256_shuffle_epi8(c1, c2); |
| @@ -139,6 +142,33 @@ compose_fast(cube_fast_t c1, cube_fast_t c2) | |||
| 139 | eo2 = _mm256_and_si256(c2, _eo_avx2); | 142 | eo2 = _mm256_and_si256(c2, _eo_avx2); |
| 140 | s = _mm256_xor_si256(s, eo2); | 143 | s = _mm256_xor_si256(s, eo2); |
| 141 | 144 | ||
| 145 | return s; | ||
| 146 | } | ||
| 147 | |||
| 148 | _static_inline cube_fast_t | ||
| 149 | compose_fast_edges(cube_fast_t c1, cube_fast_t c2) | ||
| 150 | { | ||
| 151 | return compose_epcpeo(c1, c2); | ||
| 152 | } | ||
| 153 | |||
| 154 | _static_inline cube_fast_t | ||
| 155 | compose_fast_corners(cube_fast_t c1, cube_fast_t c2) | ||
| 156 | { | ||
| 157 | /* | ||
| 158 | * We do a full compose. Minor optimizations are possible, like | ||
| 159 | * saving one instruction by not doing EO, but it should not | ||
| 160 | * be significant. | ||
| 161 | */ | ||
| 162 | return compose_fast(c1, c2); | ||
| 163 | } | ||
| 164 | |||
| 165 | _static_inline cube_fast_t | ||
| 166 | compose_fast(cube_fast_t c1, cube_fast_t c2) | ||
| 167 | { | ||
| 168 | cube_fast_t s, co1, co2, aux, auy1, auy2, auz1, auz2; | ||
| 169 | |||
| 170 | s = compose_epcpeo(c1, c2); | ||
| 171 | |||
| 142 | /* Change CO */ | 172 | /* Change CO */ |
| 143 | co1 = _mm256_and_si256(s, _co2_avx2); | 173 | co1 = _mm256_and_si256(s, _co2_avx2); |
| 144 | co2 = _mm256_and_si256(c2, _co2_avx2); | 174 | co2 = _mm256_and_si256(c2, _co2_avx2); |
