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

Incorrect lift of Auto-AND predicates #6

Open
toshipiazza opened this issue Sep 5, 2021 · 2 comments
Open

Incorrect lift of Auto-AND predicates #6

toshipiazza opened this issue Sep 5, 2021 · 2 comments

Comments

@toshipiazza
Copy link

The publicly available "Hexagon V5x Programmer’s Reference Manual" describes behavior for "auto-AND" predicates in section 6.2.3

If multiple compare instructions in a packet write to the same predicate register, the result is the logical AND of the individual compare results.

binja-hexagon does not seem to support this right now.

test_auto_and_predicates:
  { P0 = cmp.eq(r0,#1)
    P0 = cmp.eq(r0,#2)
    if (P0.new) jump:T 1f }
  { r0 = #0
    jumpr r31 }
1:
  { r0 = #1
    jumpr r31 }

Lifts to

...
   1 @ 00020330  temp90.b = P0
   2 @ 00020330  temp90.b = R0 == 1  # P0's temp written first
   3 @ 00020330  temp90.b = R0 == 2  # P0's temp overwritten instead of AND'd
   4 @ 00020330  if (temp90.b) then 5 else 7
...
@cfircohen
Copy link
Contributor

Nice, I didn't notice that when I read the reference manual. Hexagon keeps surprising me :)

Did you ever see that in compiler generated code? I'd like to prioritize LLIL support for compiler generated code, as getting this plugin to be full spec compatible is very challenging.

@toshipiazza
Copy link
Author

I also have not seen this particular construct, but I'll keep my eyes peeled :)

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

No branches or pull requests

2 participants