diff mbox

[committed] Slightly improve some indirect call sequences on PA

Message ID BLU0-SMTP45F614CA0BE5A9CBA0592497A30@phx.gbl
State New
Headers show

Commit Message

John David Anglin Jan. 26, 2014, 4:15 p.m. UTC
The attached change removes an unnecessary nop from two indirect call  
sequences.  I also revised
the long PIC sequence to use the ldo instruction to compute the return  
pointer.   Think it's better to use
an integer arithmetic operation instead of a branch for this.

Tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and hppa64-hp- 
hpux11.11.  Committed
to trunk.

Dave
--
John David Anglin	dave.anglin@bell.net
2014-01-26  John David Anglin  <danglin@gcc.gnu.org>

	* config/pa/pa.c (pa_attr_length_indirect_call): Adjust length of
	portable runtime and PIC indirect calls.
	(pa_output_indirect_call): Remove unnecessary nop from portable runtime
	and PIC call sequences.  Use ldo instead of blr to set return register
	in PIC call sequence.
diff mbox

Patch

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 206844)
+++ config/pa/pa.c	(working copy)
@@ -8106,10 +8100,10 @@ 
     return 8;
 
   if (flag_pic)
-    return 24;
+    return 20;
 
   if (TARGET_PORTABLE_RUNTIME)
-    return 20;
+    return 16;
 
   /* Out of reach, can use ble.  */
   return 12;
@@ -8154,28 +8148,28 @@ 
     return ".CALL\tARGW0=GR\n\tldil L'$$dyncall,%%r2\n\tble R'$$dyncall(%%sr4,%%r2)\n\tcopy %%r31,%%r2";
 
   /* Long millicode call for portable runtime.  */
-  if (pa_attr_length_indirect_call (insn) == 20)
-    return "ldil L'$$dyncall,%%r31\n\tldo R'$$dyncall(%%r31),%%r31\n\tblr %%r0,%%r2\n\tbv,n %%r0(%%r31)\n\tnop";
+  if (pa_attr_length_indirect_call (insn) == 16)
+    return "ldil L'$$dyncall,%%r31\n\tldo R'$$dyncall(%%r31),%%r31\n\tblr %%r0,%%r2\n\tbv,n %%r0(%%r31)";
 
   /* We need a long PIC call to $$dyncall.  */
   xoperands[0] = NULL_RTX;
-  output_asm_insn ("{bl|b,l} .+8,%%r1", xoperands);
+  output_asm_insn ("{bl|b,l} .+8,%%r2", xoperands);
   if (TARGET_SOM || !TARGET_GAS)
     {
       xoperands[0] = gen_label_rtx ();
-      output_asm_insn ("addil L'$$dyncall-%0,%%r1", xoperands);
+      output_asm_insn ("addil L'$$dyncall-%0,%%r2", xoperands);
       targetm.asm_out.internal_label (asm_out_file, "L",
 				      CODE_LABEL_NUMBER (xoperands[0]));
       output_asm_insn ("ldo R'$$dyncall-%0(%%r1),%%r1", xoperands);
     }
   else
     {
-      output_asm_insn ("addil L'$$dyncall-$PIC_pcrel$0+4,%%r1", xoperands);
+      output_asm_insn ("addil L'$$dyncall-$PIC_pcrel$0+4,%%r2", xoperands);
       output_asm_insn ("ldo R'$$dyncall-$PIC_pcrel$0+8(%%r1),%%r1",
 		       xoperands);
     }
-  output_asm_insn ("blr %%r0,%%r2", xoperands);
-  output_asm_insn ("bv,n %%r0(%%r1)\n\tnop", xoperands);
+  output_asm_insn ("bv %%r0(%%r1)", xoperands);
+  output_asm_insn ("ldo 12(%%r2),%%r2", xoperands);
   return "";
 }