[PATCH] D28810: [X86][SSE] Use MOVMSK for all_of/any_of reduction patterns

Filipe Cabecinhas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 07:50:54 PST 2017


filcab added a comment.

I see that some simple tests grow by a bunch of instructions (also simple, but from looking at instruction tables, it seems to be marginally slower after this transform). These tests are like micro-benchmarks and don't really reflect real-world code, but should we only do this transform if we have a minimum number of shuffles?

Thanks,
Filipe



================
Comment at: lib/Target/X86/X86ISelLowering.cpp:28639
+    SDValue Match = matchBinOpReduction(Extract, Op);
+    if (!Match || (Match.getScalarValueSizeInBits() != BitWidth))
+      continue;
----------------
Maybe that second part should be in an assert?
The way I see it, we haven't really done much yet, so either:
  - The bitwidth changed (how? `matchBinOpReduction` bails if it encounters an extract_subvector (shuffles with different sizes are a thing in IR though, can't remember if also on SDAG)) but we can still recover if we use the new bitwidth we got (if it still matched, there shouldn't be a big problem, no?)
  - The bitwidth changed and we can't recover (does this happen?)


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:28657
+      MaskVT = MVT::getFloatingPointVT(BitWidth);
+      MaskVT = MVT::getVectorVT(MaskVT, MatchSizeInBits / BitWidth);
+    } else {
----------------
This raised a red flag when reading. Maybe join the two? Will it be that hard to read?
Otherwise, something like
```MVT ElemVT = ...;
MaskVT = ...;```


Repository:
  rL LLVM

https://reviews.llvm.org/D28810





More information about the llvm-commits mailing list