[PATCH] D45723: [X86] Lowering SAD (sum of absolute differences) intrinsics to native IR (LLVM side)

Mikhail Dvoretckii via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 07:45:58 PDT 2018


mike.dvoretsky added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:38075
+  // by vectors of 0-7 offsets, creating 8 vectors of byte differences that are
+  // then summed.
+  while (NumByteGroups) {
----------------
RKSimon wrote:
> Can we reuse/tweak matchBinOpReduction to do this for us?
This is not a scalar reduction. The patterns calls for a sum of specifically formed vectors (hence all the checks below) to form the PSADBW instruction where it is exactly semantically fitting rather than where it can be used as a reduction tool. This is also why the third path to recognize it is being added - other paths use it for reductions and so don't actually need the input pattern to match it in terms of which qword the specific byte corresponds to.


https://reviews.llvm.org/D45723





More information about the llvm-commits mailing list