[PATCH] D120976: [AMDGPU] Add llvm.amdgcn.s.setprio intrinsic

Austin Kerbow via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 00:27:58 PST 2022


kerbowa created this revision.
kerbowa added reviewers: rampitec, arsenm.
Herald added subscribers: foad, hiraditya, t-tye, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
kerbowa requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120976

Files:
  llvm/include/llvm/IR/IntrinsicsAMDGPU.td
  llvm/lib/Target/AMDGPU/SOPInstructions.td
  llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.s.setprio.ll
  llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.setprio.ll


Index: llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.setprio.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.setprio.ll
@@ -0,0 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
+; RUN: llc -march=amdgcn -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
+
+declare void @llvm.amdgcn.s.setprio(i32) #0
+
+define void @test_llvm_amdgcn_s_setprio() #0 {
+; GCN-LABEL: test_llvm_amdgcn_s_setprio:
+; GCN:       ; %bb.0:
+; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; GCN-NEXT:    s_setprio 0
+; GCN-NEXT:    s_setprio 1
+; GCN-NEXT:    s_setprio 2
+; GCN-NEXT:    s_setprio 3
+; GCN-NEXT:    s_setpc_b64 s[30:31]
+  call void @llvm.amdgcn.s.setprio(i32 0)
+  call void @llvm.amdgcn.s.setprio(i32 1)
+  call void @llvm.amdgcn.s.setprio(i32 2)
+  call void @llvm.amdgcn.s.setprio(i32 3)
+  ret void
+}
+
+attributes #0 = { nounwind }
Index: llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.s.setprio.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.s.setprio.ll
@@ -0,0 +1,3 @@
+; Runs SDAG test with -global-isel
+; RUN: llc -global-isel -march=amdgcn -verify-machineinstrs < %S/../llvm.amdgcn.s.setprio.ll | FileCheck -check-prefix=GCN %S/../llvm.amdgcn.s.setprio.ll
+; RUN: llc -global-isel -march=amdgcn -mcpu=gfx90a -verify-machineinstrs < %S/../llvm.amdgcn.s.setprio.ll | FileCheck -check-prefix=GCN %S/../llvm.amdgcn.s.setprio.ll
\ No newline at end of file
Index: llvm/lib/Target/AMDGPU/SOPInstructions.td
===================================================================
--- llvm/lib/Target/AMDGPU/SOPInstructions.td
+++ llvm/lib/Target/AMDGPU/SOPInstructions.td
@@ -1279,7 +1279,10 @@
   let hasSideEffects = 1;
 }
 
-def S_SETPRIO : SOPP_Pseudo <"s_setprio" , (ins i16imm:$simm16), "$simm16">;
+def S_SETPRIO : SOPP_Pseudo <"s_setprio", (ins i32imm:$simm16), "$simm16",
+  [(int_amdgcn_s_setprio timm:$simm16)]> {
+  let hasSideEffects = 1;
+}
 
 let Uses = [EXEC, M0] in {
 // FIXME: Should this be mayLoad+mayStore?
Index: llvm/include/llvm/IR/IntrinsicsAMDGPU.td
===================================================================
--- llvm/include/llvm/IR/IntrinsicsAMDGPU.td
+++ llvm/include/llvm/IR/IntrinsicsAMDGPU.td
@@ -1329,6 +1329,11 @@
   Intrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>, IntrNoMem,
                                 IntrHasSideEffects, IntrWillReturn]>;
 
+def int_amdgcn_s_setprio :
+  GCCBuiltin<"__builtin_amdgcn_s_setprio">,
+  Intrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>, IntrNoMem,
+                                IntrHasSideEffects, IntrWillReturn]>;
+
 def int_amdgcn_s_getreg :
   GCCBuiltin<"__builtin_amdgcn_s_getreg">,
   Intrinsic<[llvm_i32_ty], [llvm_i32_ty],


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120976.412946.patch
Type: text/x-patch
Size: 2936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220304/32bc7945/attachment.bin>


More information about the llvm-commits mailing list