Skip to content
Merged

Rustup #4627

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d1afd39
Auto merge of #147423 - nnethercote:DepNodeColor-tweaks, r=cjgillot
bors Oct 8, 2025
e1678ab
Port the Miri implementations of SIMD intrinsics to `rustc_const_eval`
sayantn Oct 8, 2025
b8cda32
Auto merge of #143227 - tshepang:asm-label-operand, r=Amanieu
bors Oct 9, 2025
811fbad
Rollup merge of #146568 - sayantn:simd-shuffle, r=RalfJung
Zalathar Oct 9, 2025
701164c
Rollup merge of #147373 - cyrgani:cyrgani-patch-1, r=ibraheemdev
Zalathar Oct 9, 2025
c198f4b
Rollup merge of #147419 - cuviper:bootstrap-rustc-libs, r=Zalathar,ji…
Zalathar Oct 9, 2025
3d9664b
Rollup merge of #147420 - samueltardieu:diag-items/consts-mod, r=joboet
Zalathar Oct 9, 2025
3b71054
Rollup merge of #147457 - the8472:slice_fill_memset2, r=RalfJung,joboet
Zalathar Oct 9, 2025
fd2a291
Rollup merge of #147467 - JonathanBrouwer:double_warnings, r=Jonathan…
Zalathar Oct 9, 2025
dc66f88
Rollup merge of #147470 - ia0:immediate-abort, r=Mark-Simulacrum
Zalathar Oct 9, 2025
5b28e9b
Rollup merge of #147480 - cjgillot:invalidate-ctfelimit, r=tmiasko
Zalathar Oct 9, 2025
2295d48
Rollup merge of #147481 - hkBst:format-1, r=jackh726
Zalathar Oct 9, 2025
77cbc51
Rollup merge of #147488 - AMS21:remove_llvm_rust_insert_private_globa…
Zalathar Oct 9, 2025
d08efe8
Rollup merge of #147489 - chenyukang:yukang-prefer-repeat-n, r=Kivooe…
Zalathar Oct 9, 2025
b17aa3f
Rollup merge of #147506 - Zalathar:isolate, r=jieyouxu
Zalathar Oct 9, 2025
c6ea29f
Auto merge of #147512 - Zalathar:rollup-p8kb5f7, r=Zalathar
bors Oct 9, 2025
489d9b8
Auto merge of #147519 - Zalathar:rollup-o5f16uo, r=Zalathar
bors Oct 9, 2025
1c303a9
Auto merge of #147483 - cjgillot:reorder-passes, r=nnethercote
bors Oct 9, 2025
dcab89c
Auto merge of #147447 - madsmtm:aarch64-watchos-default-deployment-ta…
bors Oct 9, 2025
9fcce61
Auto merge of #147124 - a1phyr:improve_finish_grow, r=Mark-Simulacrum
bors Oct 11, 2025
f7f9afa
Silence warning in miri tests.
cjgillot Jul 3, 2025
5e882cb
Auto merge of #145513 - beepster4096:erasedereftemps, r=saethlin,cjgi…
bors Oct 12, 2025
1f1a316
Auto merge of #142390 - cjgillot:mir-liveness, r=davidtwco
bors Oct 12, 2025
ebb8df6
Auto merge of #146096 - adwinwhite:handle_normalization_overflow_in_m…
bors Oct 13, 2025
885c077
Prepare for merging from rust-lang/rust
RalfJung Oct 13, 2025
fbfe15c
Merge ref '36e4f5d1fe1d' from rust-lang/rust
RalfJung Oct 13, 2025
d1b06f1
fmt
RalfJung Oct 13, 2025
293a739
avoid blanket allow(unused)
RalfJung Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4fd31815524baba0bf368f151f757101f432e3de
36e4f5d1fe1d63953a5bf1758ce2b64172623e2e
86 changes: 1 addition & 85 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{cmp, iter};
use rand::RngCore;
use rustc_abi::{Align, ExternAbi, FieldIdx, FieldsShape, Size, Variants};
use rustc_apfloat::Float;
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
use rustc_hash::FxHashSet;
use rustc_hir::Safety;
use rustc_hir::def::{DefKind, Namespace};
Expand All @@ -16,7 +15,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::middle::dependency_format::Linkage;
use rustc_middle::middle::exported_symbols::ExportedSymbol;
use rustc_middle::ty::layout::{LayoutOf, MaybeResult, TyAndLayout};
use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, UintTy};
use rustc_middle::ty::{self, IntTy, Ty, TyCtxt, UintTy};
use rustc_session::config::CrateType;
use rustc_span::{Span, Symbol};
use rustc_symbol_mangling::mangle_internal_symbol;
Expand Down Expand Up @@ -966,75 +965,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
this.alloc_mark_immutable(provenance.get_alloc_id().unwrap()).unwrap();
}

/// Converts `src` from floating point to integer type `dest_ty`
/// after rounding with mode `round`.
/// Returns `None` if `f` is NaN or out of range.
fn float_to_int_checked(
&self,
src: &ImmTy<'tcx>,
cast_to: TyAndLayout<'tcx>,
round: rustc_apfloat::Round,
) -> InterpResult<'tcx, Option<ImmTy<'tcx>>> {
let this = self.eval_context_ref();

fn float_to_int_inner<'tcx, F: rustc_apfloat::Float>(
ecx: &MiriInterpCx<'tcx>,
src: F,
cast_to: TyAndLayout<'tcx>,
round: rustc_apfloat::Round,
) -> (Scalar, rustc_apfloat::Status) {
let int_size = cast_to.layout.size;
match cast_to.ty.kind() {
// Unsigned
ty::Uint(_) => {
let res = src.to_u128_r(int_size.bits_usize(), round, &mut false);
(Scalar::from_uint(res.value, int_size), res.status)
}
// Signed
ty::Int(_) => {
let res = src.to_i128_r(int_size.bits_usize(), round, &mut false);
(Scalar::from_int(res.value, int_size), res.status)
}
// Nothing else
_ =>
span_bug!(
ecx.cur_span(),
"attempted float-to-int conversion with non-int output type {}",
cast_to.ty,
),
}
}

let ty::Float(fty) = src.layout.ty.kind() else {
bug!("float_to_int_checked: non-float input type {}", src.layout.ty)
};

let (val, status) = match fty {
FloatTy::F16 =>
float_to_int_inner::<Half>(this, src.to_scalar().to_f16()?, cast_to, round),
FloatTy::F32 =>
float_to_int_inner::<Single>(this, src.to_scalar().to_f32()?, cast_to, round),
FloatTy::F64 =>
float_to_int_inner::<Double>(this, src.to_scalar().to_f64()?, cast_to, round),
FloatTy::F128 =>
float_to_int_inner::<Quad>(this, src.to_scalar().to_f128()?, cast_to, round),
};

if status.intersects(
rustc_apfloat::Status::INVALID_OP
| rustc_apfloat::Status::OVERFLOW
| rustc_apfloat::Status::UNDERFLOW,
) {
// Floating point value is NaN (flagged with INVALID_OP) or outside the range
// of values of the integer type (flagged with OVERFLOW or UNDERFLOW).
interp_ok(None)
} else {
// Floating point value can be represented by the integer type after rounding.
// The INEXACT flag is ignored on purpose to allow rounding.
interp_ok(Some(ImmTy::from_scalar(val, cast_to)))
}
}

/// Returns an integer type that is twice wide as `ty`
fn get_twice_wide_int_ty(&self, ty: Ty<'tcx>) -> Ty<'tcx> {
let this = self.eval_context_ref();
Expand Down Expand Up @@ -1199,20 +1129,6 @@ pub(crate) fn bool_to_simd_element(b: bool, size: Size) -> Scalar {
Scalar::from_int(val, size)
}

pub(crate) fn simd_element_to_bool(elem: ImmTy<'_>) -> InterpResult<'_, bool> {
assert!(
matches!(elem.layout.ty.kind(), ty::Int(_) | ty::Uint(_)),
"SIMD mask element type must be an integer, but this is `{}`",
elem.layout.ty
);
let val = elem.to_scalar().to_int(elem.layout.size)?;
interp_ok(match val {
0 => false,
-1 => true,
_ => throw_ub_format!("each element of a SIMD mask must be all-0-bits or all-1-bits"),
})
}

/// Check whether an operation that writes to a target buffer was successful.
/// Accordingly select return value.
/// Local helper function to be used in Windows shims.
Expand Down
2 changes: 1 addition & 1 deletion src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
return this.emulate_atomic_intrinsic(name, generic_args, args, dest);
}
if let Some(name) = intrinsic_name.strip_prefix("simd_") {
return this.emulate_simd_intrinsic(name, generic_args, args, dest);
return this.emulate_simd_intrinsic(name, args, dest);
}

match intrinsic_name {
Expand Down
Loading