[PATCH] D81383: [VE] Support lowering to NND instruction

Kazushi Marukawa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 17:44:21 PDT 2020


kaz7 marked an inline comment as done.
kaz7 added a comment.

Thanks.  Updated.



================
Comment at: llvm/lib/Target/VE/VEISelLowering.cpp:541-547
+  // VE allows different immediate values for X and Y where ~X & Y.
+  // Only simm7 works for X, and only mimm works for Y.  It doesn't match
+  // hasAndNot requirements, so return false for all immediate values now.
+  // FIXME: Change hasAndNot function to have two operands to work it
+  //        correctly with Aurora VE.
+  if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Y))
+    return false;
----------------
simoll wrote:
> kaz7 wrote:
> > simoll wrote:
> > > Why not `return true` for all scalar NANDs? Constants can always be pulled through registers if we cannot turn them into immediates.
> > Because retrieving immediate value uses LEA or aother instruction.
> > 
> > Let me explain the background of this function.  This hasAndNot function is used in `SelectionDAG/DAGCombiner.cpp` in order to check conversion from `((x ^ y) & m) ^ y` to higher `(x & m) | (y & ~m)` or `~(~x & m) & (m | y)`.
> > 
> > All of them uses 3 instructions but latter two has better parallelism on pipeline.  So, adding new instruction to use and-not instruction is not OK for this case.
> Thanks for the explanation.
> It would be helpful to have a comment here that explains what motivates this and how the function is used in DAGCombiner.
Add it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81383





More information about the llvm-commits mailing list