Add f64 <-> i64/u64 conversions - #310
Conversation
… and AVX-512 and scalar fallback everywhere else
danderson
left a comment
There was a problem hiding this comment.
Reviewed commit by commit, which makes the refactors easy to reason about because they don't alter codegen output or tests.
| Avx512, | ||
| } | ||
|
|
||
| #[derive(Clone, Copy, PartialEq, Eq)] |
There was a problem hiding this comment.
Maybe Debug too? Only matters for println debugging though.
There was a problem hiding this comment.
It's an internal generator struct, we'll add it when it comes up
| intrinsic_ident("setzero", coarse_type(&target_ty), target_ty.n_bits()); | ||
| let upper_bound = match scalar_bits { | ||
| 32 => quote! { 2147483648.0 }, | ||
| 64 => quote! { 9223372036854775808.0 }, |
There was a problem hiding this comment.
Does this literal survive compilation unchanged? In rust playground, loading it into an f64 rounds it up to 9223372036854776000.0
There was a problem hiding this comment.
That's a formatting artifact, the bitpattern is the same. Try this:
let x = 9223372036854775808.0_f64;
assert_eq!(x.to_bits(), 0x43e0_0000_0000_0000);
assert_eq!(x, 2.0_f64.powi(63));I've added a comment on that, and then looked at it and added comments on the rest of the code as well because if you didn't write it it's probably completely inscrutable
# Conflicts: # fearless_simd_gen/src/mk_simd_types.rs
Part of #297
The combined diff is large but it's not as scary as it looks. This is what this PR does: