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]

[PATCH][committed] Fix PR31530, simplify-rtx fails to honor sign dependent rounding


We cannot simplify a*-b + c as c - a*b if we honor sign dependent 
rounding.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to mainline.

Richard.


2007-04-11  Richard Guenther  <rguenther@suse.de>

	PR middle-end/31530
	* simplify-rtx.c (simplify_binary_operation_1): Do not simplify
	a * -b + c as c - a * b if we honor sign dependent rounding.

Index: simplify-rtx.c
===================================================================
*** simplify-rtx.c	(revision 123691)
--- simplify-rtx.c	(working copy)
*************** simplify_binary_operation_1 (enum rtx_co
*** 1688,1694 ****
  							 XEXP (op0, 1)));
  
        /* Canonicalize (plus (mult (neg B) C) A) to (minus A (mult B C)).  */
!       if (GET_CODE (op0) == MULT
  	  && GET_CODE (XEXP (op0, 0)) == NEG)
  	{
  	  rtx in1, in2;
--- 1688,1695 ----
  							 XEXP (op0, 1)));
  
        /* Canonicalize (plus (mult (neg B) C) A) to (minus A (mult B C)).  */
!       if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
! 	  && GET_CODE (op0) == MULT
  	  && GET_CODE (XEXP (op0, 0)) == NEG)
  	{
  	  rtx in1, in2;
*************** simplify_binary_operation_1 (enum rtx_co
*** 1916,1922 ****
  	return reversed;
  
        /* Canonicalize (minus A (mult (neg B) C)) to (plus (mult B C) A).  */
!       if (GET_CODE (op1) == MULT
  	  && GET_CODE (XEXP (op1, 0)) == NEG)
  	{
  	  rtx in1, in2;
--- 1917,1924 ----
  	return reversed;
  
        /* Canonicalize (minus A (mult (neg B) C)) to (plus (mult B C) A).  */
!       if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
! 	  && GET_CODE (op1) == MULT
  	  && GET_CODE (XEXP (op1, 0)) == NEG)
  	{
  	  rtx in1, in2;
*************** simplify_binary_operation_1 (enum rtx_co
*** 1931,1937 ****
  
        /* Canonicalize (minus (neg A) (mult B C)) to
  	 (minus (mult (neg B) C) A).  */
!       if (GET_CODE (op1) == MULT
  	  && GET_CODE (op0) == NEG)
  	{
  	  rtx in1, in2;
--- 1933,1940 ----
  
        /* Canonicalize (minus (neg A) (mult B C)) to
  	 (minus (mult (neg B) C) A).  */
!       if (!HONOR_SIGN_DEPENDENT_ROUNDING (mode)
! 	  && GET_CODE (op1) == MULT
  	  && GET_CODE (op0) == NEG)
  	{
  	  rtx in1, in2;


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