@@ -611,9 +611,6 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
611611 let ( val, has_overflow) = checked_res. load_scalar_pair( fx) ;
612612 let clif_ty = fx. clif_type( T ) . unwrap( ) ;
613613
614- // `select.i8` is not implemented by Cranelift.
615- let has_overflow = fx. bcx. ins( ) . uextend( types:: I32 , has_overflow) ;
616-
617614 let ( min, max) = type_min_max_value( & mut fx. bcx, clif_ty, signed) ;
618615
619616 let val = match ( intrinsic, signed) {
@@ -640,21 +637,11 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
640637 } ;
641638 rotate_left, <T >( v x, v y) {
642639 let layout = fx. layout_of( T ) ;
643- let y = if fx. bcx. func. dfg. value_type( y) == types:: I128 {
644- fx. bcx. ins( ) . ireduce( types:: I64 , y)
645- } else {
646- y
647- } ;
648640 let res = fx. bcx. ins( ) . rotl( x, y) ;
649641 ret. write_cvalue( fx, CValue :: by_val( res, layout) ) ;
650642 } ;
651643 rotate_right, <T >( v x, v y) {
652644 let layout = fx. layout_of( T ) ;
653- let y = if fx. bcx. func. dfg. value_type( y) == types:: I128 {
654- fx. bcx. ins( ) . ireduce( types:: I64 , y)
655- } else {
656- y
657- } ;
658645 let res = fx. bcx. ins( ) . rotr( x, y) ;
659646 ret. write_cvalue( fx, CValue :: by_val( res, layout) ) ;
660647 } ;
@@ -692,35 +679,13 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
692679 } ;
693680 ctlz | ctlz_nonzero, <T > ( v arg) {
694681 // FIXME trap on `ctlz_nonzero` with zero arg.
695- let res = if T == fx. tcx. types. u128 || T == fx. tcx. types. i128 {
696- // FIXME verify this algorithm is correct
697- let ( lsb, msb) = fx. bcx. ins( ) . isplit( arg) ;
698- let lsb_lz = fx. bcx. ins( ) . clz( lsb) ;
699- let msb_lz = fx. bcx. ins( ) . clz( msb) ;
700- let msb_is_zero = fx. bcx. ins( ) . icmp_imm( IntCC :: Equal , msb, 0 ) ;
701- let lsb_lz_plus_64 = fx. bcx. ins( ) . iadd_imm( lsb_lz, 64 ) ;
702- let res = fx. bcx. ins( ) . select( msb_is_zero, lsb_lz_plus_64, msb_lz) ;
703- fx. bcx. ins( ) . uextend( types:: I128 , res)
704- } else {
705- fx. bcx. ins( ) . clz( arg)
706- } ;
682+ let res = fx. bcx. ins( ) . clz( arg) ;
707683 let res = CValue :: by_val( res, fx. layout_of( T ) ) ;
708684 ret. write_cvalue( fx, res) ;
709685 } ;
710686 cttz | cttz_nonzero, <T > ( v arg) {
711687 // FIXME trap on `cttz_nonzero` with zero arg.
712- let res = if T == fx. tcx. types. u128 || T == fx. tcx. types. i128 {
713- // FIXME verify this algorithm is correct
714- let ( lsb, msb) = fx. bcx. ins( ) . isplit( arg) ;
715- let lsb_tz = fx. bcx. ins( ) . ctz( lsb) ;
716- let msb_tz = fx. bcx. ins( ) . ctz( msb) ;
717- let lsb_is_zero = fx. bcx. ins( ) . icmp_imm( IntCC :: Equal , lsb, 0 ) ;
718- let msb_tz_plus_64 = fx. bcx. ins( ) . iadd_imm( msb_tz, 64 ) ;
719- let res = fx. bcx. ins( ) . select( lsb_is_zero, msb_tz_plus_64, lsb_tz) ;
720- fx. bcx. ins( ) . uextend( types:: I128 , res)
721- } else {
722- fx. bcx. ins( ) . ctz( arg)
723- } ;
688+ let res = fx. bcx. ins( ) . ctz( arg) ;
724689 let res = CValue :: by_val( res, fx. layout_of( T ) ) ;
725690 ret. write_cvalue( fx, res) ;
726691 } ;
0 commit comments