On 11/27/18 1:08 PM, Alistair Francis wrote: > +static inline void tcg_out_goto_long(TCGContext *s, tcg_insn_unit *target) > +{ > + ptrdiff_t offset = tcg_pcrel_diff(s, target); > + > + if (offset == sextract64(offset, 0, 26)) { > + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_ZERO, offset); > + } else { > + tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_TMP0, (intptr_t)target); > + tcg_out_opc_jump(s, OPC_JAL, TCG_REG_TMP0, 0); > + } > +} > + > +static void tcg_out_call_int(TCGContext *s, tcg_insn_unit *arg, bool tail) > +{ > + TCGReg link = tail ? TCG_REG_ZERO : TCG_REG_RA; > + ptrdiff_t offset = tcg_pcrel_diff(s, arg); > + if (offset == sextract64(offset, 1, 20) << 1) {
s/20/26/ Seems like there ought to be more shared code between tcg_out_call_int and tcg_out_goto_long, really. r~