Skip to content

Comments

Execution Tests: Update datasets for rhs values for shift operations#8179

Merged
alsepkow merged 2 commits intomicrosoft:mainfrom
alsepkow:user/alsepkow/FixBitShifts
Feb 20, 2026
Merged

Execution Tests: Update datasets for rhs values for shift operations#8179
alsepkow merged 2 commits intomicrosoft:mainfrom
alsepkow:user/alsepkow/FixBitShifts

Conversation

@alsepkow
Copy link
Contributor

Assisted by gh copilot.

Fix BitShiftRhs test input sets to avoid shift amounts >= bit width, which is undefined behavior in C++ and can cause test failures as expected values are computed via C++.

Copy link
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, it's defined in HLSL to shift by larger values because it masks the shift value to the lower bits (5 bits for 32-bit shift), effectively making it wrap. It does seem like the test's reference computation should be modified to match the specified HLSL behavior in this way. Testing out-of-range values may seem like it's technically unnecessary for testing HW implementation since the mask is generated explicitly by the compiler, however this is a pattern we expect some drivers to match and remove the explicit masking if the GPU instruction is only expected to use the lower bits anyway, so it would still be good to make sure it is behaving as expected with larger values.

@jenatali
Copy link
Member

Yep, +1 to Tex's feedback, my suggestion wasn't to remove the out-of-range values, just to make the CPU-side validation not violate the C++ spec.

@alsepkow alsepkow merged commit 435dbb6 into microsoft:main Feb 20, 2026
12 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Feb 20, 2026
luciechoi pushed a commit to luciechoi/DirectXShaderCompiler that referenced this pull request Feb 20, 2026
…icrosoft#8179)

Assisted by gh copilot.

Fix BitShiftRhs test input sets to avoid shift amounts >= bit width,
which is undefined behavior in C++ and can cause test failures as
expected values are computed via C++.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants