This code: (C Godbolt Zig Godbolt, LLVM Godbolt)
const C: u64 = 1234;
fn foo(a: u64, b: u64, c: u64) u64 {
return (C ^ a) & b & ~c;
}
Compiles to:
foo:
xor rdi, 1234
and rdi, rsi
andn rax, rdx, rdi
ret
Should be:
foo:
xor rdi, 1234
andn rax, rdx, rsi ; Can be done in parallel to xor!
and rax, rdi
ret