[clang] [WIP][AMDGPU] Support for type inferring image load/store builtins for AMDGPU (PR #140210)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 00:57:12 PDT 2025


================
@@ -683,6 +683,30 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID,
 
     return Builder.CreateInsertElement(I0, A, 1);
   }
+  case AMDGPU::BI__builtin_amdgcn_image_load_2d_f32_i32: {
+    llvm::Type *RetTy = llvm::Type::getFloatTy(Builder.getContext());
+    llvm::Type *IntTy = llvm::IntegerType::get(Builder.getContext(), 32u);
+
+    llvm::Value *imm0 = llvm::ConstantInt::get(IntTy, 1);
----------------
arsenm wrote:

Is is the dmask? 

For images, can we get away with only having the builtins return the 4 element case, and rely on demanded elements to shrink the dmask and return type? We do that optimization for buffers but I don't see it for images 

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


More information about the cfe-commits mailing list