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(...@@ -37530,7 +37530,7 @@ fn float128IntPartToBigInt(
37530 float: f128,37530 float: f128,
37531) !std.math.big.int.Managed {37531) !std.math.big.int.Managed {
37532 const is_negative = std.math.signbit(float);37532 const is_negative = std.math.signbit(float);
37533 const floored = @floor(@fabs(float));37533 const floored = @floor(@abs(float));
3753437534
37535 var rational = try std.math.big.Rational.init(arena);37535 var rational = try std.math.big.Rational.init(arena);
37536 defer rational.q.deinit();37536 defer rational.q.deinit();
src/arch/x86_64/encoder.zig+2-2
...@@ -105,7 +105,7 @@ pub const Instruction = struct {...@@ -105,7 +105,7 @@ pub const Instruction = struct {
105 try writer.print("{s} ptr [rip", .{@tagName(rip.ptr_size)});105 try writer.print("{s} ptr [rip", .{@tagName(rip.ptr_size)});
106 if (rip.disp != 0) try writer.print(" {c} 0x{x}", .{106 if (rip.disp != 0) try writer.print(" {c} 0x{x}", .{
107 @as(u8, if (rip.disp < 0) '-' else '+'),107 @as(u8, if (rip.disp < 0) '-' else '+'),
108 std.math.absCast(rip.disp),108 @abs(rip.disp),
109 });109 });
110 try writer.writeByte(']');110 try writer.writeByte(']');
111 },111 },
...@@ -140,7 +140,7 @@ pub const Instruction = struct {...@@ -140,7 +140,7 @@ pub const Instruction = struct {
140 try writer.print(" {c} ", .{@as(u8, if (sib.disp < 0) '-' else '+')})140 try writer.print(" {c} ", .{@as(u8, if (sib.disp < 0) '-' else '+')})
141 else if (sib.disp < 0)141 else if (sib.disp < 0)
142 try writer.writeByte('-');142 try writer.writeByte('-');
143 try writer.print("0x{x}", .{std.math.absCast(sib.disp)});143 try writer.print("0x{x}", .{@abs(sib.disp)});
144 any = true;144 any = true;
145 }145 }
146146
src/value.zig+6-6
...@@ -1989,7 +1989,7 @@ pub const Value = struct {...@@ -1989,7 +1989,7 @@ pub const Value = struct {
1989 return 1;1989 return 1;
1990 }1990 }
19911991
1992 const w_value = @fabs(scalar);1992 const w_value = @abs(scalar);
1993 return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1;1993 return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1;
1994 }1994 }
19951995
...@@ -3741,11 +3741,11 @@ pub const Value = struct {...@@ -3741,11 +3741,11 @@ pub const Value = struct {
3741 .ComptimeFloat, .Float => {3741 .ComptimeFloat, .Float => {
3742 const target = mod.getTarget();3742 const target = mod.getTarget();
3743 const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) {3743 const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) {
3744 16 => .{ .f16 = @fabs(val.toFloat(f16, mod)) },3744 16 => .{ .f16 = @abs(val.toFloat(f16, mod)) },
3745 32 => .{ .f32 = @fabs(val.toFloat(f32, mod)) },3745 32 => .{ .f32 = @abs(val.toFloat(f32, mod)) },
3746 64 => .{ .f64 = @fabs(val.toFloat(f64, mod)) },3746 64 => .{ .f64 = @abs(val.toFloat(f64, mod)) },
3747 80 => .{ .f80 = @fabs(val.toFloat(f80, mod)) },3747 80 => .{ .f80 = @abs(val.toFloat(f80, mod)) },
3748 128 => .{ .f128 = @fabs(val.toFloat(f128, mod)) },3748 128 => .{ .f128 = @abs(val.toFloat(f128, mod)) },
3749 else => unreachable,3749 else => unreachable,
3750 };3750 };
3751 return (try mod.intern(.{ .float = .{3751 return (try mod.intern(.{ .float = .{