[PATCH] D119019: [ADT] Add APInt/MathExtras isShiftedMask variant returning mask offset/length

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 4 10:06:24 PST 2022


RKSimon created this revision.
RKSimon added reviewers: spatel, lebedev.ri, nikic, dmgreen, foad.
Herald added subscribers: dexonsmith, ecnelises, kerbowa, pengfei, atanasyan, jrtc27, hiraditya, nhaehnle, jvesely, sdardis, arsenm.
RKSimon requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119019

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119019.406023.patch
Type: text/x-patch
Size: 13009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220204/b25c1252/attachment-0001.bin>


More information about the llvm-commits mailing list