[PATCH] D120234: [ARM] Make i32 ISD::ABS Legal instead of pattern matching during isel.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 20 23:59:54 PST 2022


craig.topper created this revision.
craig.topper added reviewers: dmgreen, RKSimon.
Herald added subscribers: steven.zhang, hiraditya, kristof.beyls.
craig.topper requested review of this revision.
Herald added a project: LLVM.

Instead of matching (sra (X, size(X)-1); sub (xor (X, Y), Y))
during isel, make ISD::ABS Legal and use a regular isel pattern.

Also add new pseudo instructions for NABS to avoid creating a negate
after the ABS pseudo expansion. NABS is no longer expanded by DAGCombiner
to (sra (X, size(X)-1); sub (Y, xor (X, Y)) due to ABS being legal.
The new codegen looks like what gcc generates for NABS.

This is a followup from D119171 <https://reviews.llvm.org/D119171>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120234

Files:
  llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMInstrInfo.td
  llvm/lib/Target/ARM/ARMInstrThumb2.td
  llvm/test/CodeGen/ARM/iabs.ll
  llvm/test/CodeGen/Thumb2/abs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120234.410234.patch
Type: text/x-patch
Size: 7065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220221/6503c440/attachment-0001.bin>


More information about the llvm-commits mailing list