Add i32 % execution tests for negative dividends across non-power-of-two moduli#4665
Open
mstampfli wants to merge 1 commit into
Open
Add i32 % execution tests for negative dividends across non-power-of-two moduli#4665mstampfli wants to merge 1 commit into
mstampfli wants to merge 1 commit into
Conversation
…o moduli The existing remainder cases only use moduli 10 and 256 (from the sparse i32 range), missing value-dependent codegen paths such as modulus 768 where some implementations compute signed % as unsigned for negative operands (e.g. -1 % 768 returns 255 instead of -1). Add a remainder_negative test covering negative dividends across moduli 3/7/100/256/768/1000. See gfx-rs/wgpu#8191.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing
binary,i32_arithmetic:remaindercases draw operands from the sparse i32 range, whose only divisors are10and256. That misses value-dependent codegen paths - e.g. modulus768- where some implementations compute signed%as if it were unsigned for negative dividends, returning255instead of-1for-1 % 768.This adds a
remainder_negativetest (and cache builders) exercising negative dividends (-1, -2, -5, -255, -256, -768, -769, -1000, -1234567) across moduli (3, 7, 100, 256, 768, 1000). Expected values use the existingi32_remainder_*reference helpers (truncated remainder, sign of dividend), unchanged.The regenerated case cache (
src/resources/cache/.../i32_arithmetic.bin+hashes.json) is included.npm run typecheckandnpm run lintpass.Context: discovered via the wgpu/naga
OpSRempoison issue, gfx-rs/wgpu#8191.