Skip to content

ci test bugfix - #26

Merged
angelo-yap merged 1 commit into
mainfrom
fix/swar-shift-lowering
Jul 8, 2026
Merged

ci test bugfix#26
angelo-yap merged 1 commit into
mainfrom
fix/swar-shift-lowering

Conversation

@angelo-yap

Copy link
Copy Markdown
Owner

This pull request refactors the lowering logic for per-field variable shifts in the lowerShift function, updating both the implementation and the corresponding test cases. The main change is to use a more accurate shift-amount model that matches the scalar LLVM reference, especially for out-of-range shift amounts. The code now handles per-field shift amounts without masking, correctly clears fields when over-shifting, and updates the logic for selecting and blending shifted values. Test checks are updated to match the new IR structure and variable names.

Lowering logic improvements:

  • The shift-amount model now interprets each field's shift amount as its full N-bit value, so amounts ≥ N clear the field, matching LLVM scalar reference semantics. The special case for i1 types is preserved, always returning the input for any shift amount.
  • The masking of shift amounts is removed; the code now iterates over all possible shift steps (powers of two up to the field width), and for each bit in the amount, generates the appropriate blend of shifted and unshifted values. This ensures correct handling for out-of-range shifts.

Test updates:

  • The IR checks in shl_i2.ll, shl_i4.ll, lshr_i2.ll, and lshr_i4.ll are updated to match the new variable names and logic, verifying the new %shift.hasstep, %shift.sel, %shift.raw, %shift.confined, and %shift.blend sequence. [1] [2] [3] [4]

@angelo-yap
angelo-yap merged commit 6fe14d5 into main Jul 8, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant