[all-commits] [llvm/llvm-project] 2af31b: [AArch64][GlobalISel] Select immediate forms of co...
Jessica Paquette via All-commits
all-commits at lists.llvm.org
Tue Apr 28 11:35:35 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 2af31b3b6552f80bb77776999fa336907adc20c5
https://github.com/llvm/llvm-project/commit/2af31b3b6552f80bb77776999fa336907adc20c5
Author: Jessica Paquette <jpaquette at apple.com>
Date: 2020-04-28 (Tue, 28 Apr 2020)
Changed paths:
M llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
M llvm/test/CodeGen/AArch64/GlobalISel/fold-select.mir
A llvm/test/CodeGen/AArch64/GlobalISel/select-arith-immed-compare.mir
M llvm/test/CodeGen/AArch64/GlobalISel/select-cbz.mir
M llvm/test/CodeGen/AArch64/GlobalISel/tbz-sgt.mir
Log Message:
-----------
[AArch64][GlobalISel] Select immediate forms of compares by wiggling constants
Similar to code in `getAArch64Cmp` in AArch64ISelLowering.
When we get a compare against a constant, sometimes, that constant isn't valid
for selecting an immediate form.
However, sometimes, you can get a valid constant by adding 1 or subtracting 1,
and updating the condition code.
This implements the following transformations when valid:
- x slt c => x sle c - 1
- x sge c => x sgt c - 1
- x ult c => x ule c - 1
- x uge c => x ugt c - 1
- x sle c => x slt c + 1
- x sgt c => s sge c + 1
- x ule c => x ult c + 1
- x ugt c => s uge c + 1
Valid meaning the constant doesn't wrap around when we fudge it, and the result
gives us a compare which can be selected into an immediate form.
This also moves `getImmedFromMO` higher up in the file so we can use it.
Differential Revision: https://reviews.llvm.org/D78769
More information about the All-commits
mailing list