@@ -337,31 +337,26 @@ pub fn coerce_unsized_into<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
337
337
338
338
pub fn cast_shift_expr_rhs < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > (
339
339
bx : & mut Bx ,
340
- op : hir:: BinOpKind ,
341
340
lhs : Bx :: Value ,
342
341
rhs : Bx :: Value ,
343
342
) -> Bx :: Value {
344
343
// Shifts may have any size int on the rhs
345
- if op. is_shift ( ) {
346
- let mut rhs_llty = bx. cx ( ) . val_ty ( rhs) ;
347
- let mut lhs_llty = bx. cx ( ) . val_ty ( lhs) ;
348
- if bx. cx ( ) . type_kind ( rhs_llty) == TypeKind :: Vector {
349
- rhs_llty = bx. cx ( ) . element_type ( rhs_llty)
350
- }
351
- if bx. cx ( ) . type_kind ( lhs_llty) == TypeKind :: Vector {
352
- lhs_llty = bx. cx ( ) . element_type ( lhs_llty)
353
- }
354
- let rhs_sz = bx. cx ( ) . int_width ( rhs_llty) ;
355
- let lhs_sz = bx. cx ( ) . int_width ( lhs_llty) ;
356
- if lhs_sz < rhs_sz {
357
- bx. trunc ( rhs, lhs_llty)
358
- } else if lhs_sz > rhs_sz {
359
- // FIXME (#1877: If in the future shifting by negative
360
- // values is no longer undefined then this is wrong.
361
- bx. zext ( rhs, lhs_llty)
362
- } else {
363
- rhs
364
- }
344
+ let mut rhs_llty = bx. cx ( ) . val_ty ( rhs) ;
345
+ let mut lhs_llty = bx. cx ( ) . val_ty ( lhs) ;
346
+ if bx. cx ( ) . type_kind ( rhs_llty) == TypeKind :: Vector {
347
+ rhs_llty = bx. cx ( ) . element_type ( rhs_llty)
348
+ }
349
+ if bx. cx ( ) . type_kind ( lhs_llty) == TypeKind :: Vector {
350
+ lhs_llty = bx. cx ( ) . element_type ( lhs_llty)
351
+ }
352
+ let rhs_sz = bx. cx ( ) . int_width ( rhs_llty) ;
353
+ let lhs_sz = bx. cx ( ) . int_width ( lhs_llty) ;
354
+ if lhs_sz < rhs_sz {
355
+ bx. trunc ( rhs, lhs_llty)
356
+ } else if lhs_sz > rhs_sz {
357
+ // FIXME (#1877: If in the future shifting by negative
358
+ // values is no longer undefined then this is wrong.
359
+ bx. zext ( rhs, lhs_llty)
365
360
} else {
366
361
rhs
367
362
}
0 commit comments