[PATCH] D125712: [SLP][X86] Improve reordering to consider alternate instruction bundles

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 20:01:58 PDT 2022


vporpo added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2381
+    /// even and odd opcodes, like: OpcA, OpcB, OpcA, OpcB.
+    bool isAltShuffleWithRepeatingEvenOddOpcodes() const {
+      if (!isAltShuffle())
----------------
vdmitrie wrote:
> I'd say we don't really need this interface.
> IMO what is likely to be more useful is something like buildAltShuffleMask which you could directly feed into the TTI interface you added. See also buildShuffleEntryMask which could also benefit from having it.
Well, the issue is that the TTI function can't check whether this is an actual add-sub pattern, because it doesn't have all the information needed. For this to work, it would have to know how we are planning to combine the scalar instructions into vectors, which is an SLP-specific thing. So it feels that this logic should not belong to TTI and instead it should all be in the SLP pass.

Regarding the mask, I don't really like the way this is done now. Actually I am not even sure passing the shuffle mask is a good idea because it doesn't actually help with checking the pattern. It is probably best to just pass the even/odd opcodes and the vector type and ask for TTI to very whether these the compatible ones with the addsub instructions.

Wdyt?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125712/new/

https://reviews.llvm.org/D125712



More information about the llvm-commits mailing list