[PATCH] D49837: [SelectionDAG][X86] Handle unary SelectPatternFlavor for ABS case in SelectionDAGBuilder::visitSelect.

Ivan Kulagin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 10:16:01 PDT 2018


ikulagin added a comment.

In https://reviews.llvm.org/D49837#1176658, @lebedev.ri wrote:

> The IR pattern produced by https://reviews.llvm.org/D48754 is already matched into `ISD::ABS`? Or is there a third differential?


This patch produces ISD::ABS when ValueTracking recognizes the pattern from https://reviews.llvm.org/D48754.

But, what DAG should be produced when ValueTraking recognizes the SPF_NABS pattern? 
There is no NABS type for DAG nodes. I propose the following (SUB 0, (ABS X)).



================
Comment at: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1388-1390
+  case ISD::ABS:
+    ExpandIntRes_ABS(N, Lo, Hi);
+    break;
----------------
lebedev.ri wrote:
> Inconsistent with the rest.
> Unless the final line is longer than 80-chars, make it one line?
The code was formatted by clang-format.
Should I reformat it like the rest?


Repository:
  rL LLVM

https://reviews.llvm.org/D49837





More information about the llvm-commits mailing list