https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127912

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|rguenth at gcc dot gnu.org         |unassigned at gcc dot 
gnu.org
             Status|ASSIGNED                    |NEW

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> So get_negative_load_store_type picks VMAT_CONTIGUOUS_DOWN.  But the out is
> because we do not implement permuting the mask for the reverse permute we do
> not require here.  I'm testing a patch.

Ah, so we _do_ require un-permuting the mask which comes in reversed so
the lack of being able to reverse the mask is the same reason we cannot
handle VMAT_CONTIGUOUS_DOWN.  For AVX style masks reversing should be
possible whenever we can reverse the data vector (aka for data vector mode
masks). For other style masks, esp. AVX512 style we have no good way to
reverse(?).

Runtime testcase:

void __attribute__((noipa))
foo(const float * a, int *__restrict__ out, int n)
{
  for (int i = n - 1; i >= 0; --i)
    if (a[i] != 0.0f)
      out[i] = 1;
}

int
main ()
{
  float a[36];
  int out[36] = {};
  for (int i = 0; i < 36; ++i)
    a[i] = (i > 5 && i < 29 && i & 3) ? 1.f : 0.f;
  foo (&a[2], &out[2], 32);
  for (int i = 0; i < 36; ++i)
    if (out[i] != (a[i] != 0.0f))
      __builtin_abort ();
  return 0;
}

Reply via email to