Skip to content

Add extract-over-extend simplification for partial-width extracts - #800

Open
the-mr-dave wants to merge 2 commits into
devfrom
wip/rvde/extract-over-extend
Open

Add extract-over-extend simplification for partial-width extracts#800
the-mr-dave wants to merge 2 commits into
devfrom
wip/rvde/extract-over-extend

Conversation

@the-mr-dave

Copy link
Copy Markdown

Summary

  • sign_extend/zero_extend only add bits above the original value, so
    extracting bits [hi:0] where hi falls between the original width and the
    full extended width always gives back a smaller extend of the original
    value (or the original value itself, if no padding bits survive).
  • Add tests covering the full-undo case, partial reduction, and two guard
    cases (extract of the full extended width, extract of a plain variable)
    that must not trigger the rule.

the-mr-dave and others added 2 commits August 16, 2026 18:58
sign_extend/zero_extend only add bits above the original value, so
extracting bits [hi:0] where hi falls anywhere between the original
width and the full extended width always gives back a smaller extend
of the original value (or the original value itself, if no padding
bits survive).

Co-authored-by: rvinton <rvinton@users.noreply.github.com>
Covers extract fully undoing an extend, partial reduction (extract
width between the original and the fully extended width), and the two
guard cases where the rule must not apply (extract of the full
extended width, extract of a plain variable).

Co-authored-by: rvinton <rvinton@users.noreply.github.com>
@rvinton
rvinton marked this pull request as ready for review August 18, 2026 08:34
@rvinton
rvinton requested a review from Heizmann August 18, 2026 08:35
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.

2 participants