[PATCH] D111976: [DAG] Create fptosi.sat from clamped fptosi

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 12:07:11 PDT 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4791
+// operands are the same as SimplifySelectCC. N0<N1 ? N2 : N3
+static SDValue IsSaturatingMinMax(SDValue N0, SDValue N1, SDValue N2,
+                                  SDValue N3, ISD::CondCode CC, unsigned &BW) {
----------------
Function name should be lower case.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4804
+      return 0;
+    APInt C1 = N1C->getAPIntValue();
+    APInt C2 = N3C->getAPIntValue();
----------------
Use `const APInt &`


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4856
+
+  APInt MinC = MinCOp->getAPIntValue();
+  APInt MaxC = MaxCOp->getAPIntValue();
----------------
Use `const APInt &`


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4858
+  APInt MaxC = MaxCOp->getAPIntValue();
+  if (-MaxC - 1 != MinC || !(MinC + 1).isPowerOf2())
+    return SDValue();
----------------
Can we do -Max != (MinC + 1) and share the MinC + 1. One less computation for large APInts.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4864
+
+static SDValue PerformMinMaxFpToSatCombine(SDValue N0, SDValue N1, SDValue N2,
+                                           SDValue N3, ISD::CondCode CC,
----------------
Lower case function name


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

https://reviews.llvm.org/D111976



More information about the llvm-commits mailing list