Support for fast math intrinsics#804
Conversation
| } | ||
| } | ||
|
|
||
| pub fn get_stmts(&self) -> Option<&Vec<Stmt>> { |
There was a problem hiding this comment.
This is part of an earlier version where the intrinsics where encoded in a block statement, so I needed to retrieve statements within in order to prepend the finite checks. This version does not use it, but I figured it could be useful for something else. We can remove it otherwise.
There was a problem hiding this comment.
If you do keep it, can you please add a comment?
celinval
left a comment
There was a problem hiding this comment.
Nice test coverage! Just minor comments.
| (false, false) => kani::assume(x > f64::MIN - y), | ||
| _ => (), | ||
| } | ||
| let _z = unsafe { std::intrinsics::fadd_fast(x, y) }; |
There was a problem hiding this comment.
Can you please assert that the result is equal to regular add? The same for the other tests.
There was a problem hiding this comment.
Changed it so we assert it in the case of addition and substraction, as other operations show serious performance issues. Created #809 to revisit this.
| } | ||
| } | ||
|
|
||
| pub fn get_stmts(&self) -> Option<&Vec<Stmt>> { |
There was a problem hiding this comment.
If you do keep it, can you please add a comment?
|
Some changes I made:
|
* Support for fast math intrinsics * Add (failing) positive test for `fadd_fast` * Undo change in `typecheck_binop_args` * Encode fast math intrinsics as regular binops * Add all tests for fast math intrinsics * Add tests for 32-bit values and compare results * Drop support for `frem_fast` * Add comment to `get_stmts`
* Support for fast math intrinsics * Add (failing) positive test for `fadd_fast` * Undo change in `typecheck_binop_args` * Encode fast math intrinsics as regular binops * Add all tests for fast math intrinsics * Add tests for 32-bit values and compare results * Drop support for `frem_fast` * Add comment to `get_stmts`
Description of changes:
Models fast math intrinsics as regular floating point operations. Includes function to check inputs are finite arguments. Adds 16 new test cases (8 positive, 8 negative) for testing fast math intrinsics.
Resolved issues:
Resolves #788
Call-outs:
Testing:
How is this change tested? Existing regression + 16 new tests.
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.