[llvm] MCExpr-ify AMDGPU PALMetadata (PR #93236)

Janek van Oirschot via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 06:33:15 PDT 2024


================
@@ -1194,6 +1194,30 @@ static void EmitPALMetadataCommon(AMDGPUPALMetadata *MD,
                             getLdsDwGranularity(ST) * sizeof(uint32_t)));
 }
 
+static constexpr std::pair<unsigned, unsigned> getShiftMask(unsigned Value) {
+  unsigned Shift = 0;
+  unsigned Mask = 0;
+
+  Mask = ~Value;
+  for (; !(Mask & 1); Shift++, Mask >>= 1) {
+  }
----------------
JanekvO wrote:

Not quite, I should've specified that it is specifically for the `C_*` defines in `SIDefines.h`. I now moved this helper function , together with the MCExpr set and get in the same file, to a utils header. I also combined the already used equivalents in `AMDKernelCodeTUtils.cpp` to said utils header.

https://github.com/llvm/llvm-project/pull/93236


More information about the llvm-commits mailing list