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: [RFC] Curious REG_EQUAL note for multiplication


Hi,

On Sun, 17 May 2009, Kaz Kojima wrote:

>   long long t = 50;
>   ...
>   t *= 1000000000;
>   ...
> 
> and the .expand rtl dump shows that t *= 1000000000 is compiled
> to a sequence of insns of which the last two insns are:
> 
> (insn 87 86 88 ice.i:6 (parallel [
>             (set (subreg:SI (reg:DI 220) 0)
>                 (ashift:SI (subreg:SI (reg:DI 218) 0)
>                     (const_int 9 [0x9])))
>             (clobber (scratch:SI))
>         ]) -1 (expr_list:REG_EQUAL (mult:DI (reg:DI 169)
>             (const_int 1000000000 [0x3b9aca00]))
>         (nil)))

Have you checked that also the high part of reg 220 is set correctly?  In 
any case, the note indeed is fishy but we don't have a better place to put 
it anymore, since we removed the (set (reg x) (reg x)) finisher of 
multireg libcall sequences.  That's actually bad, hmm...

> @@ -3074,9 +3074,12 @@ expand_mult_const (enum machine_mode mod
>  	}
>  
>        insn = get_last_insn ();
> -      set_unique_reg_note (insn, REG_EQUAL,
> -			   gen_rtx_MULT (nmode, tem,
> -					 GEN_INT (val_so_far)));
> +      set = single_set (insn);
> +      if (set != 0
> +	  && GET_MODE (SET_DEST (set)) == nmode)
> +	set_unique_reg_note (insn, REG_EQUAL,
> +			     gen_rtx_MULT (nmode, tem,
> +					   GEN_INT (val_so_far)));

... so maybe it would work, if you instead, when the modes are different, 
emit a (set result result) insn yourself, and attach the note there?  
Otherwise we probably get some const-fold regressions.


Ciao,
Michael.


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