[PATCH] D53053: [Intrinsic] Signed Saturation Addition Intrinsic

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 12 23:31:57 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/CodeGen/TargetLoweringBase.cpp:1895
+  SDValue SumPos = DAG.getSetCC(dl, BoolVT, Sum, Zero, ISD::SETGE);
+  SDValue SumNeg = DAG.getSetCC(dl, BoolVT, Sum, Zero, ISD::SETLT);
+  SDValue UseSatMax = DAG.getNode(ISD::AND, dl, BoolVT, Overflow, SumNeg);
----------------
What if we did the selects like this? Then we don't need any ANDs and we only need one setcc.

overflow ? (sum < 0 ? satmax : satmin) : sum


Repository:
  rL LLVM

https://reviews.llvm.org/D53053





More information about the llvm-commits mailing list