Skip to content

Commit 47d6568

Browse files
authored
Merge pull request #4627 from RalfJung/rustup
Rustup
2 parents b2c2288 + 293a739 commit 47d6568

File tree

8 files changed

+51
-790
lines changed

8 files changed

+51
-790
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4fd31815524baba0bf368f151f757101f432e3de
1+
36e4f5d1fe1d63953a5bf1758ce2b64172623e2e

src/helpers.rs

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::{cmp, iter};
66
use rand::RngCore;
77
use rustc_abi::{Align, ExternAbi, FieldIdx, FieldsShape, Size, Variants};
88
use rustc_apfloat::Float;
9-
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
109
use rustc_hash::FxHashSet;
1110
use rustc_hir::Safety;
1211
use rustc_hir::def::{DefKind, Namespace};
@@ -16,7 +15,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
1615
use rustc_middle::middle::dependency_format::Linkage;
1716
use rustc_middle::middle::exported_symbols::ExportedSymbol;
1817
use rustc_middle::ty::layout::{LayoutOf, MaybeResult, TyAndLayout};
19-
use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, UintTy};
18+
use rustc_middle::ty::{self, IntTy, Ty, TyCtxt, UintTy};
2019
use rustc_session::config::CrateType;
2120
use rustc_span::{Span, Symbol};
2221
use rustc_symbol_mangling::mangle_internal_symbol;
@@ -966,75 +965,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
966965
this.alloc_mark_immutable(provenance.get_alloc_id().unwrap()).unwrap();
967966
}
968967

969-
/// Converts `src` from floating point to integer type `dest_ty`
970-
/// after rounding with mode `round`.
971-
/// Returns `None` if `f` is NaN or out of range.
972-
fn float_to_int_checked(
973-
&self,
974-
src: &ImmTy<'tcx>,
975-
cast_to: TyAndLayout<'tcx>,
976-
round: rustc_apfloat::Round,
977-
) -> InterpResult<'tcx, Option<ImmTy<'tcx>>> {
978-
let this = self.eval_context_ref();
979-
980-
fn float_to_int_inner<'tcx, F: rustc_apfloat::Float>(
981-
ecx: &MiriInterpCx<'tcx>,
982-
src: F,
983-
cast_to: TyAndLayout<'tcx>,
984-
round: rustc_apfloat::Round,
985-
) -> (Scalar, rustc_apfloat::Status) {
986-
let int_size = cast_to.layout.size;
987-
match cast_to.ty.kind() {
988-
// Unsigned
989-
ty::Uint(_) => {
990-
let res = src.to_u128_r(int_size.bits_usize(), round, &mut false);
991-
(Scalar::from_uint(res.value, int_size), res.status)
992-
}
993-
// Signed
994-
ty::Int(_) => {
995-
let res = src.to_i128_r(int_size.bits_usize(), round, &mut false);
996-
(Scalar::from_int(res.value, int_size), res.status)
997-
}
998-
// Nothing else
999-
_ =>
1000-
span_bug!(
1001-
ecx.cur_span(),
1002-
"attempted float-to-int conversion with non-int output type {}",
1003-
cast_to.ty,
1004-
),
1005-
}
1006-
}
1007-
1008-
let ty::Float(fty) = src.layout.ty.kind() else {
1009-
bug!("float_to_int_checked: non-float input type {}", src.layout.ty)
1010-
};
1011-
1012-
let (val, status) = match fty {
1013-
FloatTy::F16 =>
1014-
float_to_int_inner::<Half>(this, src.to_scalar().to_f16()?, cast_to, round),
1015-
FloatTy::F32 =>
1016-
float_to_int_inner::<Single>(this, src.to_scalar().to_f32()?, cast_to, round),
1017-
FloatTy::F64 =>
1018-
float_to_int_inner::<Double>(this, src.to_scalar().to_f64()?, cast_to, round),
1019-
FloatTy::F128 =>
1020-
float_to_int_inner::<Quad>(this, src.to_scalar().to_f128()?, cast_to, round),
1021-
};
1022-
1023-
if status.intersects(
1024-
rustc_apfloat::Status::INVALID_OP
1025-
| rustc_apfloat::Status::OVERFLOW
1026-
| rustc_apfloat::Status::UNDERFLOW,
1027-
) {
1028-
// Floating point value is NaN (flagged with INVALID_OP) or outside the range
1029-
// of values of the integer type (flagged with OVERFLOW or UNDERFLOW).
1030-
interp_ok(None)
1031-
} else {
1032-
// Floating point value can be represented by the integer type after rounding.
1033-
// The INEXACT flag is ignored on purpose to allow rounding.
1034-
interp_ok(Some(ImmTy::from_scalar(val, cast_to)))
1035-
}
1036-
}
1037-
1038968
/// Returns an integer type that is twice wide as `ty`
1039969
fn get_twice_wide_int_ty(&self, ty: Ty<'tcx>) -> Ty<'tcx> {
1040970
let this = self.eval_context_ref();
@@ -1199,20 +1129,6 @@ pub(crate) fn bool_to_simd_element(b: bool, size: Size) -> Scalar {
11991129
Scalar::from_int(val, size)
12001130
}
12011131

1202-
pub(crate) fn simd_element_to_bool(elem: ImmTy<'_>) -> InterpResult<'_, bool> {
1203-
assert!(
1204-
matches!(elem.layout.ty.kind(), ty::Int(_) | ty::Uint(_)),
1205-
"SIMD mask element type must be an integer, but this is `{}`",
1206-
elem.layout.ty
1207-
);
1208-
let val = elem.to_scalar().to_int(elem.layout.size)?;
1209-
interp_ok(match val {
1210-
0 => false,
1211-
-1 => true,
1212-
_ => throw_ub_format!("each element of a SIMD mask must be all-0-bits or all-1-bits"),
1213-
})
1214-
}
1215-
12161132
/// Check whether an operation that writes to a target buffer was successful.
12171133
/// Accordingly select return value.
12181134
/// Local helper function to be used in Windows shims.

src/intrinsics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
118118
return this.emulate_atomic_intrinsic(name, generic_args, args, dest);
119119
}
120120
if let Some(name) = intrinsic_name.strip_prefix("simd_") {
121-
return this.emulate_simd_intrinsic(name, generic_args, args, dest);
121+
return this.emulate_simd_intrinsic(name, args, dest);
122122
}
123123

124124
match intrinsic_name {

0 commit comments

Comments
 (0)