diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-09-15 17:07:29 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-09-15 17:07:29 +0000 |
| commit | cebdfe40adcbbfa8883ac1c2ea2933456b34cf90 (patch) | |
| tree | ae1d09e5df7613d735e5205253622fd67dfb3e39 | |
| parent | c7b49987a6555329925a558ada72810bf9e35fbc (diff) | |
| download | rust-cebdfe40adcbbfa8883ac1c2ea2933456b34cf90.tar.gz rust-cebdfe40adcbbfa8883ac1c2ea2933456b34cf90.zip | |
Slightly simplify the simd_shuffle impl
| -rw-r--r-- | src/intrinsics/simd.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/intrinsics/simd.rs b/src/intrinsics/simd.rs index a5621aec244..5972d9c6f6b 100644 --- a/src/intrinsics/simd.rs +++ b/src/intrinsics/simd.rs @@ -182,11 +182,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( // Make sure this is actually a SIMD vector. let idx_ty = fx.monomorphize(idx.node.ty(fx.mir, fx.tcx)); - let n: u16 = if idx_ty.is_simd() - && matches!(idx_ty.simd_size_and_type(fx.tcx).1.kind(), ty::Uint(ty::UintTy::U32)) + if !idx_ty.is_simd() + || !matches!(idx_ty.simd_size_and_type(fx.tcx).1.kind(), ty::Uint(ty::UintTy::U32)) { - idx_ty.simd_size_and_type(fx.tcx).0.try_into().unwrap() - } else { fx.tcx.dcx().span_err( span, format!("simd_shuffle index must be a SIMD vector of `u32`, got `{}`", idx_ty), @@ -195,6 +193,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); return; }; + let n: u16 = idx_ty.simd_size_and_type(fx.tcx).0.try_into().unwrap(); assert_eq!(x.layout(), y.layout()); let layout = x.layout(); |
