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

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 07:05:27 PDT 2020


simoll added inline comments.


================
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;
----------------
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.


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