Skip to content

Conversation

@david-arm
Copy link

We often see patterns like this:

shrqi 32, %v0, %v1
testl 0x80000000, %v1
jcc CC_E, ...

but really this is the same as asking if %v0 is >= 0. Rewriting this in the form

cmp 0, %v0
jcc CC_GE, ...

saves two instructions, i.e. a lsr and a mov.

We often see patterns like this:

shrqi 32, %v0, %v1
testl 0x80000000, %v1
jcc CC_E, ...

but really this is the same as asking if %v0 is >= 0. Rewriting
this in the form

cmp 0, %v0
jcc CC_GE, ...

saves two instructions, i.e. a lsr and a mov.
@meta-codesync
Copy link

meta-codesync bot commented Nov 7, 2025

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D86516135. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants