Skip to content

Commit b060295

Browse files
adpaco-awstedinski
authored andcommitted
Disable rounding intrinsics (rust-lang#1026)
* Disable rounding intrinsics * Use `codegen_unimplemented_intrinsic`
1 parent 3b851a6 commit b060295

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
@@ -309,8 +309,8 @@ bitreverse | Yes | |
309309
breakpoint | Yes | |
310310
bswap | Yes | |
311311
caller_location | No | |
312-
ceilf32 | Yes | |
313-
ceilf64 | Yes | |
312+
ceilf32 | No | |
313+
ceilf64 | No | |
314314
copy_nonoverlapping | Yes | |
315315
copysignf32 | Yes | |
316316
copysignf64 | Yes | |
@@ -333,8 +333,8 @@ fabsf64 | Yes | |
333333
fadd_fast | Yes | |
334334
fdiv_fast | Partial | [#809](https://github.com/model-checking/kani/issues/809) |
335335
float_to_int_unchecked | No | |
336-
floorf32 | Yes | |
337-
floorf64 | Yes | |
336+
floorf32 | No | |
337+
floorf64 | No | |
338338
fmaf32 | Yes | |
339339
fmaf64 | Yes | |
340340
fmul_fast | Partial | [#809](https://github.com/model-checking/kani/issues/809) |
@@ -378,8 +378,8 @@ rintf32 | Yes | |
378378
rintf64 | Yes | |
379379
rotate_left | Yes | |
380380
rotate_right | Yes | |
381-
roundf32 | Yes | |
382-
roundf64 | Yes | |
381+
roundf32 | No | |
382+
roundf64 | No | |
383383
rustc_peek | No | |
384384
saturating_add | Yes | |
385385
saturating_sub | 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
@@ -390,8 +390,12 @@ impl<'tcx> GotocCtx<'tcx> {
390390
"https://github.com/model-checking/kani/issues/374"
391391
)
392392
}
393-
"ceilf32" => codegen_simple_intrinsic!(Ceilf),
394-
"ceilf64" => codegen_simple_intrinsic!(Ceil),
393+
"ceilf32" => codegen_unimplemented_intrinsic!(
394+
"https://github.com/model-checking/kani/issues/1025"
395+
),
396+
"ceilf64" => codegen_unimplemented_intrinsic!(
397+
"https://github.com/model-checking/kani/issues/1025"
398+
),
395399
"copy" => codegen_intrinsic_copy!(Memmove),
396400
"copy_nonoverlapping" => codegen_intrinsic_copy!(Memcpy),
397401
"copysignf32" => codegen_simple_intrinsic!(Copysignf),
@@ -425,8 +429,12 @@ impl<'tcx> GotocCtx<'tcx> {
425429
let binop_stmt = codegen_intrinsic_binop!(div);
426430
self.add_finite_args_checks(intrinsic, fargs_clone, binop_stmt, span)
427431
}
428-
"floorf32" => codegen_simple_intrinsic!(Floorf),
429-
"floorf64" => codegen_simple_intrinsic!(Floor),
432+
"floorf32" => codegen_unimplemented_intrinsic!(
433+
"https://github.com/model-checking/kani/issues/1025"
434+
),
435+
"floorf64" => codegen_unimplemented_intrinsic!(
436+
"https://github.com/model-checking/kani/issues/1025"
437+
),
430438
"fmaf32" => codegen_simple_intrinsic!(Fmaf),
431439
"fmaf64" => codegen_simple_intrinsic!(Fma),
432440
"fmul_fast" => {
@@ -471,8 +479,12 @@ impl<'tcx> GotocCtx<'tcx> {
471479
"rintf64" => codegen_simple_intrinsic!(Rint),
472480
"rotate_left" => codegen_intrinsic_binop!(rol),
473481
"rotate_right" => codegen_intrinsic_binop!(ror),
474-
"roundf32" => codegen_simple_intrinsic!(Roundf),
475-
"roundf64" => codegen_simple_intrinsic!(Round),
482+
"roundf32" => codegen_unimplemented_intrinsic!(
483+
"https://github.com/model-checking/kani/issues/1025"
484+
),
485+
"roundf64" => codegen_unimplemented_intrinsic!(
486+
"https://github.com/model-checking/kani/issues/1025"
487+
),
476488
"saturating_add" => codegen_intrinsic_binop_with_mm!(saturating_add),
477489
"saturating_sub" => codegen_intrinsic_binop_with_mm!(saturating_sub),
478490
"sinf32" => codegen_simple_intrinsic!(Sinf),
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 `ceilf32` 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_ceil = unsafe { std::intrinsics::ceilf32(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 `ceilf64` 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_ceil = unsafe { std::intrinsics::ceilf64(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 `floorf32` 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_floor = unsafe { std::intrinsics::floorf32(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 `floorf64` 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_floor = unsafe { std::intrinsics::floorf64(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 `roundf32` 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_round = unsafe { std::intrinsics::roundf32(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 `roundf64` 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_round = unsafe { std::intrinsics::roundf64(x) };
13+
}

0 commit comments

Comments
 (0)