diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eacca234bef..13c5c0df2e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-15 Uros Bizjak + + PR target/80019 + * config/i386/i386.c (ix86_vector_duplicate_value): Create + subreg of inner mode for values already in registers. + 2017-03-15 Bernd Schmidt * config/c6x/c6x.c (hwloop_optimize): Handle case where the old diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5fcd51f1385..f58d529604c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -42571,10 +42571,16 @@ ix86_vector_duplicate_value (machine_mode mode, rtx target, rtx val) if (recog_memoized (insn) < 0) { rtx_insn *seq; + machine_mode innermode = GET_MODE_INNER (mode); + rtx reg; + /* If that fails, force VAL into a register. */ start_sequence (); - XEXP (dup, 0) = force_reg (GET_MODE_INNER (mode), val); + reg = force_reg (innermode, val); + if (GET_MODE (reg) != innermode) + reg = gen_lowpart (innermode, reg); + XEXP (dup, 0) = reg; seq = get_insns (); end_sequence (); if (seq) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cca75c7ee7d..608f958c5ba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-15 Uros Bizjak + + PR target/80019 + * gcc.target/i386/pr80019.c: New test. + 2017-03-15 Martin Liska * gcc.dg/tree-prof/pr66295.c: Removed unused dg-error. diff --git a/gcc/testsuite/gcc.target/i386/pr80019.c b/gcc/testsuite/gcc.target/i386/pr80019.c new file mode 100644 index 00000000000..35ec9608a80 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr80019.c @@ -0,0 +1,13 @@ +/* PR target/80019 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mxop -mavx2" } */ + +typedef char v16qi __attribute__ ((vector_size (16))); + +extern v16qi b, c; + +void +foo (int e) +{ + b = c << e; +}