summaryrefslogtreecommitdiff
path: root/gcc/dojump.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-05-07 17:27:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-05-07 17:27:40 +0200
commit472e0df9f0f70801be6a5097799d3fefba9ad078 (patch)
treeafa7d064f452e1ca909d3885ee825f7486fd3cdc /gcc/dojump.c
parent262118b947e0b9c200996e425acb8d75970ff1ff (diff)
downloadgcc-472e0df9f0f70801be6a5097799d3fefba9ad078.tar.gz
re PR middle-end/40057 (Incorrect right shift by 31 with long long)
PR middle-end/40057 * dojump.c (prefer_and_bit_test): Use immed_double_const instead of GEN_INT for 1 << bitnum. (do_jump) <case BIT_AND_EXPR>: Use build_int_cst_wide_type instead of build_int_cst_type. * gcc.c-torture/execute/pr40057.c: New test. From-SVN: r147241
Diffstat (limited to 'gcc/dojump.c')
-rw-r--r--gcc/dojump.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 715e7373eee..36430851393 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -141,7 +141,8 @@ prefer_and_bit_test (enum machine_mode mode, int bitnum)
}
/* Fill in the integers. */
- XEXP (and_test, 1) = GEN_INT ((unsigned HOST_WIDE_INT) 1 << bitnum);
+ XEXP (and_test, 1)
+ = immed_double_const ((unsigned HOST_WIDE_INT) 1 << bitnum, 0, mode);
XEXP (XEXP (shift_test, 0), 1) = GEN_INT (bitnum);
return (rtx_cost (and_test, IF_THEN_ELSE, optimize_insn_for_speed_p ())
@@ -474,10 +475,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
&& prefer_and_bit_test (TYPE_MODE (argtype),
TREE_INT_CST_LOW (shift)))
{
- HOST_WIDE_INT mask = (HOST_WIDE_INT) 1
- << TREE_INT_CST_LOW (shift);
+ unsigned HOST_WIDE_INT mask
+ = (unsigned HOST_WIDE_INT) 1 << TREE_INT_CST_LOW (shift);
do_jump (build2 (BIT_AND_EXPR, argtype, arg,
- build_int_cst_type (argtype, mask)),
+ build_int_cst_wide_type (argtype, mask, 0)),
clr_label, set_label);
break;
}