[AArch64][GlobalISel] Fold shifts into G_ICMP
authorJessica Paquette <jpaquette@apple.com>
Fri, 1 May 2020 23:57:12 +0000 (16:57 -0700)
committerJessica Paquette <jpaquette@apple.com>
Wed, 6 May 2020 01:35:39 +0000 (18:35 -0700)
commitb1b86d1c28150d3e54e5d33072b4afb6011b7ab0
treed449bc694b259d0db72db6e487de693884b798bf
parent17fc6518608fa4bffda12c5a86dd154bcfdbee88
[AArch64][GlobalISel] Fold shifts into G_ICMP

Since G_ICMP can be selected to a SUBS, we can fold shifts into such compares.

E.g.

```
cmp w1, w0, lsl #3
cmp w1, w0, lsr #3
cmp w1, w0, asr #3
```

This is done the same way as for adds and subtracts, using
`selectShiftedRegister`.

This gives some minor code size savings on CTMark.

https://reviews.llvm.org/D79365
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/opt-shifted-reg-compare.mir [new file with mode: 0644]