[ADT] Add APInt/MathExtras isShiftedMask variant returning mask offset/length
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Feb 2022 11:57:05 +0000 (11:57 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 8 Feb 2022 12:04:13 +0000 (12:04 +0000)
commitfd2bb51f1ec3f53e5dd1e69eb48bf191b49edda4
treee7d98c9374e34954036564ef7b0083c3d387d0c2
parent83f9b13d8cc2dd148c8ff7c1c71584e1eb634b75
[ADT] Add APInt/MathExtras isShiftedMask variant returning mask offset/length

In many cases, calls to isShiftedMask are immediately followed with checks to determine the size and position of the bitmask.

This patch adds variants of APInt::isShiftedMask, isShiftedMask_32 and isShiftedMask_64 that return these values as additional arguments.

I've updated a number of cases that were either performing seperate size/position calculations or had created their own local wrapper versions of these.

Differential Revision: https://reviews.llvm.org/D119019
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/Support/MathExtras.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/lib/Target/Mips/MipsISelLowering.cpp
llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp
llvm/unittests/ADT/APIntTest.cpp
llvm/unittests/Support/MathExtrasTest.cpp