From 2a3daf5b6101ff30f4bae3a83cf49e8f1e3d082b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 29 Aug 2019 21:47:19 +0200 Subject: [PATCH] * 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. From-SVN: r275055 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386-features.c | 15 +++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f73e8be7df2..e09649766e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-08-29 Uroš Bizjak + + * 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 * config/i386/i386.c (inline_secondary_memory_needed): Return true diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c index 03f33f8b0b0..454eeaebef9 100644 --- a/gcc/config/i386/i386-features.c +++ b/gcc/config/i386/i386-features.c @@ -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; -- 2.30.2