Skip to content

Commit 09c1770

Browse files
committed
Sync from rust 3645249d79dfb136b5d8de3ce153d19d6698d92d
2 parents d9bd396 + 6b8bdc9 commit 09c1770

5 files changed

Lines changed: 20 additions & 22 deletions

File tree

scripts/test_rustc_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ rm -r tests/run-make/panic-abort-eh_frame # .eh_frame emitted with panic=abort
173173

174174
# bugs in the test suite
175175
# ======================
176-
rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue
176+
rm tests/ui/process/nofile-limit.rs # FIXME some AArch64 linking issue
177177
rm -r tests/ui/codegen/equal-pointers-unequal # make incorrect assumptions about the location of stack variables
178178
rm -r tests/incremental/extern_static/issue-49153.rs # assumes reference to undefined static gets optimized away
179179

src/abi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_middle::ty::TypeVisitableExt;
2020
use rustc_middle::ty::layout::FnAbiOf;
2121
use rustc_middle::ty::print::with_no_trimmed_paths;
2222
use rustc_session::Session;
23-
use rustc_span::source_map::Spanned;
23+
use rustc_span::Spanned;
2424
use rustc_target::callconv::{FnAbi, PassMode};
2525
use rustc_target::spec::Arch;
2626
use smallvec::{SmallVec, smallvec};

src/common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use rustc_middle::ty::TypeFoldable;
66
use rustc_middle::ty::layout::{
77
self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers,
88
};
9-
use rustc_span::Symbol;
10-
use rustc_span::source_map::Spanned;
9+
use rustc_span::{Spanned, Symbol};
1110
use rustc_target::callconv::FnAbi;
1211
use rustc_target::spec::{Arch, HasTargetSpec, Target};
1312

src/intrinsics/mod.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ use rustc_middle::ty;
2424
use rustc_middle::ty::GenericArgsRef;
2525
use rustc_middle::ty::layout::ValidityRequirement;
2626
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
27-
use rustc_span::source_map::Spanned;
28-
use rustc_span::{Symbol, sym};
27+
use rustc_span::{Spanned, Symbol, sym};
2928
use rustc_target::spec::PanicStrategy;
3029

3130
pub(crate) use self::llvm::codegen_llvm_intrinsic_call;
@@ -356,10 +355,10 @@ fn codegen_float_intrinsic_call<'tcx>(
356355
sym::fmaf64 => ("fma", 3, fx.tcx.types.f64, types::F64),
357356
sym::fmaf128 => ("fmaf128", 3, fx.tcx.types.f128, types::F128),
358357
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
359-
sym::fmuladdf16 => ("fmaf16", 3, fx.tcx.types.f16, types::F16), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f16
360-
sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f32
361-
sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f64
362-
sym::fmuladdf128 => ("fmaf128", 3, fx.tcx.types.f128, types::F128), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f128
358+
sym::fmuladdf16 => ("fmaf16", 3, fx.tcx.types.f16, types::F16), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f16
359+
sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f32
360+
sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f64
361+
sym::fmuladdf128 => ("fmaf128", 3, fx.tcx.types.f128, types::F128), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f128
363362
sym::copysignf16 => ("copysignf16", 2, fx.tcx.types.f16, types::F16),
364363
sym::copysignf32 => ("copysignf", 2, fx.tcx.types.f32, types::F32),
365364
sym::copysignf64 => ("copysign", 2, fx.tcx.types.f64, types::F64),
@@ -1267,7 +1266,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
12671266
ret.write_cvalue(fx, val);
12681267
}
12691268

1270-
sym::minnumf16 => {
1269+
sym::minimum_number_nsz_f16 => {
12711270
intrinsic_args!(fx, args => (a, b); intrinsic);
12721271
let a = a.load_scalar(fx);
12731272
let b = b.load_scalar(fx);
@@ -1276,7 +1275,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
12761275
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f16));
12771276
ret.write_cvalue(fx, val);
12781277
}
1279-
sym::minnumf32 => {
1278+
sym::minimum_number_nsz_f32 => {
12801279
intrinsic_args!(fx, args => (a, b); intrinsic);
12811280
let a = a.load_scalar(fx);
12821281
let b = b.load_scalar(fx);
@@ -1285,7 +1284,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
12851284
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f32));
12861285
ret.write_cvalue(fx, val);
12871286
}
1288-
sym::minnumf64 => {
1287+
sym::minimum_number_nsz_f64 => {
12891288
intrinsic_args!(fx, args => (a, b); intrinsic);
12901289
let a = a.load_scalar(fx);
12911290
let b = b.load_scalar(fx);
@@ -1294,7 +1293,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
12941293
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f64));
12951294
ret.write_cvalue(fx, val);
12961295
}
1297-
sym::minnumf128 => {
1296+
sym::minimum_number_nsz_f128 => {
12981297
intrinsic_args!(fx, args => (a, b); intrinsic);
12991298
let a = a.load_scalar(fx);
13001299
let b = b.load_scalar(fx);
@@ -1303,7 +1302,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
13031302
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f128));
13041303
ret.write_cvalue(fx, val);
13051304
}
1306-
sym::maxnumf16 => {
1305+
sym::maximum_number_nsz_f16 => {
13071306
intrinsic_args!(fx, args => (a, b); intrinsic);
13081307
let a = a.load_scalar(fx);
13091308
let b = b.load_scalar(fx);
@@ -1312,7 +1311,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
13121311
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f16));
13131312
ret.write_cvalue(fx, val);
13141313
}
1315-
sym::maxnumf32 => {
1314+
sym::maximum_number_nsz_f32 => {
13161315
intrinsic_args!(fx, args => (a, b); intrinsic);
13171316
let a = a.load_scalar(fx);
13181317
let b = b.load_scalar(fx);
@@ -1321,7 +1320,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
13211320
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f32));
13221321
ret.write_cvalue(fx, val);
13231322
}
1324-
sym::maxnumf64 => {
1323+
sym::maximum_number_nsz_f64 => {
13251324
intrinsic_args!(fx, args => (a, b); intrinsic);
13261325
let a = a.load_scalar(fx);
13271326
let b = b.load_scalar(fx);
@@ -1330,7 +1329,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
13301329
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f64));
13311330
ret.write_cvalue(fx, val);
13321331
}
1333-
sym::maxnumf128 => {
1332+
sym::maximum_number_nsz_f128 => {
13341333
intrinsic_args!(fx, args => (a, b); intrinsic);
13351334
let a = a.load_scalar(fx);
13361335
let b = b.load_scalar(fx);

src/num.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,10 @@ fn codegen_ptr_binop<'tcx>(
498498
}
499499
}
500500

501-
// In Rust floating point min and max don't propagate NaN. In Cranelift they do however.
502-
// For this reason it is necessary to use `a.is_nan() ? b : (a >= b ? b : a)` for `minnumf*`
503-
// and `a.is_nan() ? b : (a <= b ? b : a)` for `maxnumf*`. NaN checks are done by comparing
504-
// a float against itself. Only in case of NaN is it not equal to itself.
501+
// In Rust floating point min and max don't propagate NaN (not even SNaN). In Cranelift they do
502+
// however. For this reason it is necessary to use `a.is_nan() ? b : (a >= b ? b : a)` for
503+
// `minnumf*` and `a.is_nan() ? b : (a <= b ? b : a)` for `maxnumf*`. NaN checks are done by
504+
// comparing a float against itself. Only in case of NaN is it not equal to itself.
505505
pub(crate) fn codegen_float_min(fx: &mut FunctionCx<'_, '_, '_>, a: Value, b: Value) -> Value {
506506
// FIXME(bytecodealliance/wasmtime#8312): Replace with Cranelift `fcmp` once
507507
// `f16`/`f128` backend lowerings have been added to Cranelift.

0 commit comments

Comments
 (0)