Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add psubq instruction (x86) #2553

Merged
merged 5 commits into from
May 25, 2022
Merged

Add psubq instruction (x86) #2553

merged 5 commits into from
May 25, 2022

Conversation

lordidiot
Copy link
Contributor

Adds support for psubq x86 instruction. Implementation very similar to psubb.

Copy link
Contributor

@Boyan-MILANOV Boyan-MILANOV left a comment

Choose a reason for hiding this comment

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

Left one small comment but it looks good to me otherwise!

for i in reversed(range(0, dest.size, 64)):
a = Operators.EXTRACT(value_a, i, 64)
b = Operators.EXTRACT(value_b, i, 64)
result.append((a - b) & 0xFFFFFFFFFFFFFFFF)
Copy link
Contributor

Choose a reason for hiding this comment

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

We are subtracting on 64 bits already so I don't think masking with 0xffffffffffffffff is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok! I thought it should be used to explicitly mask any negative results, but I think this is also done in CONCAT so I will remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah bitvector arithmetic will round up to 64 bits anyway.

@ekilmer ekilmer merged commit 2de39b8 into trailofbits:master May 25, 2022
ekilmer added a commit that referenced this pull request May 25, 2022
* master:
  Add `psubq` instruction (x86) (#2553)
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.

None yet

3 participants