Message ID | 874mkonhpe.fsf@e105548-lin.cambridge.arm.com |
---|---|
State | New |
Headers | show |
On Tue, Jul 28, 2015 at 1:35 PM, Richard Sandiford <richard.sandiford@arm.com> wrote: > Continuing after a break for the fr30 patch... > > Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. > Also tested via config-list.mk. Committed as preapproved. > > Thanks, > Richard > > > gcc/ > * target-insns.def (indirect_jump): New targetm instruction pattern. > * optabs.c (emit_indirect_jump): Use it instead of HAVE_*/gen_* > interface. > > Index: gcc/target-insns.def > =================================================================== > --- gcc/target-insns.def 2015-07-28 20:34:48.452276705 +0100 > +++ gcc/target-insns.def 2015-07-28 20:34:48.444276797 +0100 > @@ -44,6 +44,7 @@ DEF_TARGET_INSN (epilogue, (void)) > DEF_TARGET_INSN (exception_receiver, (void)) > DEF_TARGET_INSN (extv, (rtx x0, rtx x1, rtx x2, rtx x3)) > DEF_TARGET_INSN (extzv, (rtx x0, rtx x1, rtx x2, rtx x3)) > +DEF_TARGET_INSN (indirect_jump, (rtx x0)) > DEF_TARGET_INSN (insv, (rtx x0, rtx x1, rtx x2, rtx x3)) > DEF_TARGET_INSN (jump, (rtx x0)) > DEF_TARGET_INSN (load_multiple, (rtx x0, rtx x1, rtx x2)) > Index: gcc/optabs.c > =================================================================== > --- gcc/optabs.c 2015-07-28 20:34:48.452276705 +0100 > +++ gcc/optabs.c 2015-07-28 20:34:48.448276751 +0100 > @@ -4484,16 +4484,15 @@ prepare_float_lib_cmp (rtx x, rtx y, enu > /* Generate code to indirectly jump to a location given in the rtx LOC. */ > > void > -emit_indirect_jump (rtx loc ATTRIBUTE_UNUSED) > +emit_indirect_jump (rtx loc) > { > -#ifndef HAVE_indirect_jump > - sorry ("indirect jumps are not available on this target"); > -#else > + if (!targetm.have_indirect_jump ()) > + sorry ("indirect jumps are not available on this target"); Hmm, can you make sure the if gets done correctly in predicting as not going to be taken in this case? Not it is going to matter as indirect jumps are used very far inbetween anyways. Thanks, Andrew > + > struct expand_operand ops[1]; > create_address_operand (&ops[0], loc); > - expand_jump_insn (CODE_FOR_indirect_jump, 1, ops); > + expand_jump_insn (targetm.code_for_indirect_jump, 1, ops); > emit_barrier (); > -#endif > } > > >
Index: gcc/target-insns.def =================================================================== --- gcc/target-insns.def 2015-07-28 20:34:48.452276705 +0100 +++ gcc/target-insns.def 2015-07-28 20:34:48.444276797 +0100 @@ -44,6 +44,7 @@ DEF_TARGET_INSN (epilogue, (void)) DEF_TARGET_INSN (exception_receiver, (void)) DEF_TARGET_INSN (extv, (rtx x0, rtx x1, rtx x2, rtx x3)) DEF_TARGET_INSN (extzv, (rtx x0, rtx x1, rtx x2, rtx x3)) +DEF_TARGET_INSN (indirect_jump, (rtx x0)) DEF_TARGET_INSN (insv, (rtx x0, rtx x1, rtx x2, rtx x3)) DEF_TARGET_INSN (jump, (rtx x0)) DEF_TARGET_INSN (load_multiple, (rtx x0, rtx x1, rtx x2)) Index: gcc/optabs.c =================================================================== --- gcc/optabs.c 2015-07-28 20:34:48.452276705 +0100 +++ gcc/optabs.c 2015-07-28 20:34:48.448276751 +0100 @@ -4484,16 +4484,15 @@ prepare_float_lib_cmp (rtx x, rtx y, enu /* Generate code to indirectly jump to a location given in the rtx LOC. */ void -emit_indirect_jump (rtx loc ATTRIBUTE_UNUSED) +emit_indirect_jump (rtx loc) { -#ifndef HAVE_indirect_jump - sorry ("indirect jumps are not available on this target"); -#else + if (!targetm.have_indirect_jump ()) + sorry ("indirect jumps are not available on this target"); + struct expand_operand ops[1]; create_address_operand (&ops[0], loc); - expand_jump_insn (CODE_FOR_indirect_jump, 1, ops); + expand_jump_insn (targetm.code_for_indirect_jump, 1, ops); emit_barrier (); -#endif }