| author | |
| committer | |
| log | 6ec275ebd8fce2e816f3f66e0fec5e53669b96c1 |
| tree | a85c56f7a86c011e0e109f99ef8e56f67de0073f |
| parent | 135a34c9631254d43b37be6c7b41d56669960669 |
3 files changed, 1 insertions(+), 5 deletions(-)
src/Sema.zig+1-1| ... | @@ -13677,7 +13677,7 @@ fn zirShl( | ... | @@ -13677,7 +13677,7 @@ fn zirShl( |
| 13677 | try sema.requireRuntimeBlock(block, src, runtime_src); | 13677 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 13678 | if (block.wantSafety()) { | 13678 | if (block.wantSafety()) { |
| 13679 | const bit_count = scalar_ty.intInfo(zcu).bits; | 13679 | const bit_count = scalar_ty.intInfo(zcu).bits; |
| 13680 | if (!std.math.isPowerOfTwo(bit_count)) { | 13680 | if (air_tag != .shl_sat and !std.math.isPowerOfTwo(bit_count)) { |
| 13681 | const bit_count_val = try pt.intValue(scalar_rhs_ty, bit_count); | 13681 | const bit_count_val = try pt.intValue(scalar_rhs_ty, bit_count); |
| 13682 | const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: { | 13682 | const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: { |
| 13683 | const bit_count_inst = Air.internedToRef((try sema.splat(rhs_ty, bit_count_val)).toIntern()); | 13683 | const bit_count_inst = Air.internedToRef((try sema.splat(rhs_ty, bit_count_val)).toIntern()); |
test/behavior/bit_shifting.zig-2| ... | @@ -170,8 +170,6 @@ test "Saturating Shift Left" { | ... | @@ -170,8 +170,6 @@ test "Saturating Shift Left" { |
| 170 | 170 | ||
| 171 | const S = struct { | 171 | const S = struct { |
| 172 | fn shlSat(x: anytype, y: std.math.Log2Int(@TypeOf(x))) @TypeOf(x) { | 172 | fn shlSat(x: anytype, y: std.math.Log2Int(@TypeOf(x))) @TypeOf(x) { |
| 173 | // workaround https://github.com/ziglang/zig/issues/23033 | ||
| 174 | @setRuntimeSafety(false); | ||
| 175 | return x <<| y; | 173 | return x <<| y; |
| 176 | } | 174 | } |
| 177 | 175 |
test/behavior/x86_64/binary.zig-2| ... | @@ -5473,8 +5473,6 @@ inline fn shlSaturate(comptime Type: type, lhs: Type, rhs: Type) Type { | ... | @@ -5473,8 +5473,6 @@ inline fn shlSaturate(comptime Type: type, lhs: Type, rhs: Type) Type { |
| 5473 | // workaround https://github.com/ziglang/zig/issues/23139 | 5473 | // workaround https://github.com/ziglang/zig/issues/23139 |
| 5474 | return lhs <<| @min(@abs(rhs), splat(ChangeScalar(Type, u64), imax(u64))); | 5474 | return lhs <<| @min(@abs(rhs), splat(ChangeScalar(Type, u64), imax(u64))); |
| 5475 | } | 5475 | } |
| 5476 | // workaround https://github.com/ziglang/zig/issues/23033 | ||
| 5477 | @setRuntimeSafety(false); | ||
| 5478 | return lhs <<| @abs(rhs); | 5476 | return lhs <<| @abs(rhs); |
| 5479 | } | 5477 | } |
| 5480 | test shlSaturate { | 5478 | test shlSaturate { |