@@ -117,8 +117,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
117
117
} ) ;
118
118
}
119
119
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 => {
122
122
let ( x, y, idx) = match args {
123
123
[ x, y, idx] => ( x, y, idx) ,
124
124
_ => {
@@ -133,36 +133,26 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
133
133
return ;
134
134
}
135
135
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 ;
162
155
}
163
- } else {
164
- // FIXME remove this case
165
- intrinsic. as_str ( ) [ "simd_shuffle" . len ( ) ..] . parse ( ) . unwrap ( )
166
156
} ;
167
157
168
158
assert_eq ! ( x. layout( ) , y. layout( ) ) ;
@@ -179,7 +169,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
179
169
let indexes = {
180
170
use rustc_middle:: mir:: interpret:: * ;
181
171
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" ) ;
183
173
184
174
let idx_bytes = match idx_const {
185
175
ConstValue :: ByRef { alloc, offset } => {
0 commit comments