diff options
| author | bors <bors@rust-lang.org> | 2023-08-04 05:34:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-04 05:34:47 +0000 |
| commit | 098c1db7e55e7229a520a2ec8e460e1e300e109b (patch) | |
| tree | 50f220915c64405a877ba4bf0f726d3eefd62b61 /compiler/rustc_codegen_llvm/src | |
| parent | a7caaae9fbef81325887aea060fc551da4589c6f (diff) | |
| parent | 353e26869f9b6672089abcd7516b11a4a2a4c375 (diff) | |
| download | rust-098c1db7e55e7229a520a2ec8e460e1e300e109b.tar.gz rust-098c1db7e55e7229a520a2ec8e460e1e300e109b.zip | |
Auto merge of #114449 - matthiaskrgr:rollup-cekswes, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #113534 (Forbid old-style `simd_shuffleN` intrinsics) - #113999 (Specify macro is invalid in certain contexts) - #114348 (Migrate GUI colors test to original CSS color format) - #114373 (unix/kernel_copy.rs: copy_file_range_candidate allows empty output files) - #114404 (Migrate GUI colors test to original CSS color format) - #114409 (builtin impl confirmation wuhu) - #114429 (compiletest: Handle non-utf8 paths (fix FIXME)) - #114431 (Enable tests on rustc_codegen_ssa) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 86c39ab5e94..6f1e4c5178a 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1020,28 +1020,20 @@ fn generic_simd_intrinsic<'ll, 'tcx>( )); } - if let Some(stripped) = name.as_str().strip_prefix("simd_shuffle") { - // 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: u64 = if stripped.is_empty() { - // Make sure this is actually an array, since typeck only checks the length-suffixed - // version of this intrinsic. - match args[2].layout.ty.kind() { - ty::Array(ty, len) if matches!(ty.kind(), ty::Uint(ty::UintTy::U32)) => { - len.try_eval_target_usize(bx.cx.tcx, ty::ParamEnv::reveal_all()).unwrap_or_else( - || span_bug!(span, "could not evaluate shuffle index array length"), - ) - } - _ => return_error!(InvalidMonomorphization::SimdShuffle { - span, - name, - ty: args[2].layout.ty - }), + if name == sym::simd_shuffle { + // Make sure this is actually an array, since typeck only checks the length-suffixed + // version of this intrinsic. + let n: u64 = match args[2].layout.ty.kind() { + ty::Array(ty, len) if matches!(ty.kind(), ty::Uint(ty::UintTy::U32)) => { + len.try_eval_target_usize(bx.cx.tcx, ty::ParamEnv::reveal_all()).unwrap_or_else( + || span_bug!(span, "could not evaluate shuffle index array length"), + ) } - } else { - stripped.parse().unwrap_or_else(|_| { - span_bug!(span, "bad `simd_shuffle` instruction only caught in codegen?") - }) + _ => return_error!(InvalidMonomorphization::SimdShuffle { + span, + name, + ty: args[2].layout.ty + }), }; require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty }); |
