diff --git a/mlx/backend/cpu/unary_ops.h b/mlx/backend/cpu/unary_ops.h index e30b86d83..1d8c0a457 100644 --- a/mlx/backend/cpu/unary_ops.h +++ b/mlx/backend/cpu/unary_ops.h @@ -122,7 +122,9 @@ struct ToFP8 { Simd operator()(Simd f) { uint32_t fp8_max = 1087 << 20; auto denorm_mask = Simd(141 << 23); - auto f_bits = fp32_to_bits(Simd(f)); + Simd f_bits; + Simd f32 = f; + f_bits = fp32_to_bits(f32); Simd result = 0u; auto sign = f_bits & 0x80000000; f_bits = f_bits ^ sign;