On 03/15/2016 12:14 PM, Jakub Jelinek wrote:
-  if (orig_code == LSHIFTRT && result_mode != shift_mode)
+     turn off all the bits that the shift would have turned off.
+     Similarly do this if we've optimized varop so that we don't perform
+     any shift.  */
+  if (orig_code == LSHIFTRT
+      && (result_mode != shift_mode
+         || (result_mode != mode
+             && count == 0
+             && orig_count != 0
+             && outer_op == UNKNOWN
+             && !complement_p)))

This looks really specialized, and I'd be worrying about whether it really is the right condition. Where exactly was the constant shifted by 31 and count set to 0? Must be here, right?

   /* If we have (A << B << C) for any shift, we can convert this to
      (A << C << B).  This wins if A is a constant.  Only try this if
      B is not a constant.  */

   else if (GET_CODE (varop) == code
            && CONST_INT_P (XEXP (varop, 0))
            && !CONST_INT_P (XEXP (varop, 1)))
    {
      rtx new_rtx = simplify_const_binary_operation (code, mode,
                                                    XEXP (varop, 0),
                                                    GEN_INT (count));
      varop = gen_rtx_fmt_ee (code, mode, new_rtx, XEXP (varop, 1));
      count = 0;
      continue;
    }

I think it might be clearer to notice and fix the problem here (or set a need_mask flag).


Bernd


Reply via email to