diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-01-25 15:06:35 -0500 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-01-26 06:58:37 -0500 |
| commit | 0c890bb9a4d6729b10d9f2ebd73269bcd5ac853b (patch) | |
| tree | 82eadbad2b7555f16965d894969ced0091e0dfd0 /lib | |
| parent | 92b20e42162675d35ffd27845e66b0f9213c00c2 (diff) | |
| download | zig-0c890bb9a4d6729b10d9f2ebd73269bcd5ac853b.tar.gz zig-0c890bb9a4d6729b10d9f2ebd73269bcd5ac853b.zip | |
x86_64: rewrite `@min`/`@max` for scalar floats
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/compiler_rt/extendxftf2.zig | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/compiler_rt/extendxftf2.zig b/lib/compiler_rt/extendxftf2.zig index 55324be2b4..8809dbcc80 100644 --- a/lib/compiler_rt/extendxftf2.zig +++ b/lib/compiler_rt/extendxftf2.zig @@ -15,8 +15,6 @@ fn __extendxftf2(a: f80) callconv(.C) f128 { const dst_bits = @bitSizeOf(f128); - const dst_min_normal = @as(u128, 1) << dst_sig_bits; - // Break a into a sign and representation of the absolute value var a_rep = std.math.F80.fromFloat(a); const sign = a_rep.exp & 0x8000; @@ -36,12 +34,7 @@ fn __extendxftf2(a: f80) callconv(.C) f128 { abs_result |= @as(u128, a_rep.exp) << dst_sig_bits; } else { // a is denormal - // renormalize the significand and clear the leading bit and integer part, - // then insert the correct adjusted exponent in the destination type. - const scale: u32 = @clz(a_rep.fraction); - abs_result = @as(u128, a_rep.fraction) << @intCast(dst_sig_bits - src_sig_bits + scale + 1); - abs_result ^= dst_min_normal; - abs_result |= @as(u128, scale + 1) << dst_sig_bits; + abs_result = @as(u128, a_rep.fraction) << (dst_sig_bits - src_sig_bits); } // Apply the signbit to (dst_t)abs(a). |
