[PATCH] D87700: [SVE] Replace *, / operators in TypeSize/ElementCount with mul, div

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 08:24:13 PDT 2020


david-arm created this revision.
david-arm added reviewers: sdesmalen, fpetrogalli, ctetreau, efriedma, kmclaughlin, c-rhodes.
Herald added subscribers: llvm-commits, ecnelises, psnobl, hiraditya, tschuett.
Herald added a project: LLVM.
david-arm requested review of this revision.

After some recent upstream discussion we decided that it was best
to avoid having * and / operators for both ElementCount and TypeSize,
since this could give the impression that these classes can be used
in the same way as basic integer integer types. However, division
for scalable types is a bit odd because we are only dividing the
minimum quantity by a value, as opposed to something like:

  (MinSize * Vscale) / SomeValue

This is why when performing division it's important the caller
first establishes whether the operation makes sense, perhaps by
calling isKnownMultipleOf() prior to division. The caller must now
explictly call div() on the class to perform the operation.
Similarly, it seems sensible to replace the * operator with an
equivalent mul() function to keep parity with the divide.


https://reviews.llvm.org/D87700

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  llvm/include/llvm/CodeGen/ValueTypes.h
  llvm/include/llvm/IR/DataLayout.h
  llvm/include/llvm/IR/DerivedTypes.h
  llvm/include/llvm/Support/MachineValueType.h
  llvm/include/llvm/Support/TypeSize.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
  llvm/unittests/IR/VectorTypesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87700.291940.patch
Type: text/x-patch
Size: 30666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/2f3ae2b3/attachment.bin>


More information about the llvm-commits mailing list