authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-27 11:23:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-27 11:23:28-07:00
log1c02e58fc06aa3e429f963e600e126611df3626e
treef19368082978b5004e65707cdf4c60c786617db0
parent21780899eb17a0cb795ff40e5fae6556c38ea13e

Revert "compiler: don't use `@abs` builtin yet"

This reverts commit 21780899eb17a0cb795ff40e5fae6556c38ea13e. After this commit, a version of the compiler which supports the new `@abs` builtin is required.

3 files changed, 9 insertions(+), 9 deletions(-)

src/Sema.zig+1-1
......@@ -37530,7 +37530,7 @@ fn float128IntPartToBigInt(
3753037530 float: f128,
3753137531) !std.math.big.int.Managed {
3753237532 const is_negative = std.math.signbit(float);
37533 const floored = @floor(@fabs(float));
37533 const floored = @floor(@abs(float));
3753437534
3753537535 var rational = try std.math.big.Rational.init(arena);
3753637536 defer rational.q.deinit();
src/arch/x86_64/encoder.zig+2-2
......@@ -105,7 +105,7 @@ pub const Instruction = struct {
105105 try writer.print("{s} ptr [rip", .{@tagName(rip.ptr_size)});
106106 if (rip.disp != 0) try writer.print(" {c} 0x{x}", .{
107107 @as(u8, if (rip.disp < 0) '-' else '+'),
108 std.math.absCast(rip.disp),
108 @abs(rip.disp),
109109 });
110110 try writer.writeByte(']');
111111 },
......@@ -140,7 +140,7 @@ pub const Instruction = struct {
140140 try writer.print(" {c} ", .{@as(u8, if (sib.disp < 0) '-' else '+')})
141141 else if (sib.disp < 0)
142142 try writer.writeByte('-');
143 try writer.print("0x{x}", .{std.math.absCast(sib.disp)});
143 try writer.print("0x{x}", .{@abs(sib.disp)});
144144 any = true;
145145 }
146146
src/value.zig+6-6
......@@ -1989,7 +1989,7 @@ pub const Value = struct {
19891989 return 1;
19901990 }
19911991
1992 const w_value = @fabs(scalar);
1992 const w_value = @abs(scalar);
19931993 return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1;
19941994 }
19951995
......@@ -3741,11 +3741,11 @@ pub const Value = struct {
37413741 .ComptimeFloat, .Float => {
37423742 const target = mod.getTarget();
37433743 const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) {
3744 16 => .{ .f16 = @fabs(val.toFloat(f16, mod)) },
3745 32 => .{ .f32 = @fabs(val.toFloat(f32, mod)) },
3746 64 => .{ .f64 = @fabs(val.toFloat(f64, mod)) },
3747 80 => .{ .f80 = @fabs(val.toFloat(f80, mod)) },
3748 128 => .{ .f128 = @fabs(val.toFloat(f128, mod)) },
3744 16 => .{ .f16 = @abs(val.toFloat(f16, mod)) },
3745 32 => .{ .f32 = @abs(val.toFloat(f32, mod)) },
3746 64 => .{ .f64 = @abs(val.toFloat(f64, mod)) },
3747 80 => .{ .f80 = @abs(val.toFloat(f80, mod)) },
3748 128 => .{ .f128 = @abs(val.toFloat(f128, mod)) },
37493749 else => unreachable,
37503750 };
37513751 return (try mod.intern(.{ .float = .{