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

Support Signed Lifted IL Shift Amounts in Custom Architectures #6090

Open
ehntoo opened this issue Nov 5, 2024 · 2 comments
Open

Support Signed Lifted IL Shift Amounts in Custom Architectures #6090

ehntoo opened this issue Nov 5, 2024 · 2 comments
Labels
Component: API Issue needs changes to the API Component: Architecture Issue needs changes to an architecture plugin Core: LLIL Issue involves Low Level IL Lifting issues related to LLIL lifting State: Awaiting Triage Issue is waiting for more in-depth triage from a developer Type: Enhancement Issue is a small enhancement to existing functionality

Comments

@ehntoo
Copy link

ehntoo commented Nov 5, 2024

What is the feature you'd like to have?
Support negative/signed shift amounts in arithmetic and logical shifts. At present, an IL arithmetic shift right with a shift amount of 0xFFFFFFFF on a 32-bit architecture results in an attempted shift of val >> 4294967295, resulting in a value filled with whatever the upper-most bit was. I would like to see either additional Lifted IL operations that accept a signed shift amount, or to have the existing Lifted IL operations interpret the shift amount argument as a signed value, with corresponding documented semantics.

Is your feature request related to a problem?
Hexagon provides arithmetic and logical shift operations for both left- and right- shifts that take a shift amount from a register. The architecture defines the semantics for a negative shift amount as a shift of the same type (arithmetic or logical) in the opposite direction. This is presently somewhat tricky to lift, and would introduce additional conditionals into the IL flow for every shift operation of this type.

@galenbwill galenbwill added Type: Enhancement Issue is a small enhancement to existing functionality Component: Architecture Issue needs changes to an architecture plugin Component: API Issue needs changes to the API Core: LLIL Issue involves Low Level IL State: Awaiting Triage Issue is waiting for more in-depth triage from a developer Lifting issues related to LLIL lifting labels Nov 5, 2024
@galenbwill
Copy link
Contributor

To make this concrete, please add example hexagon assembly, the LLIL you're lifting it to, and the resulting MLIL.

@plafosse
Copy link
Member

The workaround here in the meant time would be to add a condition if <0 invert the shift direction, which could cause some pretty ugly lifting if this is like part of an array calculation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: API Issue needs changes to the API Component: Architecture Issue needs changes to an architecture plugin Core: LLIL Issue involves Low Level IL Lifting issues related to LLIL lifting State: Awaiting Triage Issue is waiting for more in-depth triage from a developer Type: Enhancement Issue is a small enhancement to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants