Skip to content

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

Open
the-mr-dave wants to merge 3 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 3 commits into
devfrom
wip/rvde/extract-over-extend

Conversation

@the-mr-dave

Copy link
Copy Markdown
Contributor

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.

@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
@the-mr-dave
the-mr-dave force-pushed the wip/rvde/extract-over-extend branch from 264d331 to fce876e Compare August 26, 2026 10:21

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changes of the branch are here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changes are here

the-mr-dave and others added 3 commits August 31, 2026 00:13
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>
Uses runUnfTest (UnfTransformer directly) instead of
SimplificationTest.runSimplificationTest, matching the workflow already
used for the other UnfTransformer-level tests in this class - a more
direct path to BitvectorUtils than going through the full quantifier
elimination pipeline.

Co-authored-by: rvinton <rvinton@users.noreply.github.com>
@the-mr-dave
the-mr-dave force-pushed the wip/rvde/extract-over-extend branch from 35ff208 to 8418dc5 Compare August 30, 2026 22:30
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