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

Added translation for LLVM FNeg instruction. #291

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PhilipBotha
Copy link

@PhilipBotha PhilipBotha commented Oct 12, 2024

Added translation for LLVM FNeg instruction. No hint.
Implementation is a modification of the patch by @phoon0416. Using multiplcation by -1.0 instead of subtracting from -0.0.
Added two tests, one for float and one for double that should successfully be analysed with ikos with the FNeg addition without throwing an unsupported LLVM instruction exception.

From the LLVM Language reference manual

The value produced is a copy of the operand with its sign bit flipped. The value is otherwise completely identical; in particular, if the input is a NaN, then the quiet/signaling bit and payload are perfectly preserved.

Using compiler explorer to test:
Using (-0.0) - NaN does not flip the bit. Same with -1.0 * NaN. -NaN does flip the bit.

The code in this PR does not quite adhere to the LLVM requirements of FNeg, but should cover most use cases.

… no hint.

Added two tests, one for float and one for double that should successfully be analysed with ikos with the FNeg addition.
@PhilipBotha
Copy link
Author

Outstanding with this PR is the location and running of the two test cases for verifying that the ikos can now handle LLVM FNeg instructions.

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.

1 participant