[PATCH] D49837: [SelectionDAG] Handle unary SelectPatternFlavor for ABS case in SelectionDAGBuilder::visitSelect.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 30 03:31:32 PDT 2018
RKSimon added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:4458
+ SDValue Shift = DAG.getNode(ISD::SRA, dl, VT, Op,
+ DAG.getConstant(VT.getScalarSizeInBits() - 1, dl, VT));
+ SDValue Add = DAG.getNode(ISD::ADD, dl, VT, Op, Shift);
----------------
The shift constant needs to use a getShiftAmountTy type
================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:1210
+/* for (auto &VT : {MVT::i8, MVT::i64})
+ setOperationAction(ISD::ABS, VT, Legal);*/
+ setTargetDAGCombine(ISD::ABS);
----------------
Don't include commented out code
================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:10309
+
+ return DAG.getNode(ISD::XOR, DL, VT, Add, Shift);
+}
----------------
Just call TargetLowering::expandABS ?
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26030
+ Results.push_back(Lo);
+ Results.push_back(Hi);
+ return;
----------------
Seems a shame this (and the ARM) code can't be put into the legalizers
================
Comment at: test/CodeGen/Thumb/iabs.ll:76
+ ret i64 %abs
+}
----------------
Add these new tests to trunk now so the patch shows the codegen diff
Repository:
rL LLVM
https://reviews.llvm.org/D49837
More information about the llvm-commits
mailing list