Skip to content

Commit dc6595d

Browse files
committed
Implement nearbyintf32 and nearbyintf64 and remove two test ignores
1 parent 6092160 commit dc6595d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

scripts/test_rustc_tests.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ rm -r tests/run-make/c-link-to-rust-va-list-fn # requires callee side vararg sup
5050
rm -r tests/run-pass-valgrind/unsized-locals
5151

5252
# misc unimplemented things
53-
rm tests/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics
5453
rm tests/ui/target-feature/missing-plusminus.rs # error not implemented
5554
rm -r tests/run-make/emit-named-files # requires full --emit support
5655
rm -r tests/run-make/repr128-dwarf # debuginfo test
@@ -125,8 +124,6 @@ rm -r tests/run-make/compressed-debuginfo
125124

126125
rm -r tests/run-make/extern-fn-explicit-align # argument alignment not yet supported
127126

128-
rm tests/ui/codegen/subtyping-enforces-type-equality.rs # assert_assignable bug with Coroutine's
129-
130127
# bugs in the test suite
131128
# ======================
132129
rm tests/ui/backtrace.rs # TODO warning

src/intrinsics/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ fn codegen_float_intrinsic_call<'tcx>(
341341
sym::roundf64 => ("round", 1, fx.tcx.types.f64, types::F64),
342342
sym::roundevenf32 => ("roundevenf", 1, fx.tcx.types.f32, types::F32),
343343
sym::roundevenf64 => ("roundeven", 1, fx.tcx.types.f64, types::F64),
344+
sym::nearbyintf32 => ("nearbyintf", 1, fx.tcx.types.f32, types::F32),
345+
sym::nearbyintf64 => ("nearbyint", 1, fx.tcx.types.f64, types::F64),
344346
sym::sinf32 => ("sinf", 1, fx.tcx.types.f32, types::F32),
345347
sym::sinf64 => ("sin", 1, fx.tcx.types.f64, types::F64),
346348
sym::cosf32 => ("cosf", 1, fx.tcx.types.f32, types::F32),
@@ -392,13 +394,16 @@ fn codegen_float_intrinsic_call<'tcx>(
392394
| sym::ceilf64
393395
| sym::truncf32
394396
| sym::truncf64
397+
| sym::nearbyintf32
398+
| sym::nearbyintf64
395399
| sym::sqrtf32
396400
| sym::sqrtf64 => {
397401
let val = match intrinsic {
398402
sym::fabsf32 | sym::fabsf64 => fx.bcx.ins().fabs(args[0]),
399403
sym::floorf32 | sym::floorf64 => fx.bcx.ins().floor(args[0]),
400404
sym::ceilf32 | sym::ceilf64 => fx.bcx.ins().ceil(args[0]),
401405
sym::truncf32 | sym::truncf64 => fx.bcx.ins().trunc(args[0]),
406+
sym::nearbyintf32 | sym::nearbyintf64 => fx.bcx.ins().nearest(args[0]),
402407
sym::sqrtf32 | sym::sqrtf64 => fx.bcx.ins().sqrt(args[0]),
403408
_ => unreachable!(),
404409
};

0 commit comments

Comments
 (0)