[llvm-dev] TriviallyVectorizable Attribute in TD file

Mark Schimmel via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 24 13:34:44 PST 2020


It seems wrong to me that VectorUtils.cpp contains this switch statement:

/// Return true if all of the intrinsic's arguments and return type are scalars
/// for the scalar form of the intrinsic, and vectors for the vector form of the
/// intrinsic (except operands that are marked as always being scalar by
/// hasVectorInstrinsicScalarOpd).
bool llvm::isTriviallyVectorizable(Intrinsic::ID ID) {
  switch (ID) {
  case Intrinsic::bswap: // Begin integer bit-manipulation.
  case Intrinsic::bitreverse:

First it would be easy to create an attribute for this that is defined in the TD file similar to others (IntrNoMem, IntrSpeculatable, IntrWillReturn, Commutative).
Second, it should apply to target intrinsics and allow them to vectorize also.

// Intrinsic isTriviallyVectorizable
def TriviallyVectorizable : IntrinsicProperty;

...

Would you be open to a patch for this functionality?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201124/89504d54/attachment.html>


More information about the llvm-dev mailing list