Skip to content

Incorrect lift of Auto-AND predicates #6

@toshipiazza

Description

@toshipiazza

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
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions