Author: Aditya Tipre
Date: 2026-11-16T12:52:36-08:00
New Revision: 918b710676257a625e003c769eb06b8ba8c7b2b4

URL: 
https://github.com/llvm/llvm-project/commit/918b710676257a625e003c769eb06b8ba8c7b2b4
DIFF: 
https://github.com/llvm/llvm-project/commit/918b710676257a625e003c769eb06b8ba8c7b2b4.diff

LOG: [CIR][NVPTX] Support WMMA fragment loads (#234812)

Emit CIR for all 47 WMMA fragment-load builtins. Marshal scalar and
aggregate fragments through NVVM load intrinsics, preserving packed-half
representations and selecting row/column layout variants.

Add CIR and shared classic/CIR LLVM checks for all 88 supported
load/layout combinations, plus target-feature and invalid-argument
diagnostics.

Validation: 40 relevant lit tests pass. A clean assertion-enabled
compiler build and LLVM IR verification succeed. SM70/SM80 PTX
generation succeeds, with all 88 load instruction mnemonics matching
classic codegen. All 18 scalar cases directly store the intrinsic
result.

Related: https://github.com/llvm/llvm-project/issues/179278

Assisted-by: OpenAI Codex

Added: 
    clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-errors.cu
    clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-load-errors.cu
    clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-loads.cu
    clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma.cu

Modified: 
    clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
    clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp 
b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
index b19a9403fa5aa6..764f973fb28099 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
@@ -1178,6 +1178,13 @@ decodeFixedType(CIRGenFunction &cgf,
     unsigned numElements = descriptor.VectorWidth.getFixedValue();
     return cir::VectorType::getFixed(elementType, numElements);
   }
+  case IITDescriptor::Struct: {
+    SmallVector<mlir::Type, 8> members;
+    for (unsigned i = 0; i < descriptor.StructNumElements; ++i)
+      members.push_back(decodeFixedType(cgf, infos, overloadTys, context));
+    return cgf.getBuilder().getAnonRecordTy(
+        members, /*packed=*/false, cir::RecordType::getAllDataKinds(members));
+  }
   case IITDescriptor::Pointer: {
     mlir::Builder builder(context);
     auto addrSpace = cir::TargetAddressSpaceAttr::get(

diff  --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp 
b/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
index fc984df8e7d67b..9498e14b3bbb97 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinNVPTX.cpp
@@ -15,8 +15,12 @@
 #include "mlir/IR/Value.h"
 #include "clang/Basic/TargetBuiltins.h"
 #include "clang/CIR/Dialect/IR/CIRDialect.h"
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/IntrinsicsNVPTX.h"
 #include "llvm/Support/NVPTXAddrSpace.h"
 
+#include <algorithm>
+
 using namespace clang;
 using namespace clang::CIRGen;
 
@@ -148,6 +152,182 @@ static mlir::Value makeScopedAtomicXchg(CIRGenFunction 
&cgf,
   return xchg.getResult();
 }
 
+// Mirrors the WMMA load mappings in classic CodeGen.
+struct NVPTXMmaLdstInfo {
+  unsigned NumResults; // Number of elements to load/store
+  // Intrinsic IDs for row/col variants. 0 if particular layout is unsupported.
+  unsigned IID_col;
+  unsigned IID_row;
+};
+
+#define MMA_INTR(geom_op_type, layout)                                         
\
+  llvm::Intrinsic::nvvm_wmma_##geom_op_type##_##layout##_stride
+#define MMA_LDST(n, geom_op_type)                                              
\
+  {n, MMA_INTR(geom_op_type, col), MMA_INTR(geom_op_type, row)}
+
+static NVPTXMmaLdstInfo getNVPTXMmaLdstInfo(unsigned BuiltinID) {
+  switch (BuiltinID) {
+  // FP MMA loads
+  case NVPTX::BI__hmma_m16n16k16_ld_a:
+    return MMA_LDST(8, m16n16k16_load_a_f16);
+  case NVPTX::BI__hmma_m16n16k16_ld_b:
+    return MMA_LDST(8, m16n16k16_load_b_f16);
+  case NVPTX::BI__hmma_m16n16k16_ld_c_f16:
+    return MMA_LDST(4, m16n16k16_load_c_f16);
+  case NVPTX::BI__hmma_m16n16k16_ld_c_f32:
+    return MMA_LDST(8, m16n16k16_load_c_f32);
+  case NVPTX::BI__hmma_m32n8k16_ld_a:
+    return MMA_LDST(8, m32n8k16_load_a_f16);
+  case NVPTX::BI__hmma_m32n8k16_ld_b:
+    return MMA_LDST(8, m32n8k16_load_b_f16);
+  case NVPTX::BI__hmma_m32n8k16_ld_c_f16:
+    return MMA_LDST(4, m32n8k16_load_c_f16);
+  case NVPTX::BI__hmma_m32n8k16_ld_c_f32:
+    return MMA_LDST(8, m32n8k16_load_c_f32);
+  case NVPTX::BI__hmma_m8n32k16_ld_a:
+    return MMA_LDST(8, m8n32k16_load_a_f16);
+  case NVPTX::BI__hmma_m8n32k16_ld_b:
+    return MMA_LDST(8, m8n32k16_load_b_f16);
+  case NVPTX::BI__hmma_m8n32k16_ld_c_f16:
+    return MMA_LDST(4, m8n32k16_load_c_f16);
+  case NVPTX::BI__hmma_m8n32k16_ld_c_f32:
+    return MMA_LDST(8, m8n32k16_load_c_f32);
+
+  // Integer MMA loads
+  case NVPTX::BI__imma_m16n16k16_ld_a_s8:
+    return MMA_LDST(2, m16n16k16_load_a_s8);
+  case NVPTX::BI__imma_m16n16k16_ld_a_u8:
+    return MMA_LDST(2, m16n16k16_load_a_u8);
+  case NVPTX::BI__imma_m16n16k16_ld_b_s8:
+    return MMA_LDST(2, m16n16k16_load_b_s8);
+  case NVPTX::BI__imma_m16n16k16_ld_b_u8:
+    return MMA_LDST(2, m16n16k16_load_b_u8);
+  case NVPTX::BI__imma_m16n16k16_ld_c:
+    return MMA_LDST(8, m16n16k16_load_c_s32);
+  case NVPTX::BI__imma_m32n8k16_ld_a_s8:
+    return MMA_LDST(4, m32n8k16_load_a_s8);
+  case NVPTX::BI__imma_m32n8k16_ld_a_u8:
+    return MMA_LDST(4, m32n8k16_load_a_u8);
+  case NVPTX::BI__imma_m32n8k16_ld_b_s8:
+    return MMA_LDST(1, m32n8k16_load_b_s8);
+  case NVPTX::BI__imma_m32n8k16_ld_b_u8:
+    return MMA_LDST(1, m32n8k16_load_b_u8);
+  case NVPTX::BI__imma_m32n8k16_ld_c:
+    return MMA_LDST(8, m32n8k16_load_c_s32);
+  case NVPTX::BI__imma_m8n32k16_ld_a_s8:
+    return MMA_LDST(1, m8n32k16_load_a_s8);
+  case NVPTX::BI__imma_m8n32k16_ld_a_u8:
+    return MMA_LDST(1, m8n32k16_load_a_u8);
+  case NVPTX::BI__imma_m8n32k16_ld_b_s8:
+    return MMA_LDST(4, m8n32k16_load_b_s8);
+  case NVPTX::BI__imma_m8n32k16_ld_b_u8:
+    return MMA_LDST(4, m8n32k16_load_b_u8);
+  case NVPTX::BI__imma_m8n32k16_ld_c:
+    return MMA_LDST(8, m8n32k16_load_c_s32);
+
+  // Sub-integer MMA loads.
+  // Only row/col layout is supported by A/B fragments.
+  case NVPTX::BI__imma_m8n8k32_ld_a_s4:
+    return {1, 0, MMA_INTR(m8n8k32_load_a_s4, row)};
+  case NVPTX::BI__imma_m8n8k32_ld_a_u4:
+    return {1, 0, MMA_INTR(m8n8k32_load_a_u4, row)};
+  case NVPTX::BI__imma_m8n8k32_ld_b_s4:
+    return {1, MMA_INTR(m8n8k32_load_b_s4, col), 0};
+  case NVPTX::BI__imma_m8n8k32_ld_b_u4:
+    return {1, MMA_INTR(m8n8k32_load_b_u4, col), 0};
+  case NVPTX::BI__imma_m8n8k32_ld_c:
+    return MMA_LDST(2, m8n8k32_load_c_s32);
+  case NVPTX::BI__bmma_m8n8k128_ld_a_b1:
+    return {1, 0, MMA_INTR(m8n8k128_load_a_b1, row)};
+  case NVPTX::BI__bmma_m8n8k128_ld_b_b1:
+    return {1, MMA_INTR(m8n8k128_load_b_b1, col), 0};
+  case NVPTX::BI__bmma_m8n8k128_ld_c:
+    return MMA_LDST(2, m8n8k128_load_c_s32);
+
+  // Double MMA loads
+  case NVPTX::BI__dmma_m8n8k4_ld_a:
+    return MMA_LDST(1, m8n8k4_load_a_f64);
+  case NVPTX::BI__dmma_m8n8k4_ld_b:
+    return MMA_LDST(1, m8n8k4_load_b_f64);
+  case NVPTX::BI__dmma_m8n8k4_ld_c:
+    return MMA_LDST(2, m8n8k4_load_c_f64);
+
+  // Alternate float MMA loads
+  case NVPTX::BI__mma_bf16_m16n16k16_ld_a:
+    return MMA_LDST(4, m16n16k16_load_a_bf16);
+  case NVPTX::BI__mma_bf16_m16n16k16_ld_b:
+    return MMA_LDST(4, m16n16k16_load_b_bf16);
+  case NVPTX::BI__mma_bf16_m8n32k16_ld_a:
+    return MMA_LDST(2, m8n32k16_load_a_bf16);
+  case NVPTX::BI__mma_bf16_m8n32k16_ld_b:
+    return MMA_LDST(8, m8n32k16_load_b_bf16);
+  case NVPTX::BI__mma_bf16_m32n8k16_ld_a:
+    return MMA_LDST(8, m32n8k16_load_a_bf16);
+  case NVPTX::BI__mma_bf16_m32n8k16_ld_b:
+    return MMA_LDST(2, m32n8k16_load_b_bf16);
+  case NVPTX::BI__mma_tf32_m16n16k8_ld_a:
+    return MMA_LDST(4, m16n16k8_load_a_tf32);
+  case NVPTX::BI__mma_tf32_m16n16k8_ld_b:
+    return MMA_LDST(4, m16n16k8_load_b_tf32);
+  case NVPTX::BI__mma_tf32_m16n16k8_ld_c:
+    return MMA_LDST(8, m16n16k8_load_c_f32);
+
+  default:
+    llvm_unreachable("Unknown WMMA load builtin");
+  }
+}
+#undef MMA_LDST
+#undef MMA_INTR
+
+static void storeWMMAFragment(CIRGenBuilderTy &builder, mlir::Location loc,
+                              mlir::Value result, Address dst,
+                              unsigned numRegisters) {
+  CharUnits alignment =
+      std::min(dst.getAlignment(), CharUnits::fromQuantity(4));
+  if (numRegisters == 1) {
+    builder.createStore(loc, result, dst.withAlignment(alignment));
+    return;
+  }
+
+  // FP16 intrinsic registers are <2 x half>, stored in i32 fragment slots.
+  for (unsigned i = 0; i < numRegisters; ++i) {
+    mlir::Value value = cir::ExtractMemberOp::create(builder, loc, result, i);
+    value = builder.createBitcast(loc, value, dst.getElementType());
+    mlir::Value ptr = builder.createPtrStride(loc, dst.emitRawPointer(),
+                                              builder.getSInt32(i, loc));
+    builder.createStore(loc, value, Address(ptr, alignment));
+  }
+}
+
+static std::optional<mlir::Value>
+emitWMMALoad(CIRGenFunction &cgf, const CallExpr *expr, unsigned builtinId) {
+  auto &builder = cgf.getBuilder();
+  mlir::Location loc = cgf.getLoc(expr->getExprLoc());
+  Address dst = cgf.emitPointerWithAlignment(expr->getArg(0));
+  mlir::Value src = cgf.emitScalarExpr(expr->getArg(1));
+  mlir::Value ldm = cgf.emitScalarExpr(expr->getArg(2));
+  std::optional<llvm::APSInt> isColMajorArg =
+      expr->getArg(3)->getIntegerConstantExpr(cgf.getContext());
+  if (!isColMajorArg)
+    return std::nullopt;
+  bool isColMajor = isColMajorArg->getSExtValue();
+
+  NVPTXMmaLdstInfo info = getNVPTXMmaLdstInfo(builtinId);
+  unsigned intrinsicId = isColMajor ? info.IID_col : info.IID_row;
+  if (!intrinsicId)
+    return std::nullopt;
+
+  cir::FuncType intrinsicType =
+      cgf.getIntrinsicType(intrinsicId, {src.getType()});
+  llvm::StringRef name = llvm::Intrinsic::getBaseName(intrinsicId);
+  assert(name.starts_with("llvm.") && "Not an LLVM intrinsic!");
+  name = name.drop_front(5);
+  mlir::Value result = builder.emitIntrinsicCallOp(
+      loc, name, intrinsicType.getReturnType(), mlir::ValueRange{src, ldm});
+  storeWMMAFragment(builder, loc, result, dst, info.NumResults);
+  return mlir::Value{};
+}
+
 std::optional<mlir::Value>
 CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, const CallExpr *expr) 
{
   switch (builtinId) {
@@ -430,7 +610,7 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, 
const CallExpr *expr) {
                  std::string("unimplemented NVPTX builtin call: ") +
                      getContext().BuiltinInfo.getName(builtinId));
     return mlir::Value{};
-  // FP MMA loads
+  // WMMA fragment loads.
   case NVPTX::BI__hmma_m16n16k16_ld_a:
   case NVPTX::BI__hmma_m16n16k16_ld_b:
   case NVPTX::BI__hmma_m16n16k16_ld_c_f16:
@@ -443,10 +623,6 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, 
const CallExpr *expr) {
   case NVPTX::BI__hmma_m8n32k16_ld_b:
   case NVPTX::BI__hmma_m8n32k16_ld_c_f16:
   case NVPTX::BI__hmma_m8n32k16_ld_c_f32:
-    cgm.errorNYI(expr->getSourceRange(),
-                 std::string("unimplemented NVPTX builtin call: ") +
-                     getContext().BuiltinInfo.getName(builtinId));
-    return mlir::Value{};
   case NVPTX::BI__imma_m16n16k16_ld_a_s8:
   case NVPTX::BI__imma_m16n16k16_ld_a_u8:
   case NVPTX::BI__imma_m16n16k16_ld_b_s8:
@@ -462,10 +638,6 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, 
const CallExpr *expr) {
   case NVPTX::BI__imma_m8n32k16_ld_b_s8:
   case NVPTX::BI__imma_m8n32k16_ld_b_u8:
   case NVPTX::BI__imma_m8n32k16_ld_c:
-    cgm.errorNYI(expr->getSourceRange(),
-                 std::string("unimplemented NVPTX builtin call: ") +
-                     getContext().BuiltinInfo.getName(builtinId));
-    return mlir::Value{};
   case NVPTX::BI__imma_m8n8k32_ld_a_s4:
   case NVPTX::BI__imma_m8n8k32_ld_a_u4:
   case NVPTX::BI__imma_m8n8k32_ld_b_s4:
@@ -474,17 +646,9 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, 
const CallExpr *expr) {
   case NVPTX::BI__bmma_m8n8k128_ld_a_b1:
   case NVPTX::BI__bmma_m8n8k128_ld_b_b1:
   case NVPTX::BI__bmma_m8n8k128_ld_c:
-    cgm.errorNYI(expr->getSourceRange(),
-                 std::string("unimplemented NVPTX builtin call: ") +
-                     getContext().BuiltinInfo.getName(builtinId));
-    return mlir::Value{};
   case NVPTX::BI__dmma_m8n8k4_ld_a:
   case NVPTX::BI__dmma_m8n8k4_ld_b:
   case NVPTX::BI__dmma_m8n8k4_ld_c:
-    cgm.errorNYI(expr->getSourceRange(),
-                 std::string("unimplemented NVPTX builtin call: ") +
-                     getContext().BuiltinInfo.getName(builtinId));
-    return mlir::Value{};
   case NVPTX::BI__mma_bf16_m16n16k16_ld_a:
   case NVPTX::BI__mma_bf16_m16n16k16_ld_b:
   case NVPTX::BI__mma_bf16_m8n32k16_ld_a:
@@ -494,10 +658,7 @@ CIRGenFunction::emitNVPTXBuiltinExpr(unsigned builtinId, 
const CallExpr *expr) {
   case NVPTX::BI__mma_tf32_m16n16k8_ld_a:
   case NVPTX::BI__mma_tf32_m16n16k8_ld_b:
   case NVPTX::BI__mma_tf32_m16n16k8_ld_c:
-    cgm.errorNYI(expr->getSourceRange(),
-                 std::string("unimplemented NVPTX builtin call: ") +
-                     getContext().BuiltinInfo.getName(builtinId));
-    return mlir::Value{};
+    return emitWMMALoad(*this, expr, builtinId);
   case NVPTX::BI__hmma_m16n16k16_st_c_f16:
   case NVPTX::BI__hmma_m16n16k16_st_c_f32:
   case NVPTX::BI__hmma_m32n8k16_st_c_f16:

diff  --git a/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-errors.cu 
b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-errors.cu
new file mode 100644
index 00000000000000..5900c144b0fe58
--- /dev/null
+++ b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-errors.cu
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_60 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DFEATURES -verify=feature %s -o /dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_70 \
+// RUN:   -target-feature +ptx42 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DFEATURES -verify=feature %s -o /dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_70 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DCONSTANTS -verify=constant %s -o /dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_70 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device \
+// RUN:   -fsyntax-only -DCONSTANTS -verify=constant %s
+
+#define DEVICE extern "C" __attribute__((device))
+
+#ifdef FEATURES
+DEVICE void features(int *i, float *f, unsigned stride) {
+  // feature-error-re@+1 {{'__hmma_m16n16k16_ld_a' needs target feature 
{{.*}}sm_70{{.*}}ptx60}}
+  __hmma_m16n16k16_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m16n16k16_ld_b' needs target feature 
{{.*}}sm_70{{.*}}ptx60}}
+  __hmma_m16n16k16_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m16n16k16_ld_c_f16' needs target feature 
{{.*}}sm_70{{.*}}ptx60}}
+  __hmma_m16n16k16_ld_c_f16(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m16n16k16_ld_c_f32' needs target feature 
{{.*}}sm_70{{.*}}ptx60}}
+  __hmma_m16n16k16_ld_c_f32(f, f, stride, 0);
+}
+#endif
+
+#ifdef CONSTANTS
+DEVICE void constant_arguments(int *p, int layout) {
+  // constant-error@+1 {{argument to '__hmma_m16n16k16_ld_a' must be a 
constant integer}}
+  __hmma_m16n16k16_ld_a(p, p, 16, layout);
+}
+#endif

diff  --git a/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-load-errors.cu 
b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-load-errors.cu
new file mode 100644
index 00000000000000..2126cc571b2a68
--- /dev/null
+++ b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-load-errors.cu
@@ -0,0 +1,141 @@
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_60 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DFEATURES -ferror-limit 0 -verify=feature %s -o /dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DFEATURES -ferror-limit 0 -verify=feature %s -o /dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DRESTRICTED_LAYOUTS -DBAD_LAYOUT=0 -verify=layout %s -o 
/dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DRESTRICTED_LAYOUTS -DBAD_LAYOUT=1 -verify=layout %s -o 
/dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DRESTRICTED_LAYOUTS -DBAD_LAYOUT=2 -verify=layout %s -o 
/dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DRESTRICTED_LAYOUTS -DBAD_LAYOUT=3 -verify=layout %s -o 
/dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DRESTRICTED_LAYOUTS -DBAD_LAYOUT=4 -verify=layout %s -o 
/dev/null
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir -DRESTRICTED_LAYOUTS -DBAD_LAYOUT=5 -verify=layout %s -o 
/dev/null
+
+#define DEVICE extern "C" __attribute__((device))
+
+#ifdef FEATURES
+DEVICE void target_features(int *i, float *f, double *d, unsigned stride) {
+  // feature-error-re@+1 {{'__hmma_m32n8k16_ld_a' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m32n8k16_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m32n8k16_ld_b' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m32n8k16_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m32n8k16_ld_c_f16' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m32n8k16_ld_c_f16(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m32n8k16_ld_c_f32' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m32n8k16_ld_c_f32(f, f, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m8n32k16_ld_a' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m8n32k16_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m8n32k16_ld_b' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m8n32k16_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m8n32k16_ld_c_f16' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m8n32k16_ld_c_f16(i, i, stride, 0);
+  // feature-error-re@+1 {{'__hmma_m8n32k16_ld_c_f32' needs target feature 
{{.*}}sm_70{{.*}}ptx61}}
+  __hmma_m8n32k16_ld_c_f32(f, f, stride, 0);
+  // feature-error-re@+1 {{'__imma_m16n16k16_ld_a_s8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m16n16k16_ld_a_s8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m16n16k16_ld_b_s8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m16n16k16_ld_b_s8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m16n16k16_ld_a_u8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m16n16k16_ld_a_u8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m16n16k16_ld_b_u8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m16n16k16_ld_b_u8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m16n16k16_ld_c' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m16n16k16_ld_c(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m32n8k16_ld_a_s8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m32n8k16_ld_a_s8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m32n8k16_ld_b_s8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m32n8k16_ld_b_s8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m32n8k16_ld_a_u8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m32n8k16_ld_a_u8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m32n8k16_ld_b_u8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m32n8k16_ld_b_u8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m32n8k16_ld_c' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m32n8k16_ld_c(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n32k16_ld_a_s8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m8n32k16_ld_a_s8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n32k16_ld_b_s8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m8n32k16_ld_b_s8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n32k16_ld_a_u8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m8n32k16_ld_a_u8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n32k16_ld_b_u8' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m8n32k16_ld_b_u8(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n32k16_ld_c' needs target feature 
{{.*}}sm_72{{.*}}ptx63}}
+  __imma_m8n32k16_ld_c(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n8k32_ld_a_s4' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __imma_m8n8k32_ld_a_s4(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n8k32_ld_b_s4' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __imma_m8n8k32_ld_b_s4(i, i, stride, 1);
+  // feature-error-re@+1 {{'__imma_m8n8k32_ld_a_u4' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __imma_m8n8k32_ld_a_u4(i, i, stride, 0);
+  // feature-error-re@+1 {{'__imma_m8n8k32_ld_b_u4' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __imma_m8n8k32_ld_b_u4(i, i, stride, 1);
+  // feature-error-re@+1 {{'__imma_m8n8k32_ld_c' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __imma_m8n8k32_ld_c(i, i, stride, 0);
+  // feature-error-re@+1 {{'__bmma_m8n8k128_ld_a_b1' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __bmma_m8n8k128_ld_a_b1(i, i, stride, 0);
+  // feature-error-re@+1 {{'__bmma_m8n8k128_ld_b_b1' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __bmma_m8n8k128_ld_b_b1(i, i, stride, 1);
+  // feature-error-re@+1 {{'__bmma_m8n8k128_ld_c' needs target feature 
{{.*}}sm_75{{.*}}ptx63}}
+  __bmma_m8n8k128_ld_c(i, i, stride, 0);
+  // feature-error-re@+1 {{'__dmma_m8n8k4_ld_a' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __dmma_m8n8k4_ld_a(d, d, stride, 0);
+  // feature-error-re@+1 {{'__dmma_m8n8k4_ld_b' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __dmma_m8n8k4_ld_b(d, d, stride, 0);
+  // feature-error-re@+1 {{'__dmma_m8n8k4_ld_c' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __dmma_m8n8k4_ld_c(d, d, stride, 0);
+  // feature-error-re@+1 {{'__mma_bf16_m16n16k16_ld_a' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_bf16_m16n16k16_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_bf16_m16n16k16_ld_b' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_bf16_m16n16k16_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_bf16_m32n8k16_ld_a' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_bf16_m32n8k16_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_bf16_m32n8k16_ld_b' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_bf16_m32n8k16_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_bf16_m8n32k16_ld_a' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_bf16_m8n32k16_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_bf16_m8n32k16_ld_b' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_bf16_m8n32k16_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_tf32_m16n16k8_ld_a' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_tf32_m16n16k8_ld_a(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_tf32_m16n16k8_ld_b' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_tf32_m16n16k8_ld_b(i, i, stride, 0);
+  // feature-error-re@+1 {{'__mma_tf32_m16n16k8_ld_c' needs target feature 
{{.*}}sm_80{{.*}}ptx70}}
+  __mma_tf32_m16n16k8_ld_c(f, f, stride, 0);
+}
+#endif
+
+#ifdef RESTRICTED_LAYOUTS
+DEVICE void restricted_layout(int *dst, const int *src, unsigned stride) {
+#if BAD_LAYOUT == 0
+  // layout-error@+1 {{unimplemented builtin call: __imma_m8n8k32_ld_a_s4}}
+  __imma_m8n8k32_ld_a_s4(dst, src, stride, 1);
+#elif BAD_LAYOUT == 1
+  // layout-error@+1 {{unimplemented builtin call: __imma_m8n8k32_ld_b_s4}}
+  __imma_m8n8k32_ld_b_s4(dst, src, stride, 0);
+#elif BAD_LAYOUT == 2
+  // layout-error@+1 {{unimplemented builtin call: __imma_m8n8k32_ld_a_u4}}
+  __imma_m8n8k32_ld_a_u4(dst, src, stride, 1);
+#elif BAD_LAYOUT == 3
+  // layout-error@+1 {{unimplemented builtin call: __imma_m8n8k32_ld_b_u4}}
+  __imma_m8n8k32_ld_b_u4(dst, src, stride, 0);
+#elif BAD_LAYOUT == 4
+  // layout-error@+1 {{unimplemented builtin call: __bmma_m8n8k128_ld_a_b1}}
+  __bmma_m8n8k128_ld_a_b1(dst, src, stride, 1);
+#elif BAD_LAYOUT == 5
+  // layout-error@+1 {{unimplemented builtin call: __bmma_m8n8k128_ld_b_b1}}
+  __bmma_m8n8k128_ld_b_b1(dst, src, stride, 0);
+#endif
+}
+#endif

diff  --git a/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-loads.cu 
b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-loads.cu
new file mode 100644
index 00000000000000..6573319462d8f2
--- /dev/null
+++ b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma-loads.cu
@@ -0,0 +1,758 @@
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir %s -o - | FileCheck %s --check-prefix=CIR 
--enable-var-scope
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=LLVM 
--enable-var-scope
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_80 \
+// RUN:   -target-feature +ptx70 -x cuda -fcuda-is-device \
+// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=LLVM 
--enable-var-scope
+
+// Exercise all remaining WMMA load builtins through the common load handler.
+// The m16n16k16 FP16/FP32 cases are covered in builtins-nvptx-wmma.cu.
+// LLVM checks are shared with classic codegen and cover scalar returns,
+// aggregate register counts/types, and representative fragment stores.
+
+#define DEVICE extern "C" __attribute__((device))
+
+// CIR-LABEL: @test_hmma_m32n8k16_ld_a(
+// LLVM-LABEL: @test_hmma_m32n8k16_ld_a(
+DEVICE void test_hmma_m32n8k16_ld_a(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.row.stride.f16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m32n8k16.load.a.row.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[R0]], 7
+  // LLVM: %[[BITS:.*]] = bitcast <2 x half> %[[LAST]] to i32
+  // LLVM: store i32 %[[BITS]], ptr %{{.*}}, align 4
+  __hmma_m32n8k16_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.col.stride.f16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m32n8k16.load.a.col.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __hmma_m32n8k16_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m32n8k16_ld_b(
+// LLVM-LABEL: @test_hmma_m32n8k16_ld_b(
+DEVICE void test_hmma_m32n8k16_ld_b(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.row.stride.f16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m32n8k16.load.b.row.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[R0]], 7
+  // LLVM: %[[BITS:.*]] = bitcast <2 x half> %[[LAST]] to i32
+  // LLVM: store i32 %[[BITS]], ptr %{{.*}}, align 4
+  __hmma_m32n8k16_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.col.stride.f16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m32n8k16.load.b.col.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __hmma_m32n8k16_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m32n8k16_ld_c_f16(
+// LLVM-LABEL: @test_hmma_m32n8k16_ld_c_f16(
+DEVICE void test_hmma_m32n8k16_ld_c_f16(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.c.row.stride.f16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half> } @llvm.nvvm.wmma.m32n8k16.load.c.row.stride.f16.p0(ptr %{{.*}}, i32 
%{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half> } %[[R0]], 3
+  // LLVM: %[[BITS:.*]] = bitcast <2 x half> %[[LAST]] to i32
+  // LLVM: store i32 %[[BITS]], ptr %{{.*}}, align 4
+  __hmma_m32n8k16_ld_c_f16(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.c.col.stride.f16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half> } @llvm.nvvm.wmma.m32n8k16.load.c.col.stride.f16.p0(ptr %{{.*}}, i32 
%{{.*}})
+  __hmma_m32n8k16_ld_c_f16(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m32n8k16_ld_c_f32(
+// LLVM-LABEL: @test_hmma_m32n8k16_ld_c_f32(
+DEVICE void test_hmma_m32n8k16_ld_c_f32(float *dst, const float *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.c.row.stride.f32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { float, float, float, float, float, float, 
float, float } @llvm.nvvm.wmma.m32n8k16.load.c.row.stride.f32.p0(ptr %{{.*}}, 
i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[R0]], 7
+  // LLVM: store float %[[LAST]], ptr %{{.*}}, align 4
+  __hmma_m32n8k16_ld_c_f32(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.c.col.stride.f32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { float, float, float, float, float, float, 
float, float } @llvm.nvvm.wmma.m32n8k16.load.c.col.stride.f32.p0(ptr %{{.*}}, 
i32 %{{.*}})
+  __hmma_m32n8k16_ld_c_f32(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m8n32k16_ld_a(
+// LLVM-LABEL: @test_hmma_m8n32k16_ld_a(
+DEVICE void test_hmma_m8n32k16_ld_a(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.row.stride.f16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m8n32k16.load.a.row.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[R0]], 7
+  // LLVM: %[[BITS:.*]] = bitcast <2 x half> %[[LAST]] to i32
+  // LLVM: store i32 %[[BITS]], ptr %{{.*}}, align 4
+  __hmma_m8n32k16_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.col.stride.f16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m8n32k16.load.a.col.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __hmma_m8n32k16_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m8n32k16_ld_b(
+// LLVM-LABEL: @test_hmma_m8n32k16_ld_b(
+DEVICE void test_hmma_m8n32k16_ld_b(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.row.stride.f16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m8n32k16.load.b.row.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[R0]], 7
+  // LLVM: %[[BITS:.*]] = bitcast <2 x half> %[[LAST]] to i32
+  // LLVM: store i32 %[[BITS]], ptr %{{.*}}, align 4
+  __hmma_m8n32k16_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.col.stride.f16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m8n32k16.load.b.col.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __hmma_m8n32k16_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m8n32k16_ld_c_f16(
+// LLVM-LABEL: @test_hmma_m8n32k16_ld_c_f16(
+DEVICE void test_hmma_m8n32k16_ld_c_f16(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.c.row.stride.f16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half> } @llvm.nvvm.wmma.m8n32k16.load.c.row.stride.f16.p0(ptr %{{.*}}, i32 
%{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half> } %[[R0]], 3
+  // LLVM: %[[BITS:.*]] = bitcast <2 x half> %[[LAST]] to i32
+  // LLVM: store i32 %[[BITS]], ptr %{{.*}}, align 4
+  __hmma_m8n32k16_ld_c_f16(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.c.col.stride.f16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 x 
half> } @llvm.nvvm.wmma.m8n32k16.load.c.col.stride.f16.p0(ptr %{{.*}}, i32 
%{{.*}})
+  __hmma_m8n32k16_ld_c_f16(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_hmma_m8n32k16_ld_c_f32(
+// LLVM-LABEL: @test_hmma_m8n32k16_ld_c_f32(
+DEVICE void test_hmma_m8n32k16_ld_c_f32(float *dst, const float *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.c.row.stride.f32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { float, float, float, float, float, float, 
float, float } @llvm.nvvm.wmma.m8n32k16.load.c.row.stride.f32.p0(ptr %{{.*}}, 
i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[R0]], 7
+  // LLVM: store float %[[LAST]], ptr %{{.*}}, align 4
+  __hmma_m8n32k16_ld_c_f32(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.c.col.stride.f32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { float, float, float, float, float, float, 
float, float } @llvm.nvvm.wmma.m8n32k16.load.c.col.stride.f32.p0(ptr %{{.*}}, 
i32 %{{.*}})
+  __hmma_m8n32k16_ld_c_f32(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m16n16k16_ld_a_s8(
+// LLVM-LABEL: @test_imma_m16n16k16_ld_a_s8(
+DEVICE void test_imma_m16n16k16_ld_a_s8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.row.stride.s8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.a.row.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][0]
+  // LLVM: %[[E0_0:.*]] = extractvalue { i32, i32 } %[[R0]], 0
+  // LLVM: store i32 %[[E0_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[E0_1:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[E0_1]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_a_s8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.col.stride.s8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.a.col.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R1]][0]
+  // LLVM: %[[E1_0:.*]] = extractvalue { i32, i32 } %[[R1]], 0
+  // LLVM: store i32 %[[E1_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R1]][1]
+  // LLVM: %[[E1_1:.*]] = extractvalue { i32, i32 } %[[R1]], 1
+  // LLVM: store i32 %[[E1_1]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_a_s8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m16n16k16_ld_b_s8(
+// LLVM-LABEL: @test_imma_m16n16k16_ld_b_s8(
+DEVICE void test_imma_m16n16k16_ld_b_s8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.row.stride.s8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.b.row.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_b_s8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.col.stride.s8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.b.col.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m16n16k16_ld_b_s8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m16n16k16_ld_a_u8(
+// LLVM-LABEL: @test_imma_m16n16k16_ld_a_u8(
+DEVICE void test_imma_m16n16k16_ld_a_u8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.row.stride.u8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.a.row.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_a_u8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.col.stride.u8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.a.col.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m16n16k16_ld_a_u8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m16n16k16_ld_b_u8(
+// LLVM-LABEL: @test_imma_m16n16k16_ld_b_u8(
+DEVICE void test_imma_m16n16k16_ld_b_u8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.row.stride.u8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.b.row.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_b_u8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.col.stride.u8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.b.col.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m16n16k16_ld_b_u8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m16n16k16_ld_c(
+// LLVM-LABEL: @test_imma_m16n16k16_ld_c(
+DEVICE void test_imma_m16n16k16_ld_c(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.c.row.stride.s32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.c.row.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][0]
+  // LLVM: %[[E0_0:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R0]], 0
+  // LLVM: store i32 %[[E0_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[E0_7:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R0]], 7
+  // LLVM: store i32 %[[E0_7]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.c.col.stride.s32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.c.col.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R1]][0]
+  // LLVM: %[[E1_0:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R1]], 0
+  // LLVM: store i32 %[[E1_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R1]][7]
+  // LLVM: %[[E1_7:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R1]], 7
+  // LLVM: store i32 %[[E1_7]], ptr %{{.*}}, align 4
+  __imma_m16n16k16_ld_c(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m32n8k16_ld_a_s8(
+// LLVM-LABEL: @test_imma_m32n8k16_ld_a_s8(
+DEVICE void test_imma_m32n8k16_ld_a_s8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.row.stride.s8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.a.row.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][0]
+  // LLVM: %[[E0_0:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 0
+  // LLVM: store i32 %[[E0_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[E0_3:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[E0_3]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_a_s8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.col.stride.s8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.a.col.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R1]][0]
+  // LLVM: %[[E1_0:.*]] = extractvalue { i32, i32, i32, i32 } %[[R1]], 0
+  // LLVM: store i32 %[[E1_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R1]][3]
+  // LLVM: %[[E1_3:.*]] = extractvalue { i32, i32, i32, i32 } %[[R1]], 3
+  // LLVM: store i32 %[[E1_3]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_a_s8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m32n8k16_ld_b_s8(
+// LLVM-LABEL: @test_imma_m32n8k16_ld_b_s8(
+DEVICE void test_imma_m32n8k16_ld_b_s8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.row.stride.s8"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m32n8k16.load.b.row.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_b_s8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.col.stride.s8"
+  // LLVM: %[[R1:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m32n8k16.load.b.col.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R1]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R1]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_b_s8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m32n8k16_ld_a_u8(
+// LLVM-LABEL: @test_imma_m32n8k16_ld_a_u8(
+DEVICE void test_imma_m32n8k16_ld_a_u8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.row.stride.u8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.a.row.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_a_u8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.col.stride.u8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.a.col.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m32n8k16_ld_a_u8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m32n8k16_ld_b_u8(
+// LLVM-LABEL: @test_imma_m32n8k16_ld_b_u8(
+DEVICE void test_imma_m32n8k16_ld_b_u8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.row.stride.u8"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m32n8k16.load.b.row.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_b_u8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.col.stride.u8"
+  // LLVM: %[[R1:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m32n8k16.load.b.col.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R1]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R1]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_b_u8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m32n8k16_ld_c(
+// LLVM-LABEL: @test_imma_m32n8k16_ld_c(
+DEVICE void test_imma_m32n8k16_ld_c(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.c.row.stride.s32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.c.row.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R0]], 7
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m32n8k16_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.c.col.stride.s32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.c.col.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m32n8k16_ld_c(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n32k16_ld_a_s8(
+// LLVM-LABEL: @test_imma_m8n32k16_ld_a_s8(
+DEVICE void test_imma_m8n32k16_ld_a_s8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.row.stride.s8"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n32k16.load.a.row.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_a_s8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.col.stride.s8"
+  // LLVM: %[[R1:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n32k16.load.a.col.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R1]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R1]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_a_s8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n32k16_ld_b_s8(
+// LLVM-LABEL: @test_imma_m8n32k16_ld_b_s8(
+DEVICE void test_imma_m8n32k16_ld_b_s8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.row.stride.s8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.b.row.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_b_s8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.col.stride.s8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.b.col.stride.s8.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m8n32k16_ld_b_s8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n32k16_ld_a_u8(
+// LLVM-LABEL: @test_imma_m8n32k16_ld_a_u8(
+DEVICE void test_imma_m8n32k16_ld_a_u8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.row.stride.u8"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n32k16.load.a.row.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_a_u8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.col.stride.u8"
+  // LLVM: %[[R1:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n32k16.load.a.col.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R1]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R1]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_a_u8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n32k16_ld_b_u8(
+// LLVM-LABEL: @test_imma_m8n32k16_ld_b_u8(
+DEVICE void test_imma_m8n32k16_ld_b_u8(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.row.stride.u8"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.b.row.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_b_u8(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.col.stride.u8"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.b.col.stride.u8.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m8n32k16_ld_b_u8(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n32k16_ld_c(
+// LLVM-LABEL: @test_imma_m8n32k16_ld_c(
+DEVICE void test_imma_m8n32k16_ld_c(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.c.row.stride.s32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.c.row.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R0]], 7
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m8n32k16_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.c.col.stride.s32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.c.col.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m8n32k16_ld_c(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n8k32_ld_a_s4(
+// LLVM-LABEL: @test_imma_m8n8k32_ld_a_s4(
+DEVICE void test_imma_m8n8k32_ld_a_s4(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k32.load.a.row.stride.s4"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n8k32.load.a.row.stride.s4.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m8n8k32_ld_a_s4(dst, src, stride, 0);
+
+}
+
+// CIR-LABEL: @test_imma_m8n8k32_ld_b_s4(
+// LLVM-LABEL: @test_imma_m8n8k32_ld_b_s4(
+DEVICE void test_imma_m8n8k32_ld_b_s4(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k32.load.b.col.stride.s4"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n8k32.load.b.col.stride.s4.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m8n8k32_ld_b_s4(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n8k32_ld_a_u4(
+// LLVM-LABEL: @test_imma_m8n8k32_ld_a_u4(
+DEVICE void test_imma_m8n8k32_ld_a_u4(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k32.load.a.row.stride.u4"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n8k32.load.a.row.stride.u4.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m8n8k32_ld_a_u4(dst, src, stride, 0);
+
+}
+
+// CIR-LABEL: @test_imma_m8n8k32_ld_b_u4(
+// LLVM-LABEL: @test_imma_m8n8k32_ld_b_u4(
+DEVICE void test_imma_m8n8k32_ld_b_u4(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k32.load.b.col.stride.u4"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n8k32.load.b.col.stride.u4.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __imma_m8n8k32_ld_b_u4(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_imma_m8n8k32_ld_c(
+// LLVM-LABEL: @test_imma_m8n8k32_ld_c(
+DEVICE void test_imma_m8n8k32_ld_c(int *dst, const int *src, unsigned stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k32.load.c.row.stride.s32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m8n8k32.load.c.row.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __imma_m8n8k32_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k32.load.c.col.stride.s32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m8n8k32.load.c.col.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  __imma_m8n8k32_ld_c(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_bmma_m8n8k128_ld_a_b1(
+// LLVM-LABEL: @test_bmma_m8n8k128_ld_a_b1(
+DEVICE void test_bmma_m8n8k128_ld_a_b1(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k128.load.a.row.stride.b1"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n8k128.load.a.row.stride.b1.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __bmma_m8n8k128_ld_a_b1(dst, src, stride, 0);
+
+}
+
+// CIR-LABEL: @test_bmma_m8n8k128_ld_b_b1(
+// LLVM-LABEL: @test_bmma_m8n8k128_ld_b_b1(
+DEVICE void test_bmma_m8n8k128_ld_b_b1(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k128.load.b.col.stride.b1"
+  // LLVM: %[[R0:.*]] = call{{.*}} i32 
@llvm.nvvm.wmma.m8n8k128.load.b.col.stride.b1.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store i32 %[[R0]], ptr %{{.*}}, align 4
+  __bmma_m8n8k128_ld_b_b1(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_bmma_m8n8k128_ld_c(
+// LLVM-LABEL: @test_bmma_m8n8k128_ld_c(
+DEVICE void test_bmma_m8n8k128_ld_c(int *dst, const int *src, unsigned stride) 
{
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k128.load.c.row.stride.s32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m8n8k128.load.c.row.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __bmma_m8n8k128_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k128.load.c.col.stride.s32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m8n8k128.load.c.col.stride.s32.p0(ptr %{{.*}}, i32 %{{.*}})
+  __bmma_m8n8k128_ld_c(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_dmma_m8n8k4_ld_a(
+// LLVM-LABEL: @test_dmma_m8n8k4_ld_a(
+DEVICE void test_dmma_m8n8k4_ld_a(double *dst, const double *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k4.load.a.row.stride.f64"
+  // LLVM: %[[R0:.*]] = call{{.*}} double 
@llvm.nvvm.wmma.m8n8k4.load.a.row.stride.f64.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store double %[[R0]], ptr %{{.*}}, align 4
+  __dmma_m8n8k4_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k4.load.a.col.stride.f64"
+  // LLVM: %[[R1:.*]] = call{{.*}} double 
@llvm.nvvm.wmma.m8n8k4.load.a.col.stride.f64.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R1]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store double %[[R1]], ptr %{{.*}}, align 4
+  __dmma_m8n8k4_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_dmma_m8n8k4_ld_b(
+// LLVM-LABEL: @test_dmma_m8n8k4_ld_b(
+DEVICE void test_dmma_m8n8k4_ld_b(double *dst, const double *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k4.load.b.row.stride.f64"
+  // LLVM: %[[R0:.*]] = call{{.*}} double 
@llvm.nvvm.wmma.m8n8k4.load.b.row.stride.f64.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R0]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store double %[[R0]], ptr %{{.*}}, align 4
+  __dmma_m8n8k4_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k4.load.b.col.stride.f64"
+  // LLVM: %[[R1:.*]] = call{{.*}} double 
@llvm.nvvm.wmma.m8n8k4.load.b.col.stride.f64.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR-NEXT: cir.store align(4) %[[R1]],
+  // LLVM-NOT: extractvalue
+  // LLVM: store double %[[R1]], ptr %{{.*}}, align 4
+  __dmma_m8n8k4_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_dmma_m8n8k4_ld_c(
+// LLVM-LABEL: @test_dmma_m8n8k4_ld_c(
+DEVICE void test_dmma_m8n8k4_ld_c(double *dst, const double *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k4.load.c.row.stride.f64"
+  // LLVM: %[[R0:.*]] = call{{.*}} { double, double } 
@llvm.nvvm.wmma.m8n8k4.load.c.row.stride.f64.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][0]
+  // LLVM: %[[E0_0:.*]] = extractvalue { double, double } %[[R0]], 0
+  // LLVM: store double %[[E0_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[E0_1:.*]] = extractvalue { double, double } %[[R0]], 1
+  // LLVM: store double %[[E0_1]], ptr %{{.*}}, align 4
+  __dmma_m8n8k4_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n8k4.load.c.col.stride.f64"
+  // LLVM: %[[R1:.*]] = call{{.*}} { double, double } 
@llvm.nvvm.wmma.m8n8k4.load.c.col.stride.f64.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R1]][0]
+  // LLVM: %[[E1_0:.*]] = extractvalue { double, double } %[[R1]], 0
+  // LLVM: store double %[[E1_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R1]][1]
+  // LLVM: %[[E1_1:.*]] = extractvalue { double, double } %[[R1]], 1
+  // LLVM: store double %[[E1_1]], ptr %{{.*}}, align 4
+  __dmma_m8n8k4_ld_c(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_bf16_m16n16k16_ld_a(
+// LLVM-LABEL: @test_mma_bf16_m16n16k16_ld_a(
+DEVICE void test_mma_bf16_m16n16k16_ld_a(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.row.stride.bf16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.a.row.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][0]
+  // LLVM: %[[E0_0:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 0
+  // LLVM: store i32 %[[E0_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[E0_3:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[E0_3]], ptr %{{.*}}, align 4
+  __mma_bf16_m16n16k16_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.col.stride.bf16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.a.col.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R1]][0]
+  // LLVM: %[[E1_0:.*]] = extractvalue { i32, i32, i32, i32 } %[[R1]], 0
+  // LLVM: store i32 %[[E1_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R1]][3]
+  // LLVM: %[[E1_3:.*]] = extractvalue { i32, i32, i32, i32 } %[[R1]], 3
+  // LLVM: store i32 %[[E1_3]], ptr %{{.*}}, align 4
+  __mma_bf16_m16n16k16_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_bf16_m16n16k16_ld_b(
+// LLVM-LABEL: @test_mma_bf16_m16n16k16_ld_b(
+DEVICE void test_mma_bf16_m16n16k16_ld_b(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.row.stride.bf16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.b.row.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __mma_bf16_m16n16k16_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.col.stride.bf16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k16.load.b.col.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __mma_bf16_m16n16k16_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_bf16_m32n8k16_ld_a(
+// LLVM-LABEL: @test_mma_bf16_m32n8k16_ld_a(
+DEVICE void test_mma_bf16_m32n8k16_ld_a(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.row.stride.bf16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.a.row.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R0]], 7
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __mma_bf16_m32n8k16_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.a.col.stride.bf16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.a.col.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __mma_bf16_m32n8k16_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_bf16_m32n8k16_ld_b(
+// LLVM-LABEL: @test_mma_bf16_m32n8k16_ld_b(
+DEVICE void test_mma_bf16_m32n8k16_ld_b(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.row.stride.bf16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.b.row.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __mma_bf16_m32n8k16_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m32n8k16.load.b.col.stride.bf16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m32n8k16.load.b.col.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __mma_bf16_m32n8k16_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_bf16_m8n32k16_ld_a(
+// LLVM-LABEL: @test_mma_bf16_m8n32k16_ld_a(
+DEVICE void test_mma_bf16_m8n32k16_ld_a(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.row.stride.bf16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.a.row.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][1]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32 } %[[R0]], 1
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __mma_bf16_m8n32k16_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.a.col.stride.bf16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.a.col.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __mma_bf16_m8n32k16_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_bf16_m8n32k16_ld_b(
+// LLVM-LABEL: @test_mma_bf16_m8n32k16_ld_b(
+DEVICE void test_mma_bf16_m8n32k16_ld_b(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.row.stride.bf16"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.b.row.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32, i32, i32, i32, 
i32 } %[[R0]], 7
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __mma_bf16_m8n32k16_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m8n32k16.load.b.col.stride.bf16"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32, i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m8n32k16.load.b.col.stride.bf16.p0(ptr %{{.*}}, i32 %{{.*}})
+  __mma_bf16_m8n32k16_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_tf32_m16n16k8_ld_a(
+// LLVM-LABEL: @test_mma_tf32_m16n16k8_ld_a(
+DEVICE void test_mma_tf32_m16n16k8_ld_a(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k8.load.a.row.stride.tf32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k8.load.a.row.stride.tf32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][0]
+  // LLVM: %[[E0_0:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 0
+  // LLVM: store i32 %[[E0_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[E0_3:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[E0_3]], ptr %{{.*}}, align 4
+  __mma_tf32_m16n16k8_ld_a(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k8.load.a.col.stride.tf32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k8.load.a.col.stride.tf32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R1]][0]
+  // LLVM: %[[E1_0:.*]] = extractvalue { i32, i32, i32, i32 } %[[R1]], 0
+  // LLVM: store i32 %[[E1_0]], ptr %{{.*}}, align 4
+  // CIR: cir.extract_member %[[R1]][3]
+  // LLVM: %[[E1_3:.*]] = extractvalue { i32, i32, i32, i32 } %[[R1]], 3
+  // LLVM: store i32 %[[E1_3]], ptr %{{.*}}, align 4
+  __mma_tf32_m16n16k8_ld_a(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_tf32_m16n16k8_ld_b(
+// LLVM-LABEL: @test_mma_tf32_m16n16k8_ld_b(
+DEVICE void test_mma_tf32_m16n16k8_ld_b(int *dst, const int *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k8.load.b.row.stride.tf32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k8.load.b.row.stride.tf32.p0(ptr %{{.*}}, i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][3]
+  // LLVM: %[[LAST:.*]] = extractvalue { i32, i32, i32, i32 } %[[R0]], 3
+  // LLVM: store i32 %[[LAST]], ptr %{{.*}}, align 4
+  __mma_tf32_m16n16k8_ld_b(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k8.load.b.col.stride.tf32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { i32, i32, i32, i32 } 
@llvm.nvvm.wmma.m16n16k8.load.b.col.stride.tf32.p0(ptr %{{.*}}, i32 %{{.*}})
+  __mma_tf32_m16n16k8_ld_b(dst, src, stride, 1);
+
+}
+
+// CIR-LABEL: @test_mma_tf32_m16n16k8_ld_c(
+// LLVM-LABEL: @test_mma_tf32_m16n16k8_ld_c(
+DEVICE void test_mma_tf32_m16n16k8_ld_c(float *dst, const float *src, unsigned 
stride) {
+  // CIR: %[[R0:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k8.load.c.row.stride.f32"
+  // LLVM: %[[R0:.*]] = call{{.*}} { float, float, float, float, float, float, 
float, float } @llvm.nvvm.wmma.m16n16k8.load.c.row.stride.f32.p0(ptr %{{.*}}, 
i32 %{{.*}})
+  // CIR: cir.extract_member %[[R0]][7]
+  // LLVM: %[[LAST:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[R0]], 7
+  // LLVM: store float %[[LAST]], ptr %{{.*}}, align 4
+  __mma_tf32_m16n16k8_ld_c(dst, src, stride, 0);
+
+  // CIR: %[[R1:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k8.load.c.col.stride.f32"
+  // LLVM: %[[R1:.*]] = call{{.*}} { float, float, float, float, float, float, 
float, float } @llvm.nvvm.wmma.m16n16k8.load.c.col.stride.f32.p0(ptr %{{.*}}, 
i32 %{{.*}})
+  __mma_tf32_m16n16k8_ld_c(dst, src, stride, 1);
+
+}

diff  --git a/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma.cu 
b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma.cu
new file mode 100644
index 00000000000000..bffed0080ae9b3
--- /dev/null
+++ b/clang/test/CIR/CodeGenCUDA/builtins-nvptx-wmma.cu
@@ -0,0 +1,208 @@
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_70 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-cir %s -o - | FileCheck %s --check-prefix=CIR 
--enable-var-scope
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_70 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device -fclangir \
+// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=LLVM 
--enable-var-scope
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -target-cpu sm_70 \
+// RUN:   -target-feature +ptx60 -x cuda -fcuda-is-device \
+// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=LLVM 
--enable-var-scope
+
+// Cover the SM70/PTX60 m16n16k16 floating-point WMMA load builtins. FP16
+// fragments use i32 storage slots and <2 x half> intrinsic registers.
+// The LLVM checks are shared with classic codegen. Use DAG checks for
+// independent fragment extraction and destination address calculations, whose
+// order can 
diff er between host compilers in classic codegen.
+
+#define DEVICE extern "C" __attribute__((device))
+
+// CIR-LABEL: @load_a_f16_row(
+// LLVM-LABEL: @load_a_f16_row(
+// LLVM: %[[DST:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[SRC:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[STRIDE:.*]] = load i32, ptr %{{.*}}, align 4
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.row.stride.f16"
+// CIR: %[[E0:.*]] = cir.extract_member %[[RESULT]][0]
+// CIR: cir.cast bitcast %[[E0]] : !cir.vector<2 x !cir.f16> -> !s32i
+// CIR: cir.extract_member %[[RESULT]][7]
+// LLVM: %[[RESULT:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 
x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m16n16k16.load.a.row.stride.f16.p0(ptr %[[SRC]], i32 
%[[STRIDE]])
+// LLVM: %[[E0:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 0
+// LLVM: %[[BITS0:.*]] = bitcast <2 x half> %[[E0]] to i32
+// LLVM: store i32 %[[BITS0]], ptr %[[P0:.*]], align 4
+// LLVM-DAG: %[[E1:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 1
+// LLVM-DAG: %[[BITS1:.*]] = bitcast <2 x half> %[[E1]] to i32
+// LLVM-DAG: %[[P1:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 1
+// LLVM: store i32 %[[BITS1]], ptr %[[P1]], align 4
+// LLVM-DAG: %[[E2:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 2
+// LLVM-DAG: %[[BITS2:.*]] = bitcast <2 x half> %[[E2]] to i32
+// LLVM-DAG: %[[P2:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 2
+// LLVM: store i32 %[[BITS2]], ptr %[[P2]], align 4
+// LLVM-DAG: %[[E3:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 3
+// LLVM-DAG: %[[BITS3:.*]] = bitcast <2 x half> %[[E3]] to i32
+// LLVM-DAG: %[[P3:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 3
+// LLVM: store i32 %[[BITS3]], ptr %[[P3]], align 4
+// LLVM-DAG: %[[E4:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 4
+// LLVM-DAG: %[[BITS4:.*]] = bitcast <2 x half> %[[E4]] to i32
+// LLVM-DAG: %[[P4:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 4
+// LLVM: store i32 %[[BITS4]], ptr %[[P4]], align 4
+// LLVM-DAG: %[[E5:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 5
+// LLVM-DAG: %[[BITS5:.*]] = bitcast <2 x half> %[[E5]] to i32
+// LLVM-DAG: %[[P5:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 5
+// LLVM: store i32 %[[BITS5]], ptr %[[P5]], align 4
+// LLVM-DAG: %[[E6:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 6
+// LLVM-DAG: %[[BITS6:.*]] = bitcast <2 x half> %[[E6]] to i32
+// LLVM-DAG: %[[P6:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 6
+// LLVM: store i32 %[[BITS6]], ptr %[[P6]], align 4
+// LLVM-DAG: %[[E7:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 7
+// LLVM-DAG: %[[BITS7:.*]] = bitcast <2 x half> %[[E7]] to i32
+// LLVM-DAG: %[[P7:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 7
+// LLVM: store i32 %[[BITS7]], ptr %[[P7]], align 4
+// LLVM: ret void
+DEVICE void load_a_f16_row(int *dst, const int *src, unsigned stride) {
+  __hmma_m16n16k16_ld_a(dst, src, stride, 0);
+}
+
+// CIR-LABEL: @load_a_f16_col(
+// LLVM-LABEL: @load_a_f16_col(
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.a.col.stride.f16"
+// LLVM: %[[RESULT:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 
x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m16n16k16.load.a.col.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+DEVICE void load_a_f16_col(int *dst, const int *src, unsigned stride) {
+  __hmma_m16n16k16_ld_a(dst, src, stride, 1);
+}
+
+// CIR-LABEL: @load_b_f16_row(
+// LLVM-LABEL: @load_b_f16_row(
+// LLVM: %[[DST:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[SRC:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[STRIDE:.*]] = load i32, ptr %{{.*}}, align 4
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.row.stride.f16"
+// CIR: %[[E0:.*]] = cir.extract_member %[[RESULT]][0]
+// CIR: cir.cast bitcast %[[E0]] : !cir.vector<2 x !cir.f16> -> !s32i
+// CIR: cir.extract_member %[[RESULT]][7]
+// LLVM: %[[RESULT:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 
x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m16n16k16.load.b.row.stride.f16.p0(ptr %[[SRC]], i32 
%[[STRIDE]])
+// LLVM: %[[E0:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, <2 x 
half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 0
+// LLVM: %[[BITS0:.*]] = bitcast <2 x half> %[[E0]] to i32
+// LLVM: store i32 %[[BITS0]], ptr %[[P0:.*]], align 4
+// LLVM-DAG: %[[E1:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 1
+// LLVM-DAG: %[[BITS1:.*]] = bitcast <2 x half> %[[E1]] to i32
+// LLVM-DAG: %[[P1:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 1
+// LLVM: store i32 %[[BITS1]], ptr %[[P1]], align 4
+// LLVM-DAG: %[[E2:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 2
+// LLVM-DAG: %[[BITS2:.*]] = bitcast <2 x half> %[[E2]] to i32
+// LLVM-DAG: %[[P2:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 2
+// LLVM: store i32 %[[BITS2]], ptr %[[P2]], align 4
+// LLVM-DAG: %[[E3:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 3
+// LLVM-DAG: %[[BITS3:.*]] = bitcast <2 x half> %[[E3]] to i32
+// LLVM-DAG: %[[P3:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 3
+// LLVM: store i32 %[[BITS3]], ptr %[[P3]], align 4
+// LLVM-DAG: %[[E4:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 4
+// LLVM-DAG: %[[BITS4:.*]] = bitcast <2 x half> %[[E4]] to i32
+// LLVM-DAG: %[[P4:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 4
+// LLVM: store i32 %[[BITS4]], ptr %[[P4]], align 4
+// LLVM-DAG: %[[E5:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 5
+// LLVM-DAG: %[[BITS5:.*]] = bitcast <2 x half> %[[E5]] to i32
+// LLVM-DAG: %[[P5:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 5
+// LLVM: store i32 %[[BITS5]], ptr %[[P5]], align 4
+// LLVM-DAG: %[[E6:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 6
+// LLVM-DAG: %[[BITS6:.*]] = bitcast <2 x half> %[[E6]] to i32
+// LLVM-DAG: %[[P6:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 6
+// LLVM: store i32 %[[BITS6]], ptr %[[P6]], align 4
+// LLVM-DAG: %[[E7:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } %[[RESULT]], 7
+// LLVM-DAG: %[[BITS7:.*]] = bitcast <2 x half> %[[E7]] to i32
+// LLVM-DAG: %[[P7:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 7
+// LLVM: store i32 %[[BITS7]], ptr %[[P7]], align 4
+// LLVM: ret void
+DEVICE void load_b_f16_row(int *dst, const int *src, unsigned stride) {
+  __hmma_m16n16k16_ld_b(dst, src, stride, 0);
+}
+
+// CIR-LABEL: @load_b_f16_col(
+// LLVM-LABEL: @load_b_f16_col(
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.b.col.stride.f16"
+// LLVM: %[[RESULT:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 
x half>, <2 x half>, <2 x half>, <2 x half>, <2 x half> } 
@llvm.nvvm.wmma.m16n16k16.load.b.col.stride.f16.p0(ptr %{{.*}}, i32 %{{.*}})
+DEVICE void load_b_f16_col(int *dst, const int *src, unsigned stride) {
+  __hmma_m16n16k16_ld_b(dst, src, stride, 1);
+}
+
+// CIR-LABEL: @load_c_f16_row(
+// LLVM-LABEL: @load_c_f16_row(
+// LLVM: %[[DST:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[SRC:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[STRIDE:.*]] = load i32, ptr %{{.*}}, align 4
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.c.row.stride.f16"
+// CIR: %[[E0:.*]] = cir.extract_member %[[RESULT]][0]
+// CIR: cir.cast bitcast %[[E0]] : !cir.vector<2 x !cir.f16> -> !s32i
+// CIR: cir.extract_member %[[RESULT]][3]
+// LLVM: %[[RESULT:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 
x half> } @llvm.nvvm.wmma.m16n16k16.load.c.row.stride.f16.p0(ptr %[[SRC]], i32 
%[[STRIDE]])
+// LLVM: %[[E0:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, <2 x 
half> } %[[RESULT]], 0
+// LLVM: %[[BITS0:.*]] = bitcast <2 x half> %[[E0]] to i32
+// LLVM: store i32 %[[BITS0]], ptr %[[P0:.*]], align 4
+// LLVM-DAG: %[[E1:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half> } %[[RESULT]], 1
+// LLVM-DAG: %[[BITS1:.*]] = bitcast <2 x half> %[[E1]] to i32
+// LLVM-DAG: %[[P1:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 1
+// LLVM: store i32 %[[BITS1]], ptr %[[P1]], align 4
+// LLVM-DAG: %[[E2:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half> } %[[RESULT]], 2
+// LLVM-DAG: %[[BITS2:.*]] = bitcast <2 x half> %[[E2]] to i32
+// LLVM-DAG: %[[P2:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 2
+// LLVM: store i32 %[[BITS2]], ptr %[[P2]], align 4
+// LLVM-DAG: %[[E3:.*]] = extractvalue { <2 x half>, <2 x half>, <2 x half>, 
<2 x half> } %[[RESULT]], 3
+// LLVM-DAG: %[[BITS3:.*]] = bitcast <2 x half> %[[E3]] to i32
+// LLVM-DAG: %[[P3:.*]] = getelementptr{{.*}} i32, ptr %[[DST]], i{{32|64}} 3
+// LLVM: store i32 %[[BITS3]], ptr %[[P3]], align 4
+// LLVM: ret void
+DEVICE void load_c_f16_row(int *dst, const int *src, unsigned stride) {
+  __hmma_m16n16k16_ld_c_f16(dst, src, stride, 0);
+}
+
+// CIR-LABEL: @load_c_f16_col(
+// LLVM-LABEL: @load_c_f16_col(
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.c.col.stride.f16"
+// LLVM: %[[RESULT:.*]] = call{{.*}} { <2 x half>, <2 x half>, <2 x half>, <2 
x half> } @llvm.nvvm.wmma.m16n16k16.load.c.col.stride.f16.p0(ptr %{{.*}}, i32 
%{{.*}})
+DEVICE void load_c_f16_col(int *dst, const int *src, unsigned stride) {
+  __hmma_m16n16k16_ld_c_f16(dst, src, stride, 1);
+}
+
+// CIR-LABEL: @load_c_f32_row(
+// LLVM-LABEL: @load_c_f32_row(
+// LLVM: %[[DST:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[SRC:.*]] = load ptr, ptr %{{.*}}
+// LLVM: %[[STRIDE:.*]] = load i32, ptr %{{.*}}, align 4
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.c.row.stride.f32"
+// CIR: %[[E0:.*]] = cir.extract_member %[[RESULT]][0]
+// CIR: cir.extract_member %[[RESULT]][7]
+// LLVM: %[[RESULT:.*]] = call{{.*}} { float, float, float, float, float, 
float, float, float } @llvm.nvvm.wmma.m16n16k16.load.c.row.stride.f32.p0(ptr 
%[[SRC]], i32 %[[STRIDE]])
+// LLVM: %[[E0:.*]] = extractvalue { float, float, float, float, float, float, 
float, float } %[[RESULT]], 0
+// LLVM: store float %[[E0]], ptr %[[P0:.*]], align 4
+// LLVM-DAG: %[[E1:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 1
+// LLVM-DAG: %[[P1:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 1
+// LLVM: store float %[[E1]], ptr %[[P1]], align 4
+// LLVM-DAG: %[[E2:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 2
+// LLVM-DAG: %[[P2:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 2
+// LLVM: store float %[[E2]], ptr %[[P2]], align 4
+// LLVM-DAG: %[[E3:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 3
+// LLVM-DAG: %[[P3:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 3
+// LLVM: store float %[[E3]], ptr %[[P3]], align 4
+// LLVM-DAG: %[[E4:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 4
+// LLVM-DAG: %[[P4:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 4
+// LLVM: store float %[[E4]], ptr %[[P4]], align 4
+// LLVM-DAG: %[[E5:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 5
+// LLVM-DAG: %[[P5:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 5
+// LLVM: store float %[[E5]], ptr %[[P5]], align 4
+// LLVM-DAG: %[[E6:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 6
+// LLVM-DAG: %[[P6:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 6
+// LLVM: store float %[[E6]], ptr %[[P6]], align 4
+// LLVM-DAG: %[[E7:.*]] = extractvalue { float, float, float, float, float, 
float, float, float } %[[RESULT]], 7
+// LLVM-DAG: %[[P7:.*]] = getelementptr{{.*}} float, ptr %[[DST]], i{{32|64}} 7
+// LLVM: store float %[[E7]], ptr %[[P7]], align 4
+// LLVM: ret void
+DEVICE void load_c_f32_row(float *dst, const float *src, unsigned stride) {
+  __hmma_m16n16k16_ld_c_f32(dst, src, stride, 0);
+}
+
+// CIR-LABEL: @load_c_f32_col(
+// LLVM-LABEL: @load_c_f32_col(
+// CIR: %[[RESULT:.*]] = cir.call_llvm_intrinsic 
"nvvm.wmma.m16n16k16.load.c.col.stride.f32"
+// LLVM: %[[RESULT:.*]] = call{{.*}} { float, float, float, float, float, 
float, float, float } @llvm.nvvm.wmma.m16n16k16.load.c.col.stride.f32.p0(ptr 
%{{.*}}, i32 %{{.*}})
+DEVICE void load_c_f32_col(float *dst, const float *src, unsigned stride) {
+  __hmma_m16n16k16_ld_c_f32(dst, src, stride, 1);
+}


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to