public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Indirect jumps
@ 2015-08-25 14:13 Nathan Sidwell
  2015-08-25 19:16 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Sidwell @ 2015-08-25 14:13 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

Ptx is one of those rare (unique?) machines that doesn't  have an indirect 
branch.  optabs  is prepared for such  a target and emits a sorry when an 
indirect branch is needed.  However it then goes on to try and  emit such an 
instruction and ends up ICEing.

Fixed thusly, ok?  (Or is the right solution to define a dummy indirect branch 
in the PTX  md file?)

nathan

[-- Attachment #2: trunk-optabs.patch --]
[-- Type: text/x-patch, Size: 814 bytes --]

2015-08-25  Nathan Sidwell  <nathan@acm.org>

	* optabs (emit_indirect_jump): Don't try an emit a jump if the
	target doesn't  have one.

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c	(revision 227128)
+++ gcc/optabs.c	(working copy)
@@ -4488,11 +4488,13 @@ emit_indirect_jump (rtx loc)
 {
   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 (targetm.code_for_indirect_jump, 1, ops);
-  emit_barrier ();
+  else
+    {
+      struct expand_operand ops[1];
+      create_address_operand (&ops[0], loc);
+      expand_jump_insn (targetm.code_for_indirect_jump, 1, ops);
+      emit_barrier ();
+    }
 }
 \f
 

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

* Re: Indirect jumps
  2015-08-25 14:13 Indirect jumps Nathan Sidwell
@ 2015-08-25 19:16 ` Jeff Law
  2015-08-25 19:42   ` Nathan Sidwell
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2015-08-25 19:16 UTC (permalink / raw)
  To: Nathan Sidwell, GCC Patches

On 08/25/2015 08:11 AM, Nathan Sidwell wrote:
> Ptx is one of those rare (unique?) machines that doesn't  have an
> indirect branch.  optabs  is prepared for such  a target and emits a
> sorry when an indirect branch is needed.  However it then goes on to try
> and  emit such an instruction and ends up ICEing.
>
> Fixed thusly, ok?  (Or is the right solution to define a dummy indirect
> branch in the PTX  md file?)
I think we're trying to generally get away from dummy patterns.

We could emulate by creating a new stack frame and shoving the target of 
the branch into the stack, then executing a return.  However, I don't 
think that's worth doing ;-)

I think the patch is fine for the trunk.

jeff

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

* Re: Indirect jumps
  2015-08-25 19:16 ` Jeff Law
@ 2015-08-25 19:42   ` Nathan Sidwell
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Sidwell @ 2015-08-25 19:42 UTC (permalink / raw)
  To: Jeff Law, GCC Patches

On 08/25/15 15:10, Jeff Law wrote:
> On 08/25/2015 08:11 AM, Nathan Sidwell wrote:

> We could emulate by creating a new stack frame and shoving the target of the
> branch into the stack, then executing a return.  However, I don't think that's
> worth doing ;-)

And wouldn't work for PTX anyway -- all the return addr handling is hidden away.

> I think the patch is fine for the trunk.

ok.

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

end of thread, other threads:[~2015-08-25 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-25 14:13 Indirect jumps Nathan Sidwell
2015-08-25 19:16 ` Jeff Law
2015-08-25 19:42   ` Nathan Sidwell

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).