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

arith-to-emitc: cmpf #142

Closed
wants to merge 7 commits into from
Closed

arith-to-emitc: cmpf #142

wants to merge 7 commits into from

Conversation

mgehre-amd
Copy link
Collaborator

@mgehre-amd mgehre-amd commented Mar 18, 2024

This converts a few predicates of arith.cmpf to emitc.
I have to check closer on the unordered or greater than predicate. From what I understand, C++ > operator returns false when any operand is NaN, but unordered or greater than should return true when any operand is unordered (=NaN).

@mgehre-amd mgehre-amd requested a review from TinaAMD March 18, 2024 16:12
* Support all kinds of unordered comparison
* Translation could be smarter, e.g. unordered not equal conversion could use fewer ops
case arith::CmpFPredicate::UNO: {
// unordered, i.e. either operand is nan
unordered = true;
predicate = emitc::CmpPredicate::ne;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nit: seems a bit wasteful to emit a ne here when the check for IsUnordered is already enough. Maybe directly return createCheckIsUnordered here?

@TinaAMD
Copy link

TinaAMD commented Mar 26, 2024

Re-opening as #148 to make review easier.

@TinaAMD TinaAMD closed this Mar 26, 2024
@mgehre-amd mgehre-amd deleted the matthias.cmpf branch September 11, 2024 13:45
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.

2 participants