@@ -1172,8 +1172,8 @@ fn generic_simd_intrinsic(
1172
1172
let m_len = match in_ty. kind {
1173
1173
// Note that this `.unwrap()` crashes for isize/usize, that's sort
1174
1174
// 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 ( ) ,
1177
1177
_ => return_error ! ( "`{}` is not an integral type" , in_ty) ,
1178
1178
} ;
1179
1179
require_simd ! ( arg_tys[ 1 ] , "argument" ) ;
@@ -1354,20 +1354,18 @@ fn generic_simd_intrinsic(
1354
1354
// trailing bits.
1355
1355
let expected_int_bits = in_len. max ( 8 ) ;
1356
1356
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) => ( ) ,
1358
1358
_ => return_error ! ( "bitmask `{}`, expected `u{}`" , ret_ty, expected_int_bits) ,
1359
1359
}
1360
1360
1361
1361
// Integer vector <i{in_bitwidth} x in_len>:
1362
1362
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
+ }
1371
1369
_ => return_error ! (
1372
1370
"vector argument `{}`'s element type `{}`, expected integer element type" ,
1373
1371
in_ty,
@@ -1378,16 +1376,16 @@ fn generic_simd_intrinsic(
1378
1376
// Shift the MSB to the right by "in_elem_bitwidth - 1" into the first bit position.
1379
1377
let shift_indices =
1380
1378
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 _) ;
1382
1380
in_len as _
1383
1381
] ;
1384
1382
let i_xn_msb = bx. lshr ( i_xn, bx. const_vector ( shift_indices. as_slice ( ) ) ) ;
1385
1383
// 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) ) ;
1387
1385
// 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) ) ;
1389
1387
// 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) ) ) ;
1391
1389
}
1392
1390
1393
1391
fn simd_simple_float_intrinsic (
@@ -2099,7 +2097,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
2099
2097
match ty. kind {
2100
2098
ty:: Int ( t) => Some ( (
2101
2099
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 ) ,
2103
2101
ast:: IntTy :: I8 => 8 ,
2104
2102
ast:: IntTy :: I16 => 16 ,
2105
2103
ast:: IntTy :: I32 => 32 ,
@@ -2110,7 +2108,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
2110
2108
) ) ,
2111
2109
ty:: Uint ( t) => Some ( (
2112
2110
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 ) ,
2114
2112
ast:: UintTy :: U8 => 8 ,
2115
2113
ast:: UintTy :: U16 => 16 ,
2116
2114
ast:: UintTy :: U32 => 32 ,
@@ -2127,7 +2125,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo
2127
2125
// Returns None if the type is not a float
2128
2126
fn float_type_width ( ty : Ty < ' _ > ) -> Option < u64 > {
2129
2127
match ty. kind {
2130
- ty:: Float ( t) => Some ( t. bit_width ( ) as u64 ) ,
2128
+ ty:: Float ( t) => Some ( t. bit_width ( ) ) ,
2131
2129
_ => None ,
2132
2130
}
2133
2131
}
0 commit comments