Commit 22761ec3 by Adam Nemet Committed by Adam Nemet

rtlanal.c (num_sign_bit_copies1): Improve cases of ANDing or IORing with a constant.

	* rtlanal.c (num_sign_bit_copies1): Improve cases of ANDing or
	IORing with a constant.

From-SVN: r126397
parent 4f0a96f5
2007-07-05 Adam Nemet <anemet@caviumnetworks.com>
* rtlanal.c (num_sign_bit_copies1): Improve cases of ANDing or
IORing with a constant.
2007-07-05 Seongbae Park <seongbae.park@gmail.com> 2007-07-05 Seongbae Park <seongbae.park@gmail.com>
PR rtl-optimization/32475 PR rtl-optimization/32475
......
...@@ -4290,6 +4290,25 @@ num_sign_bit_copies1 (rtx x, enum machine_mode mode, rtx known_x, ...@@ -4290,6 +4290,25 @@ num_sign_bit_copies1 (rtx x, enum machine_mode mode, rtx known_x,
known_x, known_mode, known_ret); known_x, known_mode, known_ret);
num1 = cached_num_sign_bit_copies (XEXP (x, 1), mode, num1 = cached_num_sign_bit_copies (XEXP (x, 1), mode,
known_x, known_mode, known_ret); known_x, known_mode, known_ret);
/* If num1 is clearing some of the top bits then regardless of
the other term, we are guaranteed to have at least that many
high-order zero bits. */
if (code == AND
&& num1 > 1
&& bitwidth <= HOST_BITS_PER_WIDE_INT
&& GET_CODE (XEXP (x, 1)) == CONST_INT
&& !(INTVAL (XEXP (x, 1)) & ((HOST_WIDE_INT) 1 << (bitwidth - 1))))
return num1;
/* Similarly for IOR when setting high-order bits. */
if (code == IOR
&& num1 > 1
&& bitwidth <= HOST_BITS_PER_WIDE_INT
&& GET_CODE (XEXP (x, 1)) == CONST_INT
&& (INTVAL (XEXP (x, 1)) & ((HOST_WIDE_INT) 1 << (bitwidth - 1))))
return num1;
return MIN (num0, num1); return MIN (num0, num1);
case PLUS: case MINUS: case PLUS: case MINUS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment