[PATCH] D125739: [LegalizeTypes][VP] Add integer promotions support for VP_TRUNCATE

WangLian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 00:22:08 PDT 2022


Jimerlife added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1358
+      EOp2 = DAG.getNode(ISD::TRUNCATE, dl, HalfNVT, EOp2);
+    }
 
----------------
craig.topper wrote:
> Shouldn't we have `if` and `else` instead of two `if`s?
Done. Use if and else instead of two ifs


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1392
   // Truncate to NVT instead of VT
-  return DAG.getNode(ISD::TRUNCATE, dl, NVT, Res);
+  return Opcode == ISD::VP_TRUNCATE
+             ? DAG.getNode(Opcode, dl, NVT, Res, N->getOperand(1),
----------------
craig.topper wrote:
> Use an `if` and two returns instead of `?:` operator.
Done.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:2098
   SDValue Op = GetPromotedInteger(N->getOperand(0));
-  return DAG.getNode(ISD::TRUNCATE, SDLoc(N), N->getValueType(0), Op);
+  return N->getOpcode() == ISD::VP_TRUNCATE
+             ? DAG.getNode(ISD::VP_TRUNCATE, SDLoc(N), N->getValueType(0), Op,
----------------
craig.topper wrote:
> Use an `if` and two returns.
Done


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125739



More information about the llvm-commits mailing list