Skip to content

Sync rustc_codegen_cranelift #114666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Aug 9, 2023
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e8168ce
Merge commit '1eded3619d0e55d57521a259bf27a03906fdfad0' into sync_cg_…
bjorn3 Jul 22, 2023
3f533f4
Merge branch 'sync_from_rust'
bjorn3 Jul 22, 2023
9a0c174
Add weekly cargo-audit CI run
bjorn3 Jul 24, 2023
0b1a9d7
Speed up audit workflow
bjorn3 Jul 24, 2023
e5197cf
Switch the build system from super:: to crate::
bjorn3 Jul 24, 2023
6641b3a
Update requirements section of build_system/usage.txt
bjorn3 Jul 24, 2023
92fb9c6
Pass `preserve_frame_pointers` to Cranelift
Kobzol Jul 29, 2023
85a99b3
Merge pull request #1388 from Kobzol/preserve-frame-pointer
bjorn3 Jul 29, 2023
68f7b82
Use CARGO_ENCODED_RUSTFLAGS to support paths with spaces
bjorn3 Aug 2, 2023
2876bb8
Forbid old-style `simd_shuffleN` intrinsics
oli-obk Jul 10, 2023
80f2b01
Fix ICE failed to get layout for ReferencesError
chenyukang Aug 4, 2023
88a79c6
Rollup merge of #114450 - chenyukang:yukang-fix-114435, r=compiler-er…
matthiaskrgr Aug 4, 2023
3f92261
Generate better function argument names in global_allocator expansion
dtolnay Aug 6, 2023
4e958a5
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly
scottmcm Aug 2, 2023
659fabd
Apply suggestions from code review
scottmcm Aug 4, 2023
5dd98a4
Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot
matthiaskrgr Aug 7, 2023
8298811
Sync from rust 03a119b0b0e310d22d94399b24ed030056050f13
bjorn3 Aug 8, 2023
3deb6c6
Rustup to rustc 1.73.0-nightly (03a119b0b 2023-08-07)
bjorn3 Aug 9, 2023
716dcb7
Fix rustc test suite
bjorn3 Aug 9, 2023
8f9ac9c
Fix MinGW
bjorn3 Aug 9, 2023
3775189
Merge commit '8f9ac9c22d6594cf059d8e6c71d414cc5ccd7975' into sync_cg_…
bjorn3 Aug 9, 2023
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
Prev Previous commit
Next Next commit
Forbid old-style simd_shuffleN intrinsics
  • Loading branch information
oli-obk committed Aug 3, 2023
commit 2876bb84819fbf39dbda52aad1fb19edcb0f1824
54 changes: 22 additions & 32 deletions src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
});
}

// simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U
_ if intrinsic.as_str().starts_with("simd_shuffle") => {
// simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U
sym::simd_shuffle => {
let (x, y, idx) = match args {
[x, y, idx] => (x, y, idx),
_ => {
Expand All @@ -133,36 +133,26 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
return;
}

// If this intrinsic is the older "simd_shuffleN" form, simply parse the integer.
// If there is no suffix, use the index array length.
let n: u16 = if intrinsic == sym::simd_shuffle {
// Make sure this is actually an array, since typeck only checks the length-suffixed
// version of this intrinsic.
let idx_ty = fx.monomorphize(idx.ty(fx.mir, fx.tcx));
match idx_ty.kind() {
ty::Array(ty, len) if matches!(ty.kind(), ty::Uint(ty::UintTy::U32)) => len
.try_eval_target_usize(fx.tcx, ty::ParamEnv::reveal_all())
.unwrap_or_else(|| {
span_bug!(span, "could not evaluate shuffle index array length")
})
.try_into()
.unwrap(),
_ => {
fx.tcx.sess.span_err(
span,
format!(
"simd_shuffle index must be an array of `u32`, got `{}`",
idx_ty,
),
);
// Prevent verifier error
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
return;
}
// Make sure this is actually an array, since typeck only checks the length-suffixed
// version of this intrinsic.
let idx_ty = fx.monomorphize(idx.ty(fx.mir, fx.tcx));
let n: u16 = match idx_ty.kind() {
ty::Array(ty, len) if matches!(ty.kind(), ty::Uint(ty::UintTy::U32)) => len
.try_eval_target_usize(fx.tcx, ty::ParamEnv::reveal_all())
.unwrap_or_else(|| {
span_bug!(span, "could not evaluate shuffle index array length")
})
.try_into()
.unwrap(),
_ => {
fx.tcx.sess.span_err(
span,
format!("simd_shuffle index must be an array of `u32`, got `{}`", idx_ty),
);
// Prevent verifier error
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
return;
}
} else {
// FIXME remove this case
intrinsic.as_str()["simd_shuffle".len()..].parse().unwrap()
};

assert_eq!(x.layout(), y.layout());
Expand All @@ -179,7 +169,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
let indexes = {
use rustc_middle::mir::interpret::*;
let idx_const = crate::constant::mir_operand_get_const_val(fx, idx)
.expect("simd_shuffle* idx not const");
.expect("simd_shuffle idx not const");

let idx_bytes = match idx_const {
ConstValue::ByRef { alloc, offset } => {
Expand Down