@@ -180,34 +180,20 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
180180 return ;
181181 }
182182
183- // Make sure this is actually an array, since typeck only checks the length-suffixed
184- // version of this intrinsic.
183+ // Make sure this is actually a SIMD vector.
185184 let idx_ty = fx. monomorphize ( idx. node . ty ( fx. mir , fx. tcx ) ) ;
186- let n: u16 = match idx_ty. kind ( ) {
187- ty:: Array ( ty, len) if matches ! ( ty. kind( ) , ty:: Uint ( ty:: UintTy :: U32 ) ) => len
188- . try_eval_target_usize ( fx. tcx , ty:: ParamEnv :: reveal_all ( ) )
189- . unwrap_or_else ( || {
190- span_bug ! ( span, "could not evaluate shuffle index array length" )
191- } )
192- . try_into ( )
193- . unwrap ( ) ,
194- _ if idx_ty. is_simd ( )
195- && matches ! (
196- idx_ty. simd_size_and_type( fx. tcx) . 1 . kind( ) ,
197- ty:: Uint ( ty:: UintTy :: U32 )
198- ) =>
199- {
200- idx_ty. simd_size_and_type ( fx. tcx ) . 0 . try_into ( ) . unwrap ( )
201- }
202- _ => {
203- fx. tcx . dcx ( ) . span_err (
204- span,
205- format ! ( "simd_shuffle index must be an array of `u32`, got `{}`" , idx_ty) ,
206- ) ;
207- // Prevent verifier error
208- fx. bcx . ins ( ) . trap ( TrapCode :: UnreachableCodeReached ) ;
209- return ;
210- }
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 ) )
187+ {
188+ idx_ty. simd_size_and_type ( fx. tcx ) . 0 . try_into ( ) . unwrap ( )
189+ } else {
190+ fx. tcx . dcx ( ) . span_err (
191+ span,
192+ format ! ( "simd_shuffle index must be a SIMD vector of `u32`, got `{}`" , idx_ty) ,
193+ ) ;
194+ // Prevent verifier error
195+ fx. bcx . ins ( ) . trap ( TrapCode :: UnreachableCodeReached ) ;
196+ return ;
211197 } ;
212198
213199 assert_eq ! ( x. layout( ) , y. layout( ) ) ;
0 commit comments