[llvm] [AMDGPU] Add llvm.amdgcn.s.prefetch.inst intrinsic (PR #192440)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 07:54:54 PDT 2026


================
@@ -1184,6 +1184,26 @@ let SubtargetPredicate = isGFX12Plus in {
     (SIsbuffer_prefetch v4i32:$sbase, (SMRDBufferImm i32:$offset), imm:$len),
     (S_BUFFER_PREFETCH_DATA SReg_128:$sbase, i32imm:$offset, (i32 SGPR_NULL), (as_i8timm $len))
   >;
+
+  def : GCNPat <
+    (int_amdgcn_s_prefetch_inst (SMRDImm i64:$sbase, i32:$offset), (i32 SReg_32:$len)),
+    (S_PREFETCH_INST $sbase, $offset, $len, 0)
+  >;
+
+  def : GCNPat <
+    (int_amdgcn_s_prefetch_inst (i64 SReg_64:$sbase), (i32 SReg_32:$len)),
+    (S_PREFETCH_INST $sbase, 0, $len, 0)
+  >;
+
+  def : GCNPat <
+    (int_amdgcn_s_prefetch_inst (SMRDImm i64:$sbase, i32:$offset), imm:$len),
+    (S_PREFETCH_INST $sbase, $offset, (i32 SGPR_NULL), (as_i8timm $len))
+  >;
+
+  def : GCNPat <
+    (int_amdgcn_s_prefetch_inst (i64 SReg_64:$sbase), imm:$len),
+    (S_PREFETCH_INST $sbase, 0, (i32 SGPR_NULL), (as_i8timm $len))
+  >;
----------------
arsenm wrote:

Should this also match S_PREFETCH_INST_PC_REL based on the source kind? 

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


More information about the llvm-commits mailing list