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: PATH: Replace UNITS_PER_SIMD_WORD with GET_MODE_SIZE (TYPE_MODE (vectype))


My first patch doesn't change
UNITS_PER_SIMD_WORD at all. It just removes
the hardcoded UNITS_PER_SIMD_WORD usage.
The only one left is in get_vectype_for_scalar_type.

I like this approach the most. As for get_vectype_for_scalar_type, this probably should be a target hook (effectively taking the place of UNITS_PER_SIMD_WORD).

Maybe. However, the target hook would be implemented, depending on the architecture, either like this:


  nbytes = GET_MODE_SIZE (TYPE_MODE (scalar_type));
  nunits = UNITS_PER_SIMD_WORD / nbytes;
  vectype = build_vector_type (scalar_type, nunits);
  if (!VECTOR_MODE_P (TYPE_MODE (vectype))
      && !INTEGRAL_MODE_P (TYPE_MODE (vectype)))
    return NULL_TREE;

or like this:

switch (TYPE_MODE (scalar_type))
{
case QImode: return build_vector_type_for_mode (scalar_type, V16QImode);
case HImode: return build_vector_type_for_mode (scalar_type, V8HImode);
case SImode: return build_vector_type_for_mode (scalar_type, V4SImode);
...
}


in all the targets. All the dumping stuff would stay in tree-vectorizer.c, and even if you added a new build_vector_type_for_size function, it would add more code duplication than value.

I think that H.J.'s patch to only use UNITS_PER_SIMD_WORD in get_vectype_for_scalar_type, plus his patch to add an argument to the target macro, is the simplest thing to do and it works.

Paolo


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