From 4eb4a256cd4a39555f4d834c47cabc2e136ed02a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 17 Oct 2014 12:50:16 +0200 Subject: re PR tree-optimization/63302 (Code with 64-bit long long constants is miscompiled on 32-bit host) PR tree-optimization/63302 * tree-ssa-reassoc.c (optimize_range_tests_xor, optimize_range_tests_diff): Use !integer_pow2p () instead of tree_log2 () < 0. * gcc.c-torture/execute/pr63302.c: New test. From-SVN: r216391 --- gcc/tree-ssa-reassoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-reassoc.c') diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 4714a38..ac33f75 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -2200,7 +2200,7 @@ optimize_range_tests_xor (enum tree_code opcode, tree type, lowxor = fold_binary (BIT_XOR_EXPR, type, lowi, lowj); if (lowxor == NULL_TREE || TREE_CODE (lowxor) != INTEGER_CST) return false; - if (tree_log2 (lowxor) < 0) + if (!integer_pow2p (lowxor)) return false; highxor = fold_binary (BIT_XOR_EXPR, type, highi, highj); if (!tree_int_cst_equal (lowxor, highxor)) @@ -2247,7 +2247,7 @@ optimize_range_tests_diff (enum tree_code opcode, tree type, tem1 = fold_binary (MINUS_EXPR, type, lowj, lowi); if (tem1 == NULL_TREE || TREE_CODE (tem1) != INTEGER_CST) return false; - if (tree_log2 (tem1) < 0) + if (!integer_pow2p (tem1)) return false; type = unsigned_type_for (type); -- cgit v1.1