-
Notifications
You must be signed in to change notification settings - Fork 97
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 atomic_min*
and atomic_umin*
intrinsics
#1212
Conversation
// Expressions defined on top of other expressions | ||
|
||
/// `min(self, e)` | ||
pub fn min(self, e: Expr) -> Expr { |
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.
If there are side effects, this will evaluate them twice
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.
Please take a look at the new changes, which complete the definition for is_side_effect
and assert that neither of these cause side effects.
fn are_side_effect(exprs: &Vec<Expr>) -> bool { | ||
for expr in exprs { | ||
if expr.is_side_effect() { | ||
return true; | ||
} | ||
} | ||
false | ||
} |
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.
Style ⛏️ : you could use exprs.iter().any(|e| e.is_side_effect())
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.
Thanks!
|
||
#[kani::proof] | ||
fn main() { | ||
let mut a1 = 1 as u8; |
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.
Is there a reason we only test for u8
? Could we make this take a <T>
and then test multiple bitwidths?
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, that's pending in #25. But I'd like to do it once all atomic tests are in.
Description of changes:
Defines a
min
expression on top of other expressions. Then uses themin
expression to add support foratomic_min*
andatomic_umin*
intrinsics.Resolved issues:
Part of #1163
Testing:
How is this change tested? Removes 10 tests and adds 2.
Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.