Skip to content

Commit 2278bbb

Browse files
adpaco-awstedinski
authored andcommitted
Disable remaining rounding intrinsics (rust-lang#1028)
* Disable remaining rounding intrinsics * Update support table * Fix format
1 parent b060295 commit 2278bbb

File tree

8 files changed

+102
-12
lines changed

8 files changed

+102
-12
lines changed

docs/src/rust-feature-support.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ minnumf32 | Yes | |
356356
minnumf64 | Yes | |
357357
move_val_init | No | |
358358
mul_with_overflow | Yes | |
359-
nearbyintf32 | Yes | |
360-
nearbyintf64 | Yes | |
359+
nearbyintf32 | No | |
360+
nearbyintf64 | No | |
361361
needs_drop | Yes | |
362362
nontemporal_store | No | |
363363
offset | Partial | Missing undefined behavior checks |
@@ -374,8 +374,8 @@ ptr_guaranteed_eq | Partial | |
374374
ptr_guaranteed_ne | Partial | |
375375
ptr_offset_from | Partial | Missing undefined behavior checks |
376376
raw_eq | Partial | Missing undefined behavior checks |
377-
rintf32 | Yes | |
378-
rintf64 | Yes | |
377+
rintf32 | No | |
378+
rintf64 | No | |
379379
rotate_left | Yes | |
380380
rotate_right | Yes | |
381381
roundf32 | No | |
@@ -391,8 +391,8 @@ sqrtf32 | Yes | |
391391
sqrtf64 | Yes | |
392392
sub_with_overflow | Yes | |
393393
transmute | Yes | |
394-
truncf32 | Yes | |
395-
truncf64 | Yes | |
394+
truncf32 | No | |
395+
truncf64 | No | |
396396
try | No | [#267](https://github.com/model-checking/kani/issues/267) |
397397
type_id | Yes | |
398398
type_name | Yes | |

src/kani-compiler/src/codegen_cprover_gotoc/codegen/intrinsic.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,12 @@ impl<'tcx> GotocCtx<'tcx> {
462462
"minnumf32" => codegen_simple_intrinsic!(Fminf),
463463
"minnumf64" => codegen_simple_intrinsic!(Fmin),
464464
"mul_with_overflow" => codegen_op_with_overflow!(mul_overflow),
465-
"nearbyintf32" => codegen_simple_intrinsic!(Nearbyintf),
466-
"nearbyintf64" => codegen_simple_intrinsic!(Nearbyint),
465+
"nearbyintf32" => codegen_unimplemented_intrinsic!(
466+
"https://github.com/model-checking/kani/issues/1025"
467+
),
468+
"nearbyintf64" => codegen_unimplemented_intrinsic!(
469+
"https://github.com/model-checking/kani/issues/1025"
470+
),
467471
"needs_drop" => codegen_intrinsic_const!(),
468472
"offset" => codegen_op_with_overflow_check!(add_overflow),
469473
"powf32" => codegen_simple_intrinsic!(Powf),
@@ -475,8 +479,12 @@ impl<'tcx> GotocCtx<'tcx> {
475479
"ptr_guaranteed_ne" => codegen_intrinsic_boolean_binop!(neq),
476480
"ptr_offset_from" => self.codegen_ptr_offset_from(fargs, p, loc),
477481
"raw_eq" => self.codegen_intrinsic_raw_eq(instance, fargs, p, loc),
478-
"rintf32" => codegen_simple_intrinsic!(Rintf),
479-
"rintf64" => codegen_simple_intrinsic!(Rint),
482+
"rintf32" => codegen_unimplemented_intrinsic!(
483+
"https://github.com/model-checking/kani/issues/1025"
484+
),
485+
"rintf64" => codegen_unimplemented_intrinsic!(
486+
"https://github.com/model-checking/kani/issues/1025"
487+
),
480488
"rotate_left" => codegen_intrinsic_binop!(rol),
481489
"rotate_right" => codegen_intrinsic_binop!(ror),
482490
"roundf32" => codegen_unimplemented_intrinsic!(
@@ -525,8 +533,12 @@ impl<'tcx> GotocCtx<'tcx> {
525533
"sqrtf64" => codegen_simple_intrinsic!(Sqrt),
526534
"sub_with_overflow" => codegen_op_with_overflow!(sub_overflow),
527535
"transmute" => self.codegen_intrinsic_transmute(fargs, ret_ty, p),
528-
"truncf32" => codegen_simple_intrinsic!(Truncf),
529-
"truncf64" => codegen_simple_intrinsic!(Trunc),
536+
"truncf32" => codegen_unimplemented_intrinsic!(
537+
"https://github.com/model-checking/kani/issues/1025"
538+
),
539+
"truncf64" => codegen_unimplemented_intrinsic!(
540+
"https://github.com/model-checking/kani/issues/1025"
541+
),
530542
"try" => {
531543
codegen_unimplemented_intrinsic!(
532544
"https://github.com/model-checking/kani/issues/267"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-verify-fail
4+
5+
// Check that `nearbyintf32` is not supported until
6+
// https://github.com/model-checking/kani/issues/1025 is fixed
7+
#![feature(core_intrinsics)]
8+
9+
#[kani::proof]
10+
fn main() {
11+
let x = kani::any();
12+
let n = unsafe { std::intrinsics::nearbyintf32(x) };
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-verify-fail
4+
5+
// Check that `nearbyintf64` is not supported until
6+
// https://github.com/model-checking/kani/issues/1025 is fixed
7+
#![feature(core_intrinsics)]
8+
9+
#[kani::proof]
10+
fn main() {
11+
let x = kani::any();
12+
let n = unsafe { std::intrinsics::nearbyintf64(x) };
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-verify-fail
4+
5+
// Check that `rintf32` is not supported until
6+
// https://github.com/model-checking/kani/issues/1025 is fixed
7+
#![feature(core_intrinsics)]
8+
9+
#[kani::proof]
10+
fn main() {
11+
let x = kani::any();
12+
let n = unsafe { std::intrinsics::rintf32(x) };
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-verify-fail
4+
5+
// Check that `rintf64` is not supported until
6+
// https://github.com/model-checking/kani/issues/1025 is fixed
7+
#![feature(core_intrinsics)]
8+
9+
#[kani::proof]
10+
fn main() {
11+
let x = kani::any();
12+
let n = unsafe { std::intrinsics::rintf64(x) };
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-verify-fail
4+
5+
// Check that `truncf32` is not supported until
6+
// https://github.com/model-checking/kani/issues/1025 is fixed
7+
#![feature(core_intrinsics)]
8+
9+
#[kani::proof]
10+
fn main() {
11+
let x = kani::any();
12+
let x_trunc = unsafe { std::intrinsics::truncf32(x) };
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
// kani-verify-fail
4+
5+
// Check that `truncf64` is not supported until
6+
// https://github.com/model-checking/kani/issues/1025 is fixed
7+
#![feature(core_intrinsics)]
8+
9+
#[kani::proof]
10+
fn main() {
11+
let x = kani::any();
12+
let x_trunc = unsafe { std::intrinsics::truncf64(x) };
13+
}

0 commit comments

Comments
 (0)