From 8c7cc1a98ff3834ac2e0a57533c08d123aeebd81 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sun, 11 Dec 2016 19:59:07 +0100 Subject: [PATCH] re PR target/70799 (STV pass does not convert DImode shifts) PR target/70799 * config/i386/i386.c (dimode_scalar_to_vector_candidate_p) : Consider all constant shifts. Add FIXME comment. (dimode_scalar_chain::compute_convert_gain): Reduce gain for constant shifts larger or equal than 32. testsuite/ChangeLog: PR target/70799 * gcc.target/i386/pr70799-3.c: New test. From-SVN: r243530 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.c | 10 ++++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr70799-3.c | 17 +++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr70799-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b67688d..24a7fdd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-12-11 Uros Bizjak + + PR target/70799 + * config/i386/i386.c (dimode_scalar_to_vector_candidate_p) + : Consider all constant shifts. + Add FIXME comment. + (dimode_scalar_chain::compute_convert_gain): Reduce gain for + constant shifts larger or equal than 32. + 2016-12-11 Roger Pau Monné * config/i386/x86-64.h: Append --32 to the assembler options when diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1cd1cd8..152e6bc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2809,10 +2809,9 @@ dimode_scalar_to_vector_candidate_p (rtx_insn *insn) { case ASHIFT: case LSHIFTRT: - /* Consider only non-variable shifts narrower - than general register width. */ - if (!(CONST_INT_P (XEXP (src, 1)) - && IN_RANGE (INTVAL (XEXP (src, 1)), 0, 31))) + /* FIXME: consider also variable shifts. */ + if (!CONST_INT_P (XEXP (src, 1)) + || !IN_RANGE (INTVAL (XEXP (src, 1)), 0, 63)) return false; break; @@ -3409,6 +3408,9 @@ dimode_scalar_chain::compute_convert_gain () gain += ix86_cost->add; if (CONST_INT_P (XEXP (src, 0))) gain -= vector_const_cost (XEXP (src, 0)); + if (CONST_INT_P (XEXP (src, 1)) + && INTVAL (XEXP (src, 1)) >= 32) + gain -= COSTS_N_INSNS (1); } else if (GET_CODE (src) == PLUS || GET_CODE (src) == MINUS diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8603a02..aa9aae7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-11 Uros Bizjak + + PR target/70799 + * gcc.target/i386/pr70799-3.c: New test. + 2016-12-11 Paolo Carlini PR c++/78637 diff --git a/gcc/testsuite/gcc.target/i386/pr70799-3.c b/gcc/testsuite/gcc.target/i386/pr70799-3.c new file mode 100644 index 0000000..92df1c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70799-3.c @@ -0,0 +1,17 @@ +/* PR target/pr70799 */ +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-O2 -march=slm -fno-split-wide-types -mno-stackrealign" } */ +/* { dg-final { scan-assembler "psllq" } } */ +/* { dg-final { scan-assembler "psrlq" } } */ + +unsigned long long a, b, c; + +void test1 (void) +{ + a = (b << 55) | c; +} + +void test2 (void) +{ + a = (b >> 55) | c; +} -- 2.7.4