On Tue, Apr 17, 2018 at 6:39 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> Hi!
>
> This define_insn has just 2 match_operands, so using alu type for it without
> defining memory attr is incorrect and can result in ICEs.
> My understanding is that alu1 is exactly what we want here.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-04-17  Jakub Jelinek  <ja...@redhat.com>
>
>         PR target/85430
>         * config/i386/i386.md (*ashlqi3_1_slp): Use alu1 type instead of alu.
>
>         * gcc.dg/pr85430.c: New test.

OK for trunk and backports.

Thanks,
Uros.

> --- gcc/config/i386/i386.md.jj  2018-04-05 20:34:31.989020754 +0200
> +++ gcc/config/i386/i386.md     2018-04-17 13:22:08.134050850 +0200
> @@ -10713,7 +10713,7 @@ (define_insn "*ashlqi3_1_slp"
>  {
>    switch (get_attr_type (insn))
>      {
> -    case TYPE_ALU:
> +    case TYPE_ALU1:
>        gcc_assert (operands[1] == const1_rtx);
>        return "add{b}\t%0, %0";
>
> @@ -10729,12 +10729,12 @@ (define_insn "*ashlqi3_1_slp"
>       (cond [(and (and (match_test "TARGET_DOUBLE_WITH_ADD")
>                       (match_operand 0 "register_operand"))
>                  (match_operand 1 "const1_operand"))
> -             (const_string "alu")
> +             (const_string "alu1")
>            ]
>            (const_string "ishift1")))
>     (set (attr "length_immediate")
>       (if_then_else
> -       (ior (eq_attr "type" "alu")
> +       (ior (eq_attr "type" "alu1")
>             (and (eq_attr "type" "ishift1")
>                  (and (match_operand 1 "const1_operand")
>                       (ior (match_test "TARGET_SHIFT1")
> --- gcc/testsuite/gcc.dg/pr85430.c.jj   2018-04-17 13:23:46.336087029 +0200
> +++ gcc/testsuite/gcc.dg/pr85430.c      2018-04-17 13:23:22.653078309 +0200
> @@ -0,0 +1,12 @@
> +/* PR target/85430 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fno-tree-ccp -fno-tree-fre" } */
> +
> +typedef char V __attribute__((vector_size (4)));
> +
> +V
> +foo (V v)
> +{
> +  v[(V){}[0]] <<= 1;
> +  return v;
> +}
>
>         Jakub

Reply via email to