[PATCH] D117210: [CodeGen] Support folds of not(cmp(cc, ...)) -> cmp(!cc, ...) for scalable vectors

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 07:26:17 PST 2022


sdesmalen added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:3160
   APInt CVal;
   if (auto *CN = dyn_cast<ConstantSDNode>(N)) {
     CVal = CN->getAPIntValue();
----------------
Instead of checking for SPLAT_VECTOR explicitly, how about:

  if (auto *CN = dyn_cast<ConstantSDNode>(N)) {
    CVal = CN->getAPIntValue();
  } else if (isConstantSplatVector(N, CVal)) {
    unsigned EltWidth = N->getValueType(0).getScalarSizeInBits();
    if (EltWidth < CVal.getBitwidth())
      CVal = CVal.trunc(EltWidth);
  } else
    return false;



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

https://reviews.llvm.org/D117210



More information about the llvm-commits mailing list