Integer bitwise rotate miscompilation
averyanalex opened this issue · comments
Alexander Averyanov commented
Expected Behaviour
Bitwise rotating works correctly.
Example & Steps To Reproduce
I was porting SHA512 and this function worked differently on CPU and GPU:
fn big_sigma0(x: u64) -> u64 {
x.rotate_right(28) ^ x.rotate_right(34) ^ x.rotate_right(39)
}
System Info
- Rust: rustc 1.69.0-nightly (44cfafe2f 2023-03-03)
- OS: NixOS Linux 5.15.110
- GPU: AMD Radeon RX 6800 XT
- GPU Driver: amdvlk
- SPIR-V: v2023.2 unknown hash, 1980-01-01T00:00:00 (incorrect time because of NixOS)
Schell Carl Scivally commented
Just FYI the same thing happens with u32
.
Eduard-Mihai Burtescu commented
I think @chrisliebaer just ran into the same issue, and AFAICT it's just this being flipped:
rust-gpu/crates/rustc_codegen_spirv/src/builder/mod.rs
Lines 243 to 247 in e96418f
(based on the name it should clearly be
==
not !=
)