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

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 26 22:02:05 PDT 2018


shchenz added a comment.

Please merge your code with the patch in https://reviews.llvm.org/D48754 and run related tests to check there is no failure.



================
Comment at: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:2135
 
+void DAGTypeLegalizer::ExpandIntRes_ABS(SDNode *N, SDValue &Lo, SDValue &Hi) {
+  SDLoc dl(N);
----------------
add some test for this function?


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:927
 
+SDValue VectorLegalizer::ExpandABS(SDValue Op) {
+  EVT VT = Op.getValueType();
----------------
same as above, need some testcases for this code change


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2918
 
+  bool IsUnary = false;
+
----------------
I am a little confused for IsUnary since abs is not the only unary node.  changing to one related with abs?


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2981
+    case SPF_ABS:
+      Opc = VT.isInteger() ? ISD::ABS : ISD::FABS;
+      IsUnary = true;
----------------
I think matchSelectionPattern can only find integer abs for now. Maybe we should only consider ISD::ABS for now and add ISD::FABS when matchSelectionPattern supports fabs?


Repository:
  rL LLVM

https://reviews.llvm.org/D49837





More information about the llvm-commits mailing list