[PATCH] D105161: [GlobalISel] Handle more types in narrowScalar for eq/ne G_ICMP

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 17:14:28 PDT 2021


paquette created this revision.
paquette added reviewers: aemerson, arsenm, jroelofs.
Herald added subscribers: hiraditya, kristof.beyls, rovka.
paquette requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Generalize the existing eq/ne case using `extractParts`. The original code only handled narrowings for types of width 2n->n. This generalization allows for any type that can be broken down by `extractParts`.

General overview is:

- Loop over each narrow-sized part and do exactly what the 2-register case did.
- Loop over the leftover-sized parts and do the same thing
- Zext the leftover-sized XOR results to the desired narrow size
- OR that all together and then do the comparison against 0 (just like the old code)

This shows up a lot when building clang for AArch64 using GlobalISel, so it's worth fixing. For the sake of simplicity, this doesn't handle the non-eq/ne case yet.

Also remove the code in this case that notifies the observer; we're just going to delete `MI` anyway so talking to the observer shouldn't be necessary.


https://reviews.llvm.org/D105161

Files:
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105161.355405.patch
Type: text/x-patch
Size: 12704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210630/6f3b84df/attachment.bin>


More information about the llvm-commits mailing list