This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix PR middle-end/22480





Uros Bizjak <ubizjak@gmail.com> wrote on 10/09/2005 02:02:20 PM:
> Richard Henderson wrote:
>
> >>+     optab_op2_mode = insn_data[icode].operand[2].mode;
> >>+     if (VECTOR_MODE_P (vec_mode)
> >>+         && !VECTOR_MODE_P (optab_op2_mode)
> >>+         && (dt == vect_constant_def
> >>+        || dt == vect_invariant_def))
> >>
> >>
> >I must be missing something.  At what point do you fail the
transformation
> >because op2 is *not* invariant?
> >
> >
> A couple of lines above, there is a loop that checks all tree operands
> with 'vect_is_simple_use (..., &dt)'. At the check quoted above, dt
> holds the definition of  the last operand, which is just what we need.
>
> This optimization was suggested by Dorit in her earlier message:
>
> >(by the way, vect_is_simple_use is already called earlier in that
function,
> >and the last value of 'dt' should hold the information you need).
> >

Yes, but as Richard pointed out, you still need to fail vectorization if
you find that the vec_mode requires invariant argument, and 'dt' (def type)
is not constant/invariant. I didn't notice this when I looked at the patch.
Your patch will fail on this testcase:

void convert_32_to_8(void)
{
  static unsigned bm[16];
  int am[16];
  int j;
  for (j=0; j<16;j++)
    bm[j]<<=am[j];
}

You need to add something along these lines before the tranform part in
vectorizable_operation:

  if (code == LSHIFT_EXPR || code == RSHIFT_EXPR)
    {
      optab_op2_mode = insn_data[icode].operand[2].mode;
      if (VECTOR_MODE_P (vec_mode)
          && !VECTOR_MODE_P (optab_op2_mode)
          && (dt != vect_constant_def
              && dt != vect_invariant_def))
        {
          if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "operand mode requires invariant
argument.");
          return false;
        }
    }

dorit


> Uros.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]