[PATCH] D28982: DAG: Do not scalarize fsub if fneg is legal

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 06:31:16 PST 2017


hfinkel added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:1032
+SDValue VectorLegalizer::ExpandFSUB(SDValue Op) {
+  if (TLI.isOperationLegalOrCustom(ISD::FNEG, Op.getValueType()))
+    return Op; // Defer to operation legalization.
----------------
I'd like a better comment here, how about:

  // For floating-point values, (a-b) is the same as a+(-b). If FNEG is legal, we can defer this to operation legalization where it will be lowered as a+(-b).



================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:1032
+SDValue VectorLegalizer::ExpandFSUB(SDValue Op) {
+  if (TLI.isOperationLegalOrCustom(ISD::FNEG, Op.getValueType()))
+    return Op; // Defer to operation legalization.
----------------
hfinkel wrote:
> I'd like a better comment here, how about:
> 
>   // For floating-point values, (a-b) is the same as a+(-b). If FNEG is legal, we can defer this to operation legalization where it will be lowered as a+(-b).
> 
Also check for ISD::ADD being LegalOrCustom to match the code in LegalizeDAG.cpp.


https://reviews.llvm.org/D28982





More information about the llvm-commits mailing list