diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-09-27 11:23:28 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-09-27 11:23:28 -0700 |
| commit | 1c02e58fc06aa3e429f963e600e126611df3626e (patch) | |
| tree | f19368082978b5004e65707cdf4c60c786617db0 /src | |
| parent | 21780899eb17a0cb795ff40e5fae6556c38ea13e (diff) | |
| download | zig-1c02e58fc06aa3e429f963e600e126611df3626e.tar.gz zig-1c02e58fc06aa3e429f963e600e126611df3626e.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 2 | ||||
| -rw-r--r-- | src/arch/x86_64/encoder.zig | 4 | ||||
| -rw-r--r-- | src/value.zig | 12 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 9dd7b1598e..963f7f5489 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -37530,7 +37530,7 @@ fn float128IntPartToBigInt( float: f128, ) !std.math.big.int.Managed { const is_negative = std.math.signbit(float); - const floored = @floor(@fabs(float)); + const floored = @floor(@abs(float)); var rational = try std.math.big.Rational.init(arena); defer rational.q.deinit(); diff --git a/src/arch/x86_64/encoder.zig b/src/arch/x86_64/encoder.zig index bc4c59dc86..0923a43a77 100644 --- a/src/arch/x86_64/encoder.zig +++ b/src/arch/x86_64/encoder.zig @@ -105,7 +105,7 @@ pub const Instruction = struct { try writer.print("{s} ptr [rip", .{@tagName(rip.ptr_size)}); if (rip.disp != 0) try writer.print(" {c} 0x{x}", .{ @as(u8, if (rip.disp < 0) '-' else '+'), - std.math.absCast(rip.disp), + @abs(rip.disp), }); try writer.writeByte(']'); }, @@ -140,7 +140,7 @@ pub const Instruction = struct { try writer.print(" {c} ", .{@as(u8, if (sib.disp < 0) '-' else '+')}) else if (sib.disp < 0) try writer.writeByte('-'); - try writer.print("0x{x}", .{std.math.absCast(sib.disp)}); + try writer.print("0x{x}", .{@abs(sib.disp)}); any = true; } diff --git a/src/value.zig b/src/value.zig index 217430a830..85b49f3e15 100644 --- a/src/value.zig +++ b/src/value.zig @@ -1989,7 +1989,7 @@ pub const Value = struct { return 1; } - const w_value = @fabs(scalar); + const w_value = @abs(scalar); return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1; } @@ -3741,11 +3741,11 @@ pub const Value = struct { .ComptimeFloat, .Float => { const target = mod.getTarget(); const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) { - 16 => .{ .f16 = @fabs(val.toFloat(f16, mod)) }, - 32 => .{ .f32 = @fabs(val.toFloat(f32, mod)) }, - 64 => .{ .f64 = @fabs(val.toFloat(f64, mod)) }, - 80 => .{ .f80 = @fabs(val.toFloat(f80, mod)) }, - 128 => .{ .f128 = @fabs(val.toFloat(f128, mod)) }, + 16 => .{ .f16 = @abs(val.toFloat(f16, mod)) }, + 32 => .{ .f32 = @abs(val.toFloat(f32, mod)) }, + 64 => .{ .f64 = @abs(val.toFloat(f64, mod)) }, + 80 => .{ .f80 = @abs(val.toFloat(f80, mod)) }, + 128 => .{ .f128 = @abs(val.toFloat(f128, mod)) }, else => unreachable, }; return (try mod.intern(.{ .float = .{ |
