public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Use target-insns.def for indirect_jump
@ 2015-07-28 20:37 Richard Sandiford
  2015-07-28 22:14 ` Andrew Pinski
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2015-07-28 20:37 UTC (permalink / raw)
  To: gcc-patches

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");
+
   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
 }
 \f
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [committed] Use target-insns.def for indirect_jump
  2015-07-28 20:37 [committed] Use target-insns.def for indirect_jump Richard Sandiford
@ 2015-07-28 22:14 ` Andrew Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Pinski @ 2015-07-28 22:14 UTC (permalink / raw)
  To: GCC Patches, richard.sandiford

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
>  }
>
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-28 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28 20:37 [committed] Use target-insns.def for indirect_jump Richard Sandiford
2015-07-28 22:14 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).