On Tue, Mar 22, 2011 at 1:05 PM, Eric Botcazou <ebotca...@adacore.com> wrote: >> It leads 2 problems: >> >> 1. Redundant zero-extension at function entry. >> 2. combine doesn't check zero-extension on hard register and leads to >> internal compiler error. >> >> Is there a way to avoid redundant zero-extension at function entry to >> solve both problems? > > Eliminating the redundant extension in the callee seems indeed to be > appealing. > You need to find out who decides that the incoming parameter needs to be zero- > extended. Is that the call to promote_function_mode in assign_parm_setup_reg? >
It is: op0 = parmreg; op1 = validated_mem; if (icode != CODE_FOR_nothing && insn_data[icode].operand[0].predicate (op0, promoted_nominal_mode) && insn_data[icode].operand[1].predicate (op1, data->passed_mode)) { enum rtx_code code = unsignedp ? ZERO_EXTEND : SIGN_EXTEND; rtx insn, insns; HARD_REG_SET hardregs; start_sequence (); insn = gen_extend_insn (op0, op1, promoted_nominal_mode, data->passed_mode, unsignedp); emit_insn (insn); insns = get_insns (); in assign_parm_setup_reg. -- H.J.