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

            Bug ID: 121744
           Summary: Testing std::bitset isn't vectorized
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

541.leela_r contains sth along the following:

#include <bitset>
#include <vector>

class Foo
{
public:
    void fun (std::bitset<21*21>& blacksq);
    std::vector<int> m_mcowner;
};

void Foo::fun(std::bitset<21*21>& blacksq)
{
  for (unsigned int i = 0; i < blacksq.size(); i++)
    if (blacksq[i])
      m_mcowner[i]++;
}


the loop isn't vectorized after PR121685 is fixed because std::bitset
results in

  <bb 3> [local count: 1063004408]:
  # i_22 = PHI <i_12(7), 0(15)>
  # ivtmp_33 = PHI <ivtmp_32(7), 441(15)>
  _1 = (long unsigned int) i_22;
  _15 = _1 >> 6;
  _20 = i_22 & 63;
  _10 = MEM <struct _Base_bitset> [(_WordT *)blacksq_8(D)]._M_w[_15];
  _13 = 1 << _20;

^^^

this is (unsigned long)1 << (unsigned int)_20 which at least on x86_64
is not supported natively.  AVX2 has vpsllvq, but this might not be the
most efficient strathegy to vectorize this.

  _14 = _10 & _13;
  _31 = _14 != 0;
  _18 = _1 * 4;
  _44 = _43 + _18;
  _19 = (value_type &) _44;
  _2 = .MASK_LOAD (_19, 32, _31, 0);

Still the main reason this isn't vectorized is that
vect_recog_vector_vector_shift_pattern does not handle constant op0.

Reply via email to