OSDN Git Service

* fold-const.c (fold_truthop): When converting a one-bit
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 May 1999 01:24:24 +0000 (01:24 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 May 1999 01:24:24 +0000 (01:24 +0000)
        comparison don't sign extend the constant.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26962 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c

index 6f6f666..6460356 100644 (file)
@@ -1,5 +1,13 @@
+Mon May 17 01:57:37 1999  David Daney <daney@ibw.com.ni>
+
+       * i386/sol2.h (LINK_SPEC): Do not pass "-z text" to the linker
+       if -mimpure-text.
+
 1999-05-17  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
 
+       * 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.
 
index b7720f7..6acbe0b 100644 (file)
@@ -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;