@@ -117,8 +117,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
117117 } ) ;
118118 }
119119
120- // simd_shuffle32 <T, U>(x: T, y: T, idx: [u32; 32] ) -> U
121- _ if intrinsic . as_str ( ) . starts_with ( " simd_shuffle" ) => {
120+ // simd_shuffle <T, I, U>(x: T, y: T, idx: I ) -> U
121+ sym :: simd_shuffle => {
122122 let ( x, y, idx) = match args {
123123 [ x, y, idx] => ( x, y, idx) ,
124124 _ => {
@@ -133,36 +133,26 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
133133 return ;
134134 }
135135
136- // If this intrinsic is the older "simd_shuffleN" form, simply parse the integer.
137- // If there is no suffix, use the index array length.
138- let n: u16 = if intrinsic == sym:: simd_shuffle {
139- // Make sure this is actually an array, since typeck only checks the length-suffixed
140- // version of this intrinsic.
141- let idx_ty = fx. monomorphize ( idx. ty ( fx. mir , fx. tcx ) ) ;
142- match idx_ty. kind ( ) {
143- ty:: Array ( ty, len) if matches ! ( ty. kind( ) , ty:: Uint ( ty:: UintTy :: U32 ) ) => len
144- . try_eval_target_usize ( fx. tcx , ty:: ParamEnv :: reveal_all ( ) )
145- . unwrap_or_else ( || {
146- span_bug ! ( span, "could not evaluate shuffle index array length" )
147- } )
148- . try_into ( )
149- . unwrap ( ) ,
150- _ => {
151- fx. tcx . sess . span_err (
152- span,
153- format ! (
154- "simd_shuffle index must be an array of `u32`, got `{}`" ,
155- idx_ty,
156- ) ,
157- ) ;
158- // Prevent verifier error
159- fx. bcx . ins ( ) . trap ( TrapCode :: UnreachableCodeReached ) ;
160- return ;
161- }
136+ // Make sure this is actually an array, since typeck only checks the length-suffixed
137+ // version of this intrinsic.
138+ let idx_ty = fx. monomorphize ( idx. ty ( fx. mir , fx. tcx ) ) ;
139+ let n: u16 = match idx_ty. kind ( ) {
140+ ty:: Array ( ty, len) if matches ! ( ty. kind( ) , ty:: Uint ( ty:: UintTy :: U32 ) ) => len
141+ . try_eval_target_usize ( fx. tcx , ty:: ParamEnv :: reveal_all ( ) )
142+ . unwrap_or_else ( || {
143+ span_bug ! ( span, "could not evaluate shuffle index array length" )
144+ } )
145+ . try_into ( )
146+ . unwrap ( ) ,
147+ _ => {
148+ fx. tcx . sess . span_err (
149+ span,
150+ format ! ( "simd_shuffle index must be an array of `u32`, got `{}`" , idx_ty) ,
151+ ) ;
152+ // Prevent verifier error
153+ fx. bcx . ins ( ) . trap ( TrapCode :: UnreachableCodeReached ) ;
154+ return ;
162155 }
163- } else {
164- // FIXME remove this case
165- intrinsic. as_str ( ) [ "simd_shuffle" . len ( ) ..] . parse ( ) . unwrap ( )
166156 } ;
167157
168158 assert_eq ! ( x. layout( ) , y. layout( ) ) ;
@@ -179,7 +169,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
179169 let indexes = {
180170 use rustc_middle:: mir:: interpret:: * ;
181171 let idx_const = crate :: constant:: mir_operand_get_const_val ( fx, idx)
182- . expect ( "simd_shuffle* idx not const" ) ;
172+ . expect ( "simd_shuffle idx not const" ) ;
183173
184174 let idx_bytes = match idx_const {
185175 ConstValue :: ByRef { alloc, offset } => {
0 commit comments