Commit 6cb70f0c by Jim Wilson

(build_binary_op): Can shorten shift only if shift count

is less than size in bits of arg0.

From-SVN: r8528
parent 03f36098
...@@ -2391,6 +2391,10 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) ...@@ -2391,6 +2391,10 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0)); unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0));
if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type) if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
/* We can shorten only if the shift count is less than the
number of bits in the smaller type size. */
&& TREE_INT_CST_HIGH (op1) == 0
&& TYPE_PRECISION (TREE_TYPE (arg0)) > TREE_INT_CST_LOW (op1)
/* If arg is sign-extended and then unsigned-shifted, /* If arg is sign-extended and then unsigned-shifted,
we can simulate this with a signed shift in arg's type we can simulate this with a signed shift in arg's type
only if the extended result is at least twice as wide only if the extended result is at least twice as wide
......
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