From 71a874cd5e9e451f1703393e8d7216f488f4e95b Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 16 May 1999 19:24:24 -0600 Subject: [PATCH] fold-const.c (fold_truthop): When converting a one-bit comparison don't sign extend the constant. * fold-const.c (fold_truthop): When converting a one-bit comparison don't sign extend the constant. From-SVN: r26962 --- gcc/ChangeLog | 8 ++++++++ gcc/fold-const.c | 25 ++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f6f6668031..6460356a5b0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ +Mon May 17 01:57:37 1999 David Daney + + * i386/sol2.h (LINK_SPEC): Do not pass "-z text" to the linker + if -mimpure-text. + 1999-05-17 Andreas Schwab + * fold-const.c (fold_truthop): When converting a one-bit + comparison don't sign extend the constant. + * cse.c (cse_insn): Copy SRC_CONST before putting it in the REG_EQUAL note. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b7720f745a5..6acbe0baf34 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3806,30 +3806,25 @@ fold_truthop (code, truth_type, lhs, rhs) { if (l_const && integer_zerop (l_const) && integer_pow2p (ll_mask)) { - if (ll_unsignedp || tree_log2 (ll_mask) + 1 < ll_bitsize) - l_const = ll_mask; - else - /* Since ll_arg is a single bit bit mask, we can sign extend - it appropriately with a NEGATE_EXPR. - l_const is made a signed value here, but since for l_const != NULL - lr_unsignedp is not used, we don't need to clear the latter. */ - l_const = fold (build1 (NEGATE_EXPR, TREE_TYPE (ll_arg), - convert (TREE_TYPE (ll_arg), ll_mask))); + /* Do not sign extend the constant here. The left operand + is either always unsigned or there is a BIT_AND_EXPR that + masks out the extension bits. */ + if (! (ll_unsignedp || ll_and_mask != 0)) + abort (); + l_const = ll_mask; } else return 0; } + /* This is analogous to the code for l_const above. */ if (rcode != wanted_code) { if (r_const && integer_zerop (r_const) && integer_pow2p (rl_mask)) { - if (rl_unsignedp || tree_log2 (rl_mask) + 1 < rl_bitsize) - r_const = rl_mask; - else - /* This is analogous to the code for l_const above. */ - r_const = fold (build1 (NEGATE_EXPR, TREE_TYPE (rl_arg), - convert (TREE_TYPE (rl_arg), rl_mask))); + if (! (rl_unsignedp || rl_and_mask != 0)) + abort (); + r_const = rl_mask; } else return 0; -- 2.30.2