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

Enable powif* intrinsics #2999

Merged
merged 7 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/rust-feature-support/intrinsics.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ nontemporal_store | No | |
offset | Partial | Doesn't check [all UB conditions](https://doc.rust-lang.org/std/primitive.pointer.html#safety-2) |
powf32 | Partial | Results are overapproximated |
powf64 | Partial | Results are overapproximated |
powif32 | No | |
powif64 | No | |
powif32 | Partial | Results are overapproximated |
powif64 | Partial | Results are overapproximated |
pref_align_of | Yes | |
prefetch_read_data | No | |
prefetch_read_instruction | No | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ impl<'tcx> GotocCtx<'tcx> {
),
"powf32" => codegen_simple_intrinsic!(Powf),
"powf64" => codegen_simple_intrinsic!(Pow),
"powif32" => unstable_codegen!(codegen_simple_intrinsic!(Powif)),
"powif64" => unstable_codegen!(codegen_simple_intrinsic!(Powi)),
"powif32" => codegen_simple_intrinsic!(Powif),
"powif64" => codegen_simple_intrinsic!(Powi),
"pref_align_of" => codegen_intrinsic_const!(),
"ptr_guaranteed_cmp" => self.codegen_ptr_guaranteed_cmp(fargs, place, loc),
"ptr_offset_from" => self.codegen_ptr_offset_from(fargs, place, loc),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// https://github.com/model-checking/kani/issues/555
// kani-flags: --no-undefined-function-checks

// This regression test is in response to issue #135.
// The type of the second parameter to powi is a `CInteger`, but
// the type of `2` here is a `u32`. This test ensures that
Expand Down
24 changes: 0 additions & 24 deletions tests/kani/Cast/cast_abstract_args_to_concrete_fixme.rs

This file was deleted.

22 changes: 22 additions & 0 deletions tests/kani/Intrinsics/Math/Arith/powi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

#[kani::proof]
fn verify_powi32() {
let x: f32 = kani::any();
kani::assume(x.is_normal());
kani::assume(x >= 1e-19 || x <= -1e-19);
kani::assume(x <= 1.84e19 && x >= -1.84e19);
let x2 = x.powi(2);
assert!(x2 >= 0.0);
}

#[kani::proof]
fn verify_powi64() {
let x: f64 = kani::any();
kani::assume(x.is_normal());
kani::assume(x >= 1e-153 || x <= -1e-153);
kani::assume(x <= 1.34e154 && x >= -1.34e154);
let x2 = x.powi(2);
assert!(x2 >= 0.0);
}
Loading