Shaders: a signed 64-bit operand sign-extends its 32-bit literal (restore 7d04943) #146

Open
11run11 wants to merge 1 commit from upstream-pr/146 into main
11run11 commented 2026-11-27 19:59:16 +00:00 (Migrated from github.com)

Imported from DexNom/VIctory. Originally posted by 11run11 on 2026-11-27T19:59:16Z.


This restores 7d049431de ("Shaders: a signed 64-bit operand sign-extends its 32-bit literal", by Duff, 2026-11-24). The commit is in DexNom's history, but 570a941 (the Radeon sources publish) dropped its change, so main (8114ff7) has the bug again. It is a cherry-pick -x with the author kept and no other change.

The original description:

A literal is 32 bits; in a 64-bit operand the hardware sign-extends it
when the operand is signed (i64) and zero-extends it otherwise (LLVM's
AMDGPU operand rules). Every literal was zero-extended, so
v_cmp_lt_i64 v[1:2], -100 compared with 4294967196, and so did the
other i64 compares, v_ashrrev_i64 and s_ashr_i64.
Literals of operands of i64 instructions are now sign-extended, in the
vector and the scalar paths.

Evidence on main (8114ff7):

Claude (Anthropic) found the dropped change, made the cherry-pick and ran the verification.

🤖 Generated with Claude Code

<!-- greyfinch-sync:DexNom/VIctory:issue:5532388615 --> Imported from [DexNom/VIctory](https://github.com/DexNom/VIctory/pull/146). Originally posted by [11run11](https://github.com/11run11) on 2026-11-27T19:59:16Z. --- This restores 7d049431de9b12873d801de2b8a54ab4007fcde9 ("Shaders: a signed 64-bit operand sign-extends its 32-bit literal", by Duff, 2026-11-24). The commit is in DexNom's history, but 570a941 (the Radeon sources publish) dropped its change, so `main` (`8114ff7`) has the bug again. It is a `cherry-pick -x` with the author kept and no other change. The original description: > A literal is 32 bits; in a 64-bit operand the hardware sign-extends it > when the operand is signed (i64) and zero-extends it otherwise (LLVM's > AMDGPU operand rules). Every literal was zero-extended, so > v_cmp_lt_i64 v[1:2], -100 compared with 4294967196, and so did the > other i64 compares, v_ashrrev_i64 and s_ashr_i64. > Literals of operands of i64 instructions are now sign-extended, in the > vector and the scalar paths. Evidence on `main` (`8114ff7`): - The commit's own test(s) (`signed_64_bit_operands_sign_extend_their_literal`) fail on `main` and pass with this change. - Tests and package Clippy (`-D warnings`) of the touched crates pass. - Fork CI (unmodified `ci.yml`): https://github.com/11run11/VIctoryDex-11-run/actions/runs/46059239357 Claude (Anthropic) found the dropped change, made the cherry-pick and ran the verification. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/146:upstream-pr/146'
git switch 'upstream-pr/146'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/146'
git switch 'upstream-pr/146'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/146'
git switch 'upstream-pr/146'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/146'
git switch 'main'
git merge --squash 'upstream-pr/146'
git switch 'main'
git merge --ff-only 'upstream-pr/146'
git switch 'main'
git merge 'upstream-pr/146'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
DexNom/VIctory!146
No description provided.