[all-commits] [llvm/llvm-project] 9a8bfe: [AArch64][GlobalISel] Select G_SELECT cc, t, (G_SU...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Fri Nov 13 10:16:59 PST 2020


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

  Changed paths:
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/select-select.mir

  Log Message:
  -----------
  [AArch64][GlobalISel] Select G_SELECT cc, t, (G_SUB 0, x) -> CSNEG t, x, cc

When we see

```
%sub = G_SUB 0, %x
%select = G_SELECT %cc, %t, %sub
```

Fold away the G_SUB by producing

```
%select = CSNEG %t, %x, cc
```

Simple IR example: https://godbolt.org/z/K8TEnh

This is valid on both sides of the select, but for now, just handle one side.
It may make more sense to handle swapping sides during post-legalizer lowering.

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




More information about the All-commits mailing list