@@ -268,10 +268,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
268268 let val = codegen_operand ( fx, & val. node ) ;
269269
270270 // FIXME validate
271- let idx_const = if let Some ( idx_const) =
272- crate :: constant:: mir_operand_get_const_val ( fx, & idx. node )
273- {
274- idx_const
271+ let idx_const = if let Some ( idx_const) = idx. node . constant ( ) {
272+ crate :: constant:: eval_mir_constant ( fx, idx_const) . 0 . try_to_scalar_int ( ) . unwrap ( )
275273 } else {
276274 fx. tcx . dcx ( ) . span_fatal ( span, "Index argument for `simd_insert` is not a constant" ) ;
277275 } ;
@@ -304,22 +302,12 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
304302 return ;
305303 }
306304
307- let idx_const = if let Some ( idx_const) =
308- crate :: constant:: mir_operand_get_const_val ( fx, & idx. node )
309- {
310- idx_const
305+ let idx_const = if let Some ( idx_const) = idx. node . constant ( ) {
306+ crate :: constant:: eval_mir_constant ( fx, idx_const) . 0 . try_to_scalar_int ( ) . unwrap ( )
311307 } else {
312- fx. tcx . dcx ( ) . span_warn ( span, "Index argument for `simd_extract` is not a constant" ) ;
313- let trap_block = fx. bcx . create_block ( ) ;
314- let true_ = fx. bcx . ins ( ) . iconst ( types:: I8 , 1 ) ;
315- let ret_block = fx. get_block ( target) ;
316- fx. bcx . ins ( ) . brif ( true_, trap_block, & [ ] , ret_block, & [ ] ) ;
317- fx. bcx . switch_to_block ( trap_block) ;
318- crate :: trap:: trap_unimplemented (
319- fx,
320- "Index argument for `simd_extract` is not a constant" ,
321- ) ;
322- return ;
308+ fx. tcx
309+ . dcx ( )
310+ . span_fatal ( span, "Index argument for `simd_extract` is not a constant" ) ;
323311 } ;
324312
325313 let idx = idx_const. to_u32 ( ) ;
0 commit comments