diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-01-27 11:47:52 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-27 11:47:52 -0800 |
| commit | eed3b9567d361941accf0b507dbe83a39b75dffb (patch) | |
| tree | c8e28afae107f714e69e1b021c2f4fefbf829ae0 /lib | |
| parent | df1fa36feb04f932f47ddc5ab7091306e39bcc39 (diff) | |
| parent | 654da648b3af7cbc5e30b6dfec4d7515d047e99b (diff) | |
| download | zig-eed3b9567d361941accf0b507dbe83a39b75dffb.tar.gz zig-eed3b9567d361941accf0b507dbe83a39b75dffb.zip | |
Merge pull request #22610 from jacobly0/x86_64-rewrite
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). |
