ia64 fix execute/931018-1.c

Richard Henderson rth@cygnus.com
Mon Aug 14 13:37:00 GMT 2000


This test would fail at -O3 because we'd decide at RTL generation time how
to emit code for accessing `v'.  Then we'd defer the function, parse the
rest of the file, then optimize and emit the function.  But in the mean time
we've seen the definition of `v', which changes the value of the
sdata_symbolic_operand predicate, which changed the meaning of the RTL.

This patch delays the decision on how to emit code for accessing a symbol
until we optimize.  Yes, the fact that two completely different address
load strategies share an insn that is indistinguishable except for the
predicates is bad, but this is sufficient to fix the problem.


r~


        * config/ia64/ia64.md (movdi): Delay calling ia64_expand_load_address.
        (movdi_symbolic): New.

Index: config/ia64/ia64.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/ia64/ia64.md,v
retrieving revision 1.32
diff -c -p -d -r1.32 ia64.md
*** ia64.md	2000/08/11 23:48:26	1.32
--- ia64.md	2000/08/14 20:15:42
***************
*** 351,364 ****
    ""
    "
  {
    if (! TARGET_NO_PIC && symbolic_operand (operands[1], DImode))
      {
!       ia64_expand_load_address (operands[0], operands[1]);
        DONE;
      }
-   if (! reload_in_progress && ! reload_completed
-       && ! ia64_move_ok (operands[0], operands[1]))
-     operands[1] = force_reg (DImode, operands[1]);
  }")
  
  ;; Errata 72 workaround.
--- 349,369 ----
    ""
    "
  {
+   if (! reload_in_progress && ! reload_completed
+       && ! ia64_move_ok (operands[0], operands[1]))
+     operands[1] = force_reg (DImode, operands[1]);
    if (! TARGET_NO_PIC && symbolic_operand (operands[1], DImode))
      {
!       /* Before optimization starts, delay committing to any particular
! 	 type of PIC address load.  If this function gets deferred, we
! 	 may acquire information that changes the value of the
! 	 sdata_symbolic_operand predicate.  */
!       if (rtx_equal_function_value_matters)
! 	emit_insn (gen_movdi_symbolic (operands[0], operands[1]));
!       else
!         ia64_expand_load_address (operands[0], operands[1]);
        DONE;
      }
  }")
  
  ;; Errata 72 workaround.
***************
*** 407,412 ****
--- 412,433 ----
    [(set_attr "type" "A,A,L,M,M,F,I,I,M,M")
     (set_attr "predicable" "no")])
  
+ ;; This is used during early compilation to delay the decision on
+ ;; how to refer to a variable as long as possible.  This is especially
+ ;; important between initial rtl generation and optimization for
+ ;; deferred functions, since we may acquire additional information
+ ;; on the variables used in the meantime.
+ 
+ (define_insn_and_split "movdi_symbolic"
+   [(set (match_operand:DI 0 "register_operand" "=r")
+ 	(match_operand:DI 1 "symbolic_operand" "s"))
+    (use (reg:DI 1))]
+   ""
+   "* abort ();"
+   ""
+   [(const_int 0)]
+   "ia64_expand_load_address (operands[0], operands[1]); DONE;")
+ 
  (define_insn "*movdi_internal_astep"
    [(set (match_operand:DI 0 "destination_operand"
  		    "=r,r,r,r, m, r,*f,*f,*f, Q,   r,*b*e, r,*d, r,*c")


More information about the Gcc-patches mailing list