[clang] [llvm] [mlir] [AMDGPU] Add the support for 45-bit buffer resource (PR #159702)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 07:38:48 PDT 2025


================
@@ -61,6 +61,25 @@ static Value createI32Constant(ConversionPatternRewriter &rewriter,
   return LLVM::ConstantOp::create(rewriter, loc, i32, value);
 }
 
+/// Convert an unsigned number `val` to i64.
+static Value convertUnsignedToI64(ConversionPatternRewriter &rewriter,
+                                  Location loc, Value val) {
+  IntegerType i64 = rewriter.getI64Type();
+  // Force check that `val` is of int type.
+  auto valTy = cast<IntegerType>(val.getType());
+  if (i64 == valTy)
+    return val;
+  return valTy.getWidth() > 64
+             ? Value(LLVM::TruncOp::create(rewriter, loc, i64, val))
+             : Value(LLVM::ZExtOp::create(rewriter, loc, i64, val));
+}
+
+static Value createI64Constant(ConversionPatternRewriter &rewriter,
+                               Location loc, int64_t value) {
+  Type i64 = rewriter.getI64Type();
+  return LLVM::ConstantOp::create(rewriter, loc, i64, value);
----------------
kuhar wrote:

nit: inline this variable

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


More information about the llvm-commits mailing list