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

Kazushi Marukawa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 06:31:10 PDT 2020


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

Thanks for reviewing.  Add reply to your question.



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


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