From: Michael Meissner Date: Wed, 7 Dec 2016 23:52:05 +0000 (+0000) Subject: re PR target/72717 (ICE: in emit_move_insn, at expr.c:3693 with vector shift @ powerp... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc3f36f9a1642338da8c0428ea5dc140402556c9;p=gcc.git re PR target/72717 (ICE: in emit_move_insn, at expr.c:3693 with vector shift @ powerpc64le) [gcc] 2016-12-07 Michael Meissner PR target/72717 * config/rs6000/rs6000.c (rs6000_expand_vector_init): If the V2DImode elements are SUBREG's convert the result into DImode rather than failing in emit_move_insn. [gcc/testsuite] 2016-12-07 Michael Meissner PR target/72717 * gcc.target/powerpc/pr72717.c: New test. From-SVN: r243418 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc6dc718bdf..79d5d6de19b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-12-07 Michael Meissner + + PR target/72717 + * config/rs6000/rs6000.c (rs6000_expand_vector_init): If the + V2DImode elements are SUBREG's convert the result into DImode + rather than failing in emit_move_insn. + 2016-12-07 Jakub Jelinek * builtins.c (fold_builtin_strstr): Removed. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b75a290da6a..f0c1354696b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -6891,25 +6891,43 @@ rs6000_expand_vector_init (rtx target, rtx vals) /* Double word values on VSX can use xxpermdi or lxvdsx. */ if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode)) { - rtx op0 = XVECEXP (vals, 0, 0); - rtx op1 = XVECEXP (vals, 0, 1); + rtx op[2]; + size_t i; + size_t num_elements = all_same ? 1 : 2; + for (i = 0; i < num_elements; i++) + { + op[i] = XVECEXP (vals, 0, i); + /* Just in case there is a SUBREG with a smaller mode, do a + conversion. */ + if (GET_MODE (op[i]) != inner_mode) + { + rtx tmp = gen_reg_rtx (inner_mode); + convert_move (tmp, op[i], 0); + op[i] = tmp; + } + /* Allow load with splat double word. */ + else if (MEM_P (op[i])) + { + if (!all_same) + op[i] = force_reg (inner_mode, op[i]); + } + else if (!REG_P (op[i])) + op[i] = force_reg (inner_mode, op[i]); + } + if (all_same) { - if (!MEM_P (op0) && !REG_P (op0)) - op0 = force_reg (inner_mode, op0); if (mode == V2DFmode) - emit_insn (gen_vsx_splat_v2df (target, op0)); + emit_insn (gen_vsx_splat_v2df (target, op[0])); else - emit_insn (gen_vsx_splat_v2di (target, op0)); + emit_insn (gen_vsx_splat_v2di (target, op[0])); } else { - op0 = force_reg (inner_mode, op0); - op1 = force_reg (inner_mode, op1); if (mode == V2DFmode) - emit_insn (gen_vsx_concat_v2df (target, op0, op1)); + emit_insn (gen_vsx_concat_v2df (target, op[0], op[1])); else - emit_insn (gen_vsx_concat_v2di (target, op0, op1)); + emit_insn (gen_vsx_concat_v2di (target, op[0], op[1])); } return; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c3f290762d..33f1f86a055 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-07 Michael Meissner + + PR target/72717 + * gcc.target/powerpc/pr72717.c: New test. + 2016-12-07 Jakub Jelinek * gcc.dg/builtin-strstr-1.c: New test. diff --git a/gcc/testsuite/gcc.target/powerpc/pr72717.c b/gcc/testsuite/gcc.target/powerpc/pr72717.c new file mode 100644 index 00000000000..1446098ba20 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr72717.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O2" } */ + +typedef long V __attribute__((__vector_size__(32))); + +extern void foo (V *, V*); + +/* This test generated an failure in emit_move_insn. */ + +void +foo(V *p, V *q) +{ + V v = *q; + *p = v << v[0]; +} + +/* { dg-final { scan-assembler-times "vsld" 2 } } */