[GlobalISel] Add matchers for specific constants and a matcher for negations
authorJessica Paquette <jpaquette@apple.com>
Fri, 13 Nov 2020 00:42:32 +0000 (16:42 -0800)
committerJessica Paquette <jpaquette@apple.com>
Fri, 13 Nov 2020 17:24:54 +0000 (09:24 -0800)
commitb184a2eccf3b80eb3ab741e983d4637111942815
tree617a20030781fe4e9b062b27efbf03e68b0e7a64
parent8dc2aa0e412171dad5cdc1aa60a92ddcd3800202
[GlobalISel] Add matchers for specific constants and a matcher for negations

It's fairly common to need matchers for a specific constant value, or for
common idioms like finding a negated register.

Add

- `m_SpecificICst`, which returns true when matching a specific value..
- `m_ZeroInt`, which returns true when an integer 0 is matched.
- `m_Neg`, which returns when a register is negated.

Also update a few places which use idioms related to the new matchers.

Differential Revision: https://reviews.llvm.org/D91397
llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/CodeGen/GlobalISel/Utils.cpp
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp