Skip to content

Commit cebdfe4

Browse files
committed
Slightly simplify the simd_shuffle impl
1 parent c7b4998 commit cebdfe4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/intrinsics/simd.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
182182

183183
// Make sure this is actually a SIMD vector.
184184
let idx_ty = fx.monomorphize(idx.node.ty(fx.mir, fx.tcx));
185-
let n: u16 = if idx_ty.is_simd()
186-
&& matches!(idx_ty.simd_size_and_type(fx.tcx).1.kind(), ty::Uint(ty::UintTy::U32))
185+
if !idx_ty.is_simd()
186+
|| !matches!(idx_ty.simd_size_and_type(fx.tcx).1.kind(), ty::Uint(ty::UintTy::U32))
187187
{
188-
idx_ty.simd_size_and_type(fx.tcx).0.try_into().unwrap()
189-
} else {
190188
fx.tcx.dcx().span_err(
191189
span,
192190
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>(
195193
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
196194
return;
197195
};
196+
let n: u16 = idx_ty.simd_size_and_type(fx.tcx).0.try_into().unwrap();
198197

199198
assert_eq!(x.layout(), y.layout());
200199
let layout = x.layout();

0 commit comments

Comments
 (0)