[PATCH] D49248: [TargetLowering] Add support for non-uniform vectors to BuildUDIV

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 12:03:21 PDT 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:3567
+    if (VT.isVector()) {
+      Q = DAG.getVectorShuffle(VT, dl, Q, NPQ, ShuffleMask);
+      Created->push_back(Q.getNode());
----------------
I'm pretty sure this isn't the most efficient way to handle this case.  Would it be more efficient to use a variable-amount shift to compute NPQ, rather than shuffle afterwards?  Or is it possible to fudge the magic number to avoid the blend?

Please make sure you have test coverage for both UseNPQ=true and UseNPQ=false.


================
Comment at: test/CodeGen/X86/combine-udiv.ll:383
+; SSE-NEXT:    movdqa %xmm0, %xmm1
+; SSE-NEXT:    psrlw $2, %xmm1
+; SSE-NEXT:    pblendw {{.*#+}} xmm1 = xmm0[0,1,2,3,4],xmm1[5,6],xmm0[7]
----------------
I guess it's sort of orthogonal to this patch, but this should probably be using pmulhuw for the shift.


Repository:
  rL LLVM

https://reviews.llvm.org/D49248





More information about the llvm-commits mailing list