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.
------------------------------------------------------------------------
===================================================================
@@ -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)))
{