Commit 88f5cfcd by Jakub Jelinek Committed by Jakub Jelinek

tree-ssa-math-opts.c (do_shift_rotate, [...]): Cast 0xff to uint64_t before shifting it up.

	* tree-ssa-math-opts.c (do_shift_rotate, find_bswap_or_nop_1): Cast
	0xff to uint64_t before shifting it up.

From-SVN: r211837
parent 6d45574a
2014-06-20 Jakub Jelinek <jakub@redhat.com>
* tree-ssa-math-opts.c (do_shift_rotate, find_bswap_or_nop_1): Cast
0xff to uint64_t before shifting it up.
2014-06-20 Julian Brown <julian@codesourcery.com> 2014-06-20 Julian Brown <julian@codesourcery.com>
Chung-Lin Tang <cltang@codesourcery.com> Chung-Lin Tang <cltang@codesourcery.com>
......
...@@ -1669,7 +1669,8 @@ do_shift_rotate (enum tree_code code, ...@@ -1669,7 +1669,8 @@ do_shift_rotate (enum tree_code code,
break; break;
case RSHIFT_EXPR: case RSHIFT_EXPR:
/* Arithmetic shift of signed type: result is dependent on the value. */ /* Arithmetic shift of signed type: result is dependent on the value. */
if (!TYPE_UNSIGNED (n->type) && (n->n & (0xff << (bitsize - 8)))) if (!TYPE_UNSIGNED (n->type)
&& (n->n & ((uint64_t) 0xff << (bitsize - 8))))
return false; return false;
n->n >>= count; n->n >>= count;
break; break;
...@@ -1903,7 +1904,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit) ...@@ -1903,7 +1904,7 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
old_type_size = TYPE_PRECISION (n->type); old_type_size = TYPE_PRECISION (n->type);
if (!TYPE_UNSIGNED (n->type) if (!TYPE_UNSIGNED (n->type)
&& type_size > old_type_size && type_size > old_type_size
&& n->n & (0xff << (old_type_size - 8))) && n->n & ((uint64_t) 0xff << (old_type_size - 8)))
return NULL; return NULL;
if (type_size / BITS_PER_UNIT < (int)(sizeof (int64_t))) if (type_size / BITS_PER_UNIT < (int)(sizeof (int64_t)))
......
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