[PATCH] D91108: [AArch64][GlobalISel] Select negative arithmetic immediates in manual selector

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 16:12:44 PST 2020


paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.
paquette requested review of this revision.

Previously, we only handled negative arithmetic immediates in the imported selector code.

Since we don't import code for, say, compares, we were missing opportunities for things like

  %cst:gpr(s64) = G_CONSTANT i64 -10
  %cmp:gpr(s32) = G_ICMP intpred(eq), %reg0(s64), %cst
  ->
  %adds = ADDSXri %reg0, 10, 0, implicit-def $nzcv
  %cmp = CSINCWr $wzr, $wzr, 1, implicit $nzcv

Instead, we would have to materialize the constant and emit a SUBS.

This adds support for selection like above for SUB, SUBS, ADD, and ADDS.

This is a 0.1% geomean code size improvement on SPECINT2000 at -Os.


https://reviews.llvm.org/D91108

Files:
  llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/opt-fold-compare.mir
  llvm/test/CodeGen/AArch64/GlobalISel/select-cmp.mir
  llvm/test/CodeGen/AArch64/GlobalISel/select-ptr-add.mir
  llvm/test/CodeGen/AArch64/GlobalISel/select-uaddo.mir
  llvm/test/CodeGen/AArch64/GlobalISel/tbz-sgt.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91108.304008.patch
Type: text/x-patch
Size: 12375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201110/c0edb1c5/attachment.bin>


More information about the llvm-commits mailing list