OSDN Git Service

[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV
authorJessica Paquette <jpaquette@apple.com>
Fri, 13 Nov 2020 22:09:08 +0000 (14:09 -0800)
committerJessica Paquette <jpaquette@apple.com>
Mon, 16 Nov 2020 22:14:14 +0000 (14:14 -0800)
commit5bc0bd05e6a8d788e08cdf3d154f3a33202aee53
tree41c78795ad1d59c7941ae48d6c3376b53424162d
parentace9653c11c6308401dcda2e8b26bf97e6e66e30
[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV

When we see

```
xor = G_XOR xor_lhs, -1
select = G_SELECT cc, tval, xor
```

Fold this into

```
select = CSINV tval, xor_lhs, cc
```

Update select-select.mir to reflect the changes.

For now, only handle the case where the G_XOR is the false-value for the
G_SELECT. It may make more sense to handle the true-value case in post-legalizer
lowering.

Differential Revision: https://reviews.llvm.org/D90774
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-select.mir