Reload fix to handle unarry operators in operands correctly

Jeffrey A Law law@cygnus.com
Thu Dec 16 03:14:00 GMT 1999


  In message <19990816211611.07124@atrey.karlin.mff.cuni.cz>you write:
  > 
  > Hi
  > The mathing of unary operators (such as float_extend I use in my patch)
  > works well for whole compiler.  Only reload does IMO weird thing. For
  > example following insn (where whole float_extend constructs are operands):
Reload does "weird" things with operands that accept unary operators because
it is necessary for correctness on some ports.  Most notably the MIPS in 64bit
mode, but it may apply to other ports.


  > (insn 15 14 17 (set (reg:XF 26)
  >         (plus:XF (float_extend:XF (mem/f:DF (symbol_ref:SI ("a")) 1))
  >             (float_extend:XF (mem/f:DF (symbol_ref:SI ("b")) 1)))) 422 {*fo
  > p_1} (nil)
  >     (nil))
  > 
  > Gets reloaded to:
  > 
  > (insn 28 29 15 (set (indreg:XF (plus:SI (post_dec:SI (reg:SI 19 rsp))
  >                 (const_int -1 [0xffffffff])))
  >         (float_extend:XF (mem/f:DF (symbol_ref:SI ("a")) 1))) 124 {extenddf
  > xf2} (nil)
  >     (nil))
  > 
  > (insn:TI 15 28 17 (set (indreg:XF (reg:SI 19 rsp))
  >         (plus:XF (indreg:XF (reg:SI 19 rsp))
  >             (float_extend:XF (mem/f:DF (symbol_ref:SI ("b")) 1)))) 422 {*fo
  > p_1} (insn_list 28 (nil))
  >     (nil))
  > 
  > The first is extension insn and second is operation.  This works well with
  > this case, but I don't fell confortably with this idea. I don't think
  > people write expanders taking care for this and it is not documented. Even
  > some partsof reload are confused when reloading such constructions 
  > (SECONDARY_RELOADS etc.)
I'm sorry, I don't follow what you are trying to say.  The RTL you cited about
is exactly what I would have expected reload to do.


  > So I think better way to handle this is to ignore those unary operators for
  > reload and produce following:
  > 
  > (insn 30 31 15 (set (indreg:DF (plus:SI (post_dec:SI (reg:SI 19 rsp))
  >                 (const_int -1 [0xffffffff])))
  >        (mem/f:DF (symbol_ref:SI ("a")) 1)) 87 {*movdf_1} (nil)
  >     (nil))
  > 
  > (insn:TI 15 30 17 (set (indreg:XF (reg:SI 19 rsp))
  >         (plus:XF (float_extend:XF (indreg:XF (reg:SI 19 rsp)))
  >             (float_extend:XF (mem/f:DF (symbol_ref:SI ("b")) 1)))) 429 {*fo
  > p_xf_1} (insn_list 30 (nil))
  >     (nil))
  > 
  > This avoids last remaining regresions in my indreg patch.
If this was causing a regression, then I suspect you've got a problem
elsewhere.  The two hunks of RTL you've shown look equivalent to me.

Why precisely did this fix a regression in your INDREG patch?

jeff



More information about the Gcc-patches mailing list