* config/i386/i386-features.c
authorUros Bizjak <ubizjak@gmail.com>
Thu, 29 Aug 2019 19:47:19 +0000 (21:47 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 29 Aug 2019 19:47:19 +0000 (21:47 +0200)
(general_scalar_chain::compute_convert_gain):
Correct cost for double-word shifts.
(general_scalar_to_vector_candidate_p): Reject count operands
greater or equal to mode bitsize.

From-SVN: r275055

gcc/ChangeLog
gcc/config/i386/i386-features.c

index f73e8be..e096497 100644 (file)
@@ -1,5 +1,13 @@
 2019-08-29  Uroš Bizjak  <ubizjak@gmail.com>
 
+       * config/i386/i386-features.c
+       (general_scalar_chain::compute_convert_gain):
+       Correct cost for double-word shifts.
+       (general_scalar_to_vector_candidate_p): Reject count operands
+       greater or equal to mode bitsize.
+
+2019-08-29  Uroš Bizjak  <ubizjak@gmail.com>
+
        * config/i386/i386.c (inline_secondary_memory_needed): Return true
        for moves between SSE and non-general registers and between
        mask and non-general registers.
index 03f33f8..454eeae 100644 (file)
@@ -549,11 +549,18 @@ general_scalar_chain::compute_convert_gain ()
               || GET_CODE (src) == ASHIFTRT
               || GET_CODE (src) == LSHIFTRT)
        {
+         if (m == 2)
+           {
+             if (INTVAL (XEXP (src, 1)) >= 32)
+               igain += ix86_cost->add;
+             else
+               igain += ix86_cost->shift_const;
+           }
+
+         igain += ix86_cost->shift_const - ix86_cost->sse_op;
+
          if (CONST_INT_P (XEXP (src, 0)))
            igain -= vector_const_cost (XEXP (src, 0));
-         igain += m * ix86_cost->shift_const - ix86_cost->sse_op;
-         if (INTVAL (XEXP (src, 1)) >= 32)
-           igain -= COSTS_N_INSNS (1);
        }
       else if (GET_CODE (src) == PLUS
               || GET_CODE (src) == MINUS
@@ -1359,7 +1366,7 @@ general_scalar_to_vector_candidate_p (rtx_insn *insn, enum machine_mode mode)
     case ASHIFT:
     case LSHIFTRT:
       if (!CONST_INT_P (XEXP (src, 1))
-         || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, 63))
+         || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, GET_MODE_BITSIZE (mode)-1))
        return false;
       break;