Skip to content
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

Rollup of 8 pull requests #114449

Merged
merged 18 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
287db04
Specify macro is invalid in certain contexts
Centri3 Jul 24, 2023
dece622
Recover from some macros
Centri3 Jul 24, 2023
c7db0f4
Migrate GUI colors test to original CSS color format
GuillaumeGomez Aug 1, 2023
bbd69e4
Add test for enum with fields
Centri3 Aug 2, 2023
d0ed4ed
Migrate GUI colors test to original CSS color format
GuillaumeGomez Aug 3, 2023
4457ef2
Forbid old-style `simd_shuffleN` intrinsics
oli-obk Jul 10, 2023
5992e9b
builtin impl confirmation wuhu
lcnr Aug 3, 2023
f15832f
compiletest: Handle non-utf8 paths (fix FIXME)
Enselic Aug 3, 2023
40729bc
Enable tests on rustc_codegen_ssa
ehuss Aug 3, 2023
2232fe8
unix/kernel_copy.rs: copy_file_range_candidate allows empty output files
xstaticxgpx Aug 2, 2023
f36a9b5
Rollup merge of #113534 - oli-obk:simd_shuffle_dehackify, r=workingju…
matthiaskrgr Aug 4, 2023
1f076fe
Rollup merge of #113999 - Centri3:macro-arm-expand, r=wesleywiser
matthiaskrgr Aug 4, 2023
fb15056
Rollup merge of #114348 - GuillaumeGomez:migrate-gui-test-color-25, r…
matthiaskrgr Aug 4, 2023
539fecb
Rollup merge of #114373 - xstaticxgpx:dev, r=the8472
matthiaskrgr Aug 4, 2023
472b273
Rollup merge of #114404 - GuillaumeGomez:migrate-gui-test-color-26, r…
matthiaskrgr Aug 4, 2023
eb19abf
Rollup merge of #114409 - lcnr:confirmation, r=compiler-errors
matthiaskrgr Aug 4, 2023
90d93c3
Rollup merge of #114429 - Enselic:compiletest-fix, r=est31
matthiaskrgr Aug 4, 2023
353e268
Rollup merge of #114431 - ehuss:ssa-test, r=est31
matthiaskrgr Aug 4, 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
54 changes: 22 additions & 32 deletions compiler/rustc_codegen_cranelift/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
Loading