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: [Committed] PR17236: Improve double-word multiply RTL expansion


Roger Sayle wrote:

> 	PR rtl-optimization/17236
> 	* optabs.c (expand_doubleword_mult): New helper function split out
> 	from expand_binop.  Permute the order in which instructions are
> 	emitted to minimize the number of simultaneously live registers.
> 	(expand_binop): Call expand_doubleword_mult to synthesize a double
> 	word multiplication.

This causes bootstrap failure on s390-ibm-linux because the stage1 cc1
miscompiles the 'divide' routine in tree-ssa-loop-ivopts.c:

      inv = (inv * ex) & mask;
      ex = (ex * ex) & mask;

It looks the cause for the miscompile is that

> +       /* ??? This could be done with emit_store_flag where available.  */
> +       temp = expand_binop (word_mode, lshr_optab, op0_low, wordm1,
> + 			   NULL_RTX, 1, methods);
> +       if (temp)
> + 	op0_high = expand_binop (word_mode, add_optab, op0_high, temp,
> + 				 op0_high, 0, OPTAB_DIRECT);

this clobbers the original input 'op0_high' which might be needed 
later on.  Likewise op1_high later on.

While you write:

> +   /* OP0_HIGH should now be dead.  */

this really only means op0_high is not needed any more to perform
*this* multiplication operation, but the variable may of course 
not be dead at the original source code level ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


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