This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rewrite ia64 symbol references


On Fri, May 09, 2003 at 12:48:58PM -0700, Steve Ellcey wrote:
> Before, when this happened I would use scratch (if it was DImode) or
> create a temporary DImode register to use before copying it back to the
> original dest and putting it in SImode.  Is this still the best way to
> handle this?

No.

> Should I put back code to create a temporary register if
> dest is not in DImode?  Are there times when creating a temporary would
> cause problems?

All the times.  You can't create temporaries after register allocation.

On the other hand, at this stage, you don't *need* a temporary.  The
register you already have is fine, we just want to use it in a different
mode.

The following should work.


r~


	* ia64.c (ia64_expand_load_address): Force DEST to DImode.
	Build HIGH+LO_SUM inline.
	* ia64.md (load_symptr): Remove.

Index: ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.222
diff -u -p -u -r1.222 ia64.c
--- ia64.c	25 Apr 2003 22:09:12 -0000	1.222
+++ ia64.c	9 May 2003 22:03:13 -0000
@@ -1095,6 +1095,13 @@ ia64_expand_load_address (dest, src)
   if (GET_CODE (dest) != REG)
     abort ();
 
+  /* ILP32 mode still loads 64-bits of data from the GOT.  This avoids
+     having to pointer-extend the value afterward.  Other forms of address
+     computation below are also more natural to compute as 64-bit quantities.
+     If we've been given an SImode destination register, change it.  */
+  if (GET_MODE (dest) != Pmode)
+    dest = gen_rtx_REG (Pmode, REGNO (dest));
+
   if (TARGET_AUTO_PIC)
     {
       emit_insn (gen_load_gprel64 (dest, src));
@@ -1125,11 +1132,20 @@ ia64_expand_load_address (dest, src)
       lo = ((ofs & 0x3fff) ^ 0x2000) - 0x2000;
       hi = ofs - lo;
 
-      emit_insn (gen_load_symptr (dest, plus_constant (sym, hi), dest));
+      ia64_expand_load_address (dest, plus_constant (sym, hi));
       emit_insn (gen_adddi3 (dest, dest, GEN_INT (lo)));
     }
   else
-    emit_insn (gen_load_symptr (dest, src, dest));
+    {
+      rtx tmp;
+
+      tmp = gen_rtx_HIGH (Pmode, src);
+      tmp = gen_rtx_PLUS (Pmode, tmp, pic_offset_table_rtx);
+      emit_insn (gen_rtx_SET (VOIDmode, dest, tmp));
+
+      tmp = gen_rtx_LO_SUM (GET_MODE (dest), dest, src);
+      emit_insn (gen_rtx_SET (VOIDmode, dest, tmp));
+    }
 }
 
 static GTY(()) rtx gen_tls_tga;
Index: ia64.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.md,v
retrieving revision 1.104
diff -u -p -u -r1.104 ia64.md
--- ia64.md	10 Apr 2003 19:53:54 -0000	1.104
+++ ia64.md	9 May 2003 22:03:13 -0000
@@ -410,17 +410,6 @@
   operands[3] = pic_offset_table_rtx;
 })
 
-(define_expand "load_symptr"
-  [(set (match_operand:DI 2 "register_operand" "")
-	(plus:DI (high:DI (match_operand:DI 1 "got_symbolic_operand" ""))
-		 (match_dup 3)))
-   (set (match_operand:DI 0 "register_operand" "")
-	(lo_sum:DI (match_dup 2) (match_dup 1)))]
-  ""
-{
-  operands[3] = pic_offset_table_rtx;
-})
-
 (define_insn "*load_symptr_high"
   [(set (match_operand:DI 0 "register_operand" "=r")
 	(plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]