@@ -1172,8 +1172,8 @@ fn generic_simd_intrinsic(
11721172 let m_len = match in_ty. kind {
11731173 // Note that this `.unwrap()` crashes for isize/usize, that's sort
11741174 // of intentional as there's not currently a use case for that.
1175- ty:: Int ( i) => i. bit_width ( ) . unwrap ( ) as u64 ,
1176- ty:: Uint ( i) => i. bit_width ( ) . unwrap ( ) as u64 ,
1175+ ty:: Int ( i) => i. bit_width ( ) . unwrap ( ) ,
1176+ ty:: Uint ( i) => i. bit_width ( ) . unwrap ( ) ,
11771177 _ => return_error ! ( "`{}` is not an integral type" , in_ty) ,
11781178 } ;
11791179 require_simd ! ( arg_tys[ 1 ] , "argument" ) ;
@@ -1354,20 +1354,18 @@ fn generic_simd_intrinsic(
13541354 // trailing bits.
13551355 let expected_int_bits = in_len. max ( 8 ) ;
13561356 match ret_ty. kind {
1357- ty:: Uint ( i) if i. bit_width ( ) == Some ( expected_int_bits as usize ) => ( ) ,
1357+ ty:: Uint ( i) if i. bit_width ( ) == Some ( expected_int_bits) => ( ) ,
13581358 _ => return_error ! ( "bitmask `{}`, expected `u{}`" , ret_ty, expected_int_bits) ,
13591359 }
13601360
13611361 // Integer vector <i{in_bitwidth} x in_len>:
13621362 let ( i_xn, in_elem_bitwidth) = match in_elem. kind {
1363- ty:: Int ( i) => (
1364- args[ 0 ] . immediate ( ) ,
1365- i. bit_width ( ) . unwrap_or ( bx. data_layout ( ) . pointer_size . bits ( ) as _ ) ,
1366- ) ,
1367- ty:: Uint ( i) => (
1368- args[ 0 ] . immediate ( ) ,
1369- i. bit_width ( ) . unwrap_or ( bx. data_layout ( ) . pointer_size . bits ( ) as _ ) ,
1370- ) ,
1363+ ty:: Int ( i) => {
1364+ ( args[ 0 ] . immediate ( ) , i. bit_width ( ) . unwrap_or ( bx. data_layout ( ) . pointer_size . bits ( ) ) )
1365+ }
1366+ ty:: Uint ( i) => {
1367+ ( args[ 0 ] . immediate ( ) , i. bit_width ( ) . unwrap_or ( bx. data_layout ( ) . pointer_size . bits ( ) ) )
1368+ }
13711369 _ => return_error ! (
13721370 "vector argument `{}`'s element type `{}`, expected integer element type" ,
13731371 in_ty,
@@ -1378,16 +1376,16 @@ fn generic_simd_intrinsic(
13781376 // Shift the MSB to the right by "in_elem_bitwidth - 1" into the first bit position.
13791377 let shift_indices =
13801378 vec ! [
1381- bx. cx. const_int( bx. type_ix( in_elem_bitwidth as _ ) , ( in_elem_bitwidth - 1 ) as _) ;
1379+ bx. cx. const_int( bx. type_ix( in_elem_bitwidth) , ( in_elem_bitwidth - 1 ) as _) ;
13821380 in_len as _
13831381 ] ;
13841382 let i_xn_msb = bx. lshr ( i_xn, bx. const_vector ( shift_indices. as_slice ( ) ) ) ;
13851383 // Truncate vector to an <i1 x N>
1386- let i1xn = bx. trunc ( i_xn_msb, bx. type_vector ( bx. type_i1 ( ) , in_len as _ ) ) ;
1384+ let i1xn = bx. trunc ( i_xn_msb, bx. type_vector ( bx. type_i1 ( ) , in_len) ) ;
13871385 // Bitcast <i1 x N> to iN:
1388- let i_ = bx. bitcast ( i1xn, bx. type_ix ( in_len as _ ) ) ;
1386+ let i_ = bx. bitcast ( i1xn, bx. type_ix ( in_len) ) ;
13891387 // Zero-extend iN to the bitmask type:
1390- return Ok ( bx. zext ( i_, bx. type_ix ( expected_int_bits as _ ) ) ) ;
1388+ return Ok ( bx. zext ( i_, bx. type_ix ( expected_int_bits) ) ) ;
13911389 }
13921390
13931391 fn simd_simple_float_intrinsic (
@@ -2099,7 +2097,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
20992097 match ty. kind {
21002098 ty:: Int ( t) => Some ( (
21012099 match t {
2102- ast:: IntTy :: Isize => cx. tcx . sess . target . ptr_width as u64 ,
2100+ ast:: IntTy :: Isize => u64 :: from ( cx. tcx . sess . target . ptr_width ) ,
21032101 ast:: IntTy :: I8 => 8 ,
21042102 ast:: IntTy :: I16 => 16 ,
21052103 ast:: IntTy :: I32 => 32 ,
@@ -2110,7 +2108,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
21102108 ) ) ,
21112109 ty:: Uint ( t) => Some ( (
21122110 match t {
2113- ast:: UintTy :: Usize => cx. tcx . sess . target . ptr_width as u64 ,
2111+ ast:: UintTy :: Usize => u64 :: from ( cx. tcx . sess . target . ptr_width ) ,
21142112 ast:: UintTy :: U8 => 8 ,
21152113 ast:: UintTy :: U16 => 16 ,
21162114 ast:: UintTy :: U32 => 32 ,
@@ -2127,7 +2125,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
21272125// Returns None if the type is not a float
21282126fn float_type_width ( ty : Ty < ' _ > ) -> Option < u64 > {
21292127 match ty. kind {
2130- ty:: Float ( t) => Some ( t. bit_width ( ) as u64 ) ,
2128+ ty:: Float ( t) => Some ( t. bit_width ( ) ) ,
21312129 _ => None ,
21322130 }
21332131}
0 commit comments