diff options
| author | mat <git@matdoes.dev> | 2024-07-01 22:36:40 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-07-01 22:36:40 +0000 |
| commit | 16fc41cedc5f81a4ecba7bfaa9f408d41ca87f62 (patch) | |
| tree | f15ae827a5550c2b90751c0d9ba5cc8c49401431 /compiler/rustc_data_structures | |
| parent | 7b21c18fe4de32a7d2faa468e6ef69abff013f85 (diff) | |
| download | rust-16fc41cedc5f81a4ecba7bfaa9f408d41ca87f62.tar.gz rust-16fc41cedc5f81a4ecba7bfaa9f408d41ca87f62.zip | |
Optimize SipHash by reordering compress instructions
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/sip128.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_data_structures/src/sip128.rs b/compiler/rustc_data_structures/src/sip128.rs index fed23df10dc..812ed410a94 100644 --- a/compiler/rustc_data_structures/src/sip128.rs +++ b/compiler/rustc_data_structures/src/sip128.rs @@ -70,18 +70,19 @@ macro_rules! compress { ($state:expr) => {{ compress!($state.v0, $state.v1, $state.v2, $state.v3) }}; ($v0:expr, $v1:expr, $v2:expr, $v3:expr) => {{ $v0 = $v0.wrapping_add($v1); + $v2 = $v2.wrapping_add($v3); $v1 = $v1.rotate_left(13); $v1 ^= $v0; - $v0 = $v0.rotate_left(32); - $v2 = $v2.wrapping_add($v3); $v3 = $v3.rotate_left(16); $v3 ^= $v2; - $v0 = $v0.wrapping_add($v3); - $v3 = $v3.rotate_left(21); - $v3 ^= $v0; + $v0 = $v0.rotate_left(32); + $v2 = $v2.wrapping_add($v1); + $v0 = $v0.wrapping_add($v3); $v1 = $v1.rotate_left(17); $v1 ^= $v2; + $v3 = $v3.rotate_left(21); + $v3 ^= $v0; $v2 = $v2.rotate_left(32); }}; } |
