diff mbox

[gomp4,2/23] BImode fixes in combine

Message ID 52A5D98A.50603@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt Dec. 9, 2013, 2:54 p.m. UTC

diff mbox

Patch

We'll be the first port to use BImode and have STORE_FLAG_VALUE==-1.
That has exposed some bugs, one of them is in combine where we can end
up calling num_sign_bit_copies for a BImode value. However, the return
value is always 1 in that case, so it doesn't tell us anything and is
going to be misinterpreted by the caller.

	gcc/
	* combine.c (combine_simplify_rtx): Avoid using num_sign_bit_copies
	for single-bit modes.

------------------------------------------------------------------------
Index: gcc/combine.c
===================================================================
--- gcc/combine.c	(revision 422344)
+++ gcc/combine.c	(revision 422345)
@@ -5742,10 +5742,14 @@  combine_simplify_rtx (rtx x, enum machin
 	    ;
 
 	  else if (STORE_FLAG_VALUE == -1
-	      && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
-	      && op1 == const0_rtx
-	      && (num_sign_bit_copies (op0, mode)
-		  == GET_MODE_PRECISION (mode)))
+		   && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT
+		   && op1 == const0_rtx
+		   /* There's always at least one sign bit copy in a
+		      one-bit mode, so the call to num_sign_bit_copies
+		      tells us nothing in that case.  */
+		   && GET_MODE_PRECISION (mode) > 1
+		   && (num_sign_bit_copies (op0, mode)
+		       == GET_MODE_PRECISION (mode)))
 	    return gen_lowpart (mode,
 				expand_compound_operation (op0));
 
@@ -5765,6 +5769,7 @@  combine_simplify_rtx (rtx x, enum machin
 		   && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT
 		   && op1 == const0_rtx
 		   && mode == GET_MODE (op0)
+		   && GET_MODE_PRECISION (mode) > 1
 		   && (num_sign_bit_copies (op0, mode)
 		       == GET_MODE_PRECISION (mode)))
 	    {