(make_compound_operation): Handle the case (and (xor/ior (lshift...) (lshift...)...
authorJim Wilson <wilson@gcc.gnu.org>
Tue, 31 Aug 1993 22:08:25 +0000 (15:08 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Tue, 31 Aug 1993 22:08:25 +0000 (15:08 -0700)
(make_compound_operation): Handle the case
(and (xor/ior (lshift...) (lshift...)) ...).
(make_field_assignment): In get_pos_from_mask call, only invert
bits in mode mask.

From-SVN: r5237

gcc/combine.c

index 777cce41b40645152f3dbe3d6528e9c6f5df2aaf..d833b592fa29ba5d77f302ba0497c603916b2b75 100644 (file)
@@ -5296,6 +5296,21 @@ make_compound_operation (x, in_code)
                                 XEXP (SUBREG_REG (XEXP (x, 0)), 1), i, 1,
                                 0, in_code == COMPARE);
        }
+      /* Same as previous, but for (xor/ior (lshift...) (lshift...)).  */
+      else if ((GET_CODE (XEXP (x, 0)) == XOR
+               || GET_CODE (XEXP (x, 0)) == IOR)
+              && GET_CODE (XEXP (XEXP (x, 0), 0)) == LSHIFTRT
+              && GET_CODE (XEXP (XEXP (x, 0), 1)) == LSHIFTRT
+              && (i = exact_log2 (INTVAL (XEXP (x, 1)) + 1)) >= 0)
+       {
+         /* Apply the distributive law, and then try to make extractions.  */
+         new = gen_rtx_combine (GET_CODE (XEXP (x, 0)), mode,
+                                gen_rtx (AND, mode, XEXP (XEXP (x, 0), 0),
+                                         XEXP (x, 1)),
+                                gen_rtx (AND, mode, XEXP (XEXP (x, 0), 1),
+                                         XEXP (x, 1)));
+         new = make_compound_operation (new, in_code);
+       }
 
       /* If we are have (and (rotate X C) M) and C is larger than the number
         of bits in M, this is an extraction.  */
@@ -6100,7 +6115,7 @@ make_field_assignment (x)
   else
     return x;
 
-  pos = get_pos_from_mask (~c1, &len);
+  pos = get_pos_from_mask (c1 ^ GET_MODE_MASK (GET_MODE (dest)), &len);
   if (pos < 0 || pos + len > GET_MODE_BITSIZE (GET_MODE (dest))
       || (GET_MODE_BITSIZE (GET_MODE (other)) <= HOST_BITS_PER_WIDE_INT
          && (c1 & nonzero_bits (other, GET_MODE (other))) != 0))