I find godbolt very useful for comparing how different implementations of the same algorithm result in different assembly code. For example:
pub fn range_north(sq: u8) -> impl Iterator<Item = u8> {
(sq..=(sq | 0b111000)).step_by(8)
}
pub fn range_north2(sq: u8) -> impl Iterator<Item = u8> {
let (rk, fl) = (sq / 8, sq % 8);
let n = 8 - rk;
(sq..=63).step_by(8).take(n as usize)
}
gives
example::range_north:
mov rax, rdi
movzx ecx, sil
or sil, 56
movzx edx, sil
shl edx, 8
or edx, ecx
mov word ptr [rdi + 8], dx
mov word ptr [rdi + 10], 256
mov qword ptr [rdi], 7
ret
example::range_north2:
mov rax, rdi
movzx ecx, sil
shr sil, 3
mov dl, 8
sub dl, sil
or ecx, 16128
movzx edx, dl
mov qword ptr [rdi], 7
mov word ptr [rdi + 8], cx
mov word ptr [rdi + 10], 256
mov qword ptr [rdi + 16], rdx
ret
Nothing more. How can I produce this output offline with Rust's command line tools without the boilerplate code and other pieces that don't help me compare generated assembly, like the above?