Skip to content

HOTFIX: avoid bitRangeInt function for branching (#switchInt)#732

Merged
Stevengre merged 1 commit into
masterfrom
HOTFIX-replace-bitRangeInt-for-better-branching
Oct 10, 2025
Merged

HOTFIX: avoid bitRangeInt function for branching (#switchInt)#732
Stevengre merged 1 commit into
masterfrom
HOTFIX-replace-bitRangeInt-for-better-branching

Conversation

@jberthold
Copy link
Copy Markdown
Collaborator

The bitRangeInt equation in domains.md uses partial bit-shift symbols and is therefore not applied by booster. A better alternative is to use the truncate function locally defined in mir-semantics. Expressions are equivalent:

bitRangeInt(VAL, 0, WIDTH)
      (def)      == (VAL >>Int 0) modInt (1 <<Int WIDTH)
      (>> 0)     == VAL modInt (1 <<Int WIDTH)
  (mod via mask) == VAL &Int ((1<<Int WIDTH) -Int 1) == truncate(VAL, WIDTH, Unsigned)

Also marking some relevant simplifications as smt-lemmas.

Altogether, this avoids a number of observed fall-backs in p-token execution.

The `bitRangeInt` equation in `domains.md` uses partial bit-shift
symbols and is therefore not applied by booster. A better alternative
is to use the `truncate` function locally defined in
`mir-semantics`. Expressions are equivalent:

```
bitRangeInt(VAL, 0, WIDTH)
      (def)      == (VAL >>Int 0) modInt (1 <<Int WIDTH)
      (>> 0)     == VAL modInt (1 <<Int WIDTH)
  (mod via mask) == VAL &Int ((1<<Int WIDTH) -Int 1) == truncate(VAL, WIDTH, Unsigned)
```

Also marking some relevant simplifications as smt-lemmas.

Altogether, this avoids a number of observed fall-backs in p-token execution.
@jberthold jberthold marked this pull request as ready for review October 10, 2025 01:34
Copy link
Copy Markdown
Contributor

@Stevengre Stevengre left a comment

Choose a reason for hiding this comment

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

LGTM!

@Stevengre Stevengre merged commit 2fb4f61 into master Oct 10, 2025
7 checks passed
@Stevengre Stevengre deleted the HOTFIX-replace-bitRangeInt-for-better-branching branch October 10, 2025 03:03
Stevengre pushed a commit that referenced this pull request Mar 17, 2026
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