@@ -14,7 +14,6 @@ use rustc_codegen_ssa::traits::{BaseTypeMethods, BuilderMethods};
1414#[ cfg( feature = "master" ) ]
1515use rustc_hir as hir;
1616use rustc_middle:: mir:: BinOp ;
17- use rustc_middle:: span_bug;
1817use rustc_middle:: ty:: layout:: HasTyCtxt ;
1918use rustc_middle:: ty:: { self , Ty } ;
2019use rustc_span:: { sym, Span , Symbol } ;
@@ -353,24 +352,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
353352 }
354353
355354 if name == sym:: simd_shuffle {
356- // Make sure this is actually an array or SIMD vector, since typeck only checks the length-suffixed
357- // version of this intrinsic.
355+ // Make sure this is actually a SIMD vector.
358356 let idx_ty = args[ 2 ] . layout . ty ;
359- let n: u64 = match idx_ty. kind ( ) {
360- ty:: Array ( ty, len) if matches ! ( * ty. kind( ) , ty:: Uint ( ty:: UintTy :: U32 ) ) => {
361- len. try_eval_target_usize ( bx. cx . tcx , ty:: ParamEnv :: reveal_all ( ) ) . unwrap_or_else (
362- || span_bug ! ( span, "could not evaluate shuffle index array length" ) ,
363- )
364- }
365- _ if idx_ty. is_simd ( )
366- && matches ! (
367- idx_ty. simd_size_and_type( bx. cx. tcx) . 1 . kind( ) ,
368- ty:: Uint ( ty:: UintTy :: U32 )
369- ) =>
370- {
371- idx_ty. simd_size_and_type ( bx. cx . tcx ) . 0
372- }
373- _ => return_error ! ( InvalidMonomorphization :: SimdShuffle { span, name, ty: idx_ty } ) ,
357+ let n: u64 = if idx_ty. is_simd ( )
358+ && matches ! ( idx_ty. simd_size_and_type( bx. cx. tcx) . 1 . kind( ) , ty:: Uint ( ty:: UintTy :: U32 ) )
359+ {
360+ idx_ty. simd_size_and_type ( bx. cx . tcx ) . 0
361+ } else {
362+ return_error ! ( InvalidMonomorphization :: SimdShuffle { span, name, ty: idx_ty } )
374363 } ;
375364 require_simd ! ( ret_ty, InvalidMonomorphization :: SimdReturn { span, name, ty: ret_ty } ) ;
376365
0 commit comments