summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/AMDGPU
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-06-15 09:56:45 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-06-15 09:56:45 +0000
commitdec562c84956d4816b168b1a7bfe7b2703eaaf86 (patch)
tree0085df3544d7f4509e28d785cc25f8c86c6ba271 /llvm/lib/Target/AMDGPU
parent9c17dad8f2528ebb9505ab2e549cc25d307d0f2b (diff)
downloadbcm5719-llvm-dec562c84956d4816b168b1a7bfe7b2703eaaf86.tar.gz
bcm5719-llvm-dec562c84956d4816b168b1a7bfe7b2703eaaf86.zip
[AMDGPU] Recognize x & ~(-1 << y) pattern.
Summary: The same pattern as D48010, but this one is IR-canonical as of D47428. Reviewers: nhaehnle, bogner, tstellar, arsenm Reviewed By: arsenm Subscribers: arsenm, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits Tags: #amdgpu Differential Revision: https://reviews.llvm.org/D48012 llvm-svn: 334817
Diffstat (limited to 'llvm/lib/Target/AMDGPU')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUInstructions.td6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructions.td b/llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
index 65d72fcb46f..d7acb6bf12d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
@@ -689,6 +689,12 @@ multiclass BFEPattern <Instruction UBFE, Instruction SBFE, Instruction MOV> {
(UBFE $src, (i32 0), $width)
>;
+ // x & ~(-1 << y)
+ def : AMDGPUPat <
+ (and i32:$src, (xor_oneuse (shl_oneuse -1, i32:$width), -1)),
+ (UBFE $src, (i32 0), $width)
+ >;
+
// x & (-1 >> (bitwidth - y))
def : AMDGPUPat <
(and i32:$src, (srl_oneuse -1, (sub 32, i32:$width))),
OpenPOWER on IntegriCloud