mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
saturating arithmetic builtins: add, sub, mul, shl (#9619)
- adds 1 simple behavior tests for each which does integer and vector ops at runtime and comptime - adds bigint_*_sat() methods for each - use CreateIntrinsic() which accepts a variable number of arguments to pass the scale parameter * update langref - added case to test/compile_errors.zig given floats - explain upstream bug in llvm.smul.fix.sat and link to #9643 in langref and commented out test cases * sat-arithmetic: skip mul tests if arch == .wasm32 because ci is erroring with 'LLVM ERROR: Unable to expand fixed point multiplication' when compiling for wasm32
This commit is contained in:
@@ -8838,4 +8838,12 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"tmp.zig:2:9: note: declared mutable here",
|
||||
"tmp.zig:3:12: note: crosses namespace boundary here",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("Issue #9619: saturating arithmetic builtins should fail to compile when given floats",
|
||||
\\pub fn main() !void {
|
||||
\\ _ = @addWithSaturation(@as(f32, 1.0), @as(f32, 1.0));
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"error: invalid operands to binary expression: 'f32' and 'f32'",
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user