-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
saturating arithmetic builtins: add, sub, mul, shl #9619
Commits on Aug 29, 2021
-
saturating arithmetic builtins: add, sub, mul, shl
- adds 1 simple behavior tests for each which does integer and vector ops at runtime and comptime - adds bigint_*_sat() methods for each which simply set dest to the type min/max boundaries if they are exceeded. these should to be audited for correctness and perhaps there is a better existing way to accomplish this. - the mul intrinsic needs to somehow explicitly provide a scale parameter (which seems to default to 0?)
Configuration menu - View commit details
-
Copy full SHA for 63ef1db - Browse repository at this point
Copy the full SHA 63ef1dbView commit details -
bigint saturation: compute bits required
- rather than initializing new integers for min/max, compute the number of bits required using bigint_bits_needed(). NOTE: this doesn't allow for types larger than 64 bits. - rename bigint_saturate() -> bigint_clamp_by_bitcount() - adds a few more test cases
Configuration menu - View commit details
-
Copy full SHA for 69e64bf - Browse repository at this point
Copy the full SHA 69e64bfView commit details -
zig_llvm: pass scale = 0 to mul_fix_sat intrinsics
- use CreateIntrinsic() which accepts a variable number of arguments to pass the scale parameter
Configuration menu - View commit details
-
Copy full SHA for bf33759 - Browse repository at this point
Copy the full SHA bf33759View commit details -
Configuration menu - View commit details
-
Copy full SHA for b18d436 - Browse repository at this point
Copy the full SHA b18d436View commit details -
simplify bigint_clamp_by_bitcount()
- rather than re-initializing, we only need to shift the least significant digit right by the number of 'extra' bits
Configuration menu - View commit details
-
Copy full SHA for 1a4d70a - Browse repository at this point
Copy the full SHA 1a4d70aView commit details -
rework bigint_clamp_by_bitcount() again
- works for ints > 64 bits - add a few more test cases for ints > 64 bits
Configuration menu - View commit details
-
Copy full SHA for db389ce - Browse repository at this point
Copy the full SHA db389ceView commit details -
clean up bigint_clamp_by_bitcount()
- move bound computations closer to usage within cases - rename op -> dest for consistency
Configuration menu - View commit details
-
Copy full SHA for 0b74123 - Browse repository at this point
Copy the full SHA 0b74123View commit details -
sat-arithmetic: add more test cases
- adds more test cases suggested by matu3ba - better explain clamping algorithm in comments
Configuration menu - View commit details
-
Copy full SHA for 6b6c63a - Browse repository at this point
Copy the full SHA 6b6c63aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 437fba2 - Browse repository at this point
Copy the full SHA 437fba2View commit details -
sat-arithmetic: make tests actually run at runtime
- rework test cases which were skipping runtime evaluation. this uncovered bugs related to *mul.fix.sat intrinsic. - removed extra type args in ZigLLVMBuild*MulFixSat so mul.fix.sat intrinsic is called correctly - replaced panics in ir.cpp with compile errors. - added case to test/compile_errors.zig given floats - updated langref: indcate future `a +| b` syntax
Configuration menu - View commit details
-
Copy full SHA for 6b21164 - Browse repository at this point
Copy the full SHA 6b21164View commit details
Commits on Aug 30, 2021
-
sat-arithmetic: make tests actually run at runtime
- rework test cases which were skipping runtime evaluation. this uncovered bugs related to *mul.fix.sat intrinsic. - removed extra type args in ZigLLVMBuild*MulFixSat so mul.fix.sat intrinsic is called correctly - replaced panics in ir.cpp with compile errors. - added case to test/compile_errors.zig given floats - updated langref: indcate future `a +| b` syntax
Configuration menu - View commit details
-
Copy full SHA for d72cb46 - Browse repository at this point
Copy the full SHA d72cb46View commit details -
sat-arithmetic: tweak bigint clamping
- account for `maxInt(iN) *| -1 == minInt(iN) + 1` - explain upstream bug in llvm.smul.fix.sat and link to ziglang#9643 in langref and commented out test cases
Configuration menu - View commit details
-
Copy full SHA for fc0ff06 - Browse repository at this point
Copy the full SHA fc0ff06View commit details -
Configuration menu - View commit details
-
Copy full SHA for 039c35c - Browse repository at this point
Copy the full SHA 039c35cView commit details
Commits on Aug 31, 2021
-
sat-arithmetic: skip mul tests if arch == .wasm32
- ci is erroring with 'LLVM ERROR: Unable to expand fixed point multiplication' when compiling for wasm32 - just trying to get ci to pass. not sure this is correct to skip
Configuration menu - View commit details
-
Copy full SHA for 4e11ae1 - Browse repository at this point
Copy the full SHA 4e11ae1View commit details -
sat-arithmetic: skip mul tests if arch == .wasm32
- prevent the llvm error by making test helper param `op` comptime. this way mul instructions are only generated in mul test
Configuration menu - View commit details
-
Copy full SHA for 4880d87 - Browse repository at this point
Copy the full SHA 4880d87View commit details
Commits on Sep 1, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 938b5bf - Browse repository at this point
Copy the full SHA 938b5bfView commit details