-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for builtin float comparison operations #3899
Conversation
@@ -200,6 +200,28 @@ static auto GetBuiltinICmpPredicate(SemIR::BuiltinFunctionKind builtin_kind, | |||
} | |||
} | |||
|
|||
// Get the predicate to use for an `fcmp` instruction generated for the | |||
// specified builtin. | |||
static auto GetBuiltinFCmpPredicate(SemIR::BuiltinFunctionKind builtin_kind) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is using the ordered variants of fcmp
conditions, which I'm not sure is accurate with Carbon's intended behavior. Would love feedback on whether this is okay!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, using ordered comparisons is the intent. I don't think we state this explicitly, but it's implicitly mentioned here and here in the design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
@@ -200,6 +200,28 @@ static auto GetBuiltinICmpPredicate(SemIR::BuiltinFunctionKind builtin_kind, | |||
} | |||
} | |||
|
|||
// Get the predicate to use for an `fcmp` instruction generated for the | |||
// specified builtin. | |||
static auto GetBuiltinFCmpPredicate(SemIR::BuiltinFunctionKind builtin_kind) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, using ordered comparisons is the intent. I don't think we state this explicitly, but it's implicitly mentioned here and here in the design.
…3899) Adds support for builtin comparison operations for floats (`==`, `!=`, `<`, `<=`, `>`, `>=`).
…3899) Adds support for builtin comparison operations for floats (`==`, `!=`, `<`, `<=`, `>`, `>=`).
Adds support for builtin comparison operations for floats (
==
,!=
,<
,<=
,>
,>=
).