fn input_to_reg<C: LowerCtx<Inst>>(
    ctx: &mut C,
    input: InsnInput,
    narrow_mode: NarrowValueMode,
) -> Reg {
    let ty = ctx.input_ty(input.insn, input.input);
    let from_bits = ty_bits(ty) as u8;
    let raw_reg = ctx.input(input.insn, input.input);
    match (narrow_mode, from_bits) {
        (NarrowValueMode::None, _) => raw_reg,
        (NarrowValueMode::ZeroExtend32, n) if n < 32 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: false,
                from_bits,
                to_bits: 32,
            });
            raw_reg
        }
        (NarrowValueMode::SignExtend32, n) if n < 32 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: true,
                from_bits,
                to_bits: 32,
            });
            raw_reg
        }
        (NarrowValueMode::ZeroExtend64, n) if n < 64 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: false,
                from_bits,
                to_bits: 64,
            });
            raw_reg
        }
        (NarrowValueMode::SignExtend64, n) if n < 64 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: true,
                from_bits,
                to_bits: 64,
            });
            raw_reg
        }
        _ => raw_reg,
    }
}
/// Lower an instruction input to a reg.
///
/// The given register will be extended appropriately, according to
/// `narrow_mode` and the input's type. If extended, the value is
/// always extended to 64 bits, for simplicity.
Lower an instruction input to a reg.
The given register will be extended appropriately, according to
`narrow_mode` and the input's type. If extended, the value is
always extended to 64 bits, for simplicity.
Lower an instruction input to a reg . The given register will be extended appropriately according to ` narrow_mode ` and the input ' s type . If extended the value is always extended to 64 bits for simplicity .
fn input_to_reg<C: LowerCtx<Inst>>(
    ctx: &mut C,
    input: InsnInput,
    narrow_mode: NarrowValueMode,
) -> Reg {
    let ty = ctx.input_ty(input.insn, input.input);
    let from_bits = ty_bits(ty) as u8;
    let raw_reg = ctx.input(input.insn, input.input);
    match (narrow_mode, from_bits) {
        (NarrowValueMode::None, _) => raw_reg,
        (NarrowValueMode::ZeroExtend32, n) if n < 32 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: false,
                from_bits,
                to_bits: 32,
            });
            raw_reg
        }
        (NarrowValueMode::SignExtend32, n) if n < 32 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: true,
                from_bits,
                to_bits: 32,
            });
            raw_reg
        }
        (NarrowValueMode::ZeroExtend64, n) if n < 64 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: false,
                from_bits,
                to_bits: 64,
            });
            raw_reg
        }
        (NarrowValueMode::SignExtend64, n) if n < 64 => {
            ctx.emit(Inst::Extend {
                rd: Writable::from_reg(raw_reg),
                rn: raw_reg,
                signed: true,
                from_bits,
                to_bits: 64,
            });
            raw_reg
        }
        _ => raw_reg,
    }
}
fn input_to_reg < C : LowerCtx < Inst > > ( ctx : & mut C , input : InsnInput , narrow_mode : NarrowValueMode , ) -> Reg { let ty = ctx . input_ty ( input . insn , input . input ) ; let from_bits = ty_bits ( ty ) as u8 ; let raw_reg = ctx . input ( input . insn , input . input ) ; match ( narrow_mode , from_bits ) { ( NarrowValueMode :: None , _ ) => raw_reg , ( NarrowValueMode :: ZeroExtend32 , n ) if n < 32 => { ctx . emit ( Inst :: Extend { rd : Writable :: from_reg ( raw_reg ) , rn : raw_reg , signed : false , from_bits , to_bits : 32 , } ) ; raw_reg } ( NarrowValueMode :: SignExtend32 , n ) if n < 32 => { ctx . emit ( Inst :: Extend { rd : Writable :: from_reg ( raw_reg ) , rn : raw_reg , signed : true , from_bits , to_bits : 32 , } ) ; raw_reg } ( NarrowValueMode :: ZeroExtend64 , n ) if n < 64 => { ctx . emit ( Inst :: Extend { rd : Writable :: from_reg ( raw_reg ) , rn : raw_reg , signed : false , from_bits , to_bits : 64 , } ) ; raw_reg } ( NarrowValueMode :: SignExtend64 , n ) if n < 64 => { ctx . emit ( Inst :: Extend { rd : Writable :: from_reg ( raw_reg ) , rn : raw_reg , signed : true , from_bits , to_bits : 64 , } ) ; raw_reg } _ => raw_reg , } }
Lower an instruction input to a reg.
Lower an instruction input to a reg .
ctx
&mut C
input
InsnInput
narrow_mode
NarrowValueMode
ctx
&mut C
input
InsnInput
narrow_mode
NarrowValueMode