[all-commits] [llvm/llvm-project] f0580c: [AArch64][GlobalISel] Select negative arithmetic i...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Wed Nov 11 09:20:32 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f0580c73bb325baf5fda10c169c2293f21987081
      https://github.com/llvm/llvm-project/commit/f0580c73bb325baf5fda10c169c2293f21987081
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2020-11-11 (Wed, 11 Nov 2020)

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

  Log Message:
  -----------
  [AArch64][GlobalISel] Select negative arithmetic immediates in manual selector

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.

Differential Revision: https://reviews.llvm.org/D91108




More information about the All-commits mailing list