Skip to content

[AMDGPU] New intrinsic void llvm.amdgcn.s.nop(i16) #65757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/include/llvm/IR/IntrinsicsAMDGPU.td
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,11 @@ def int_amdgcn_s_sleep :
IntrHasSideEffects]> {
}

def int_amdgcn_s_nop :
DefaultAttrsIntrinsic<[], [llvm_i16_ty], [ImmArg<ArgIndex<0>>, IntrNoMem,
IntrHasSideEffects]> {
}

def int_amdgcn_s_incperflevel :
ClangBuiltin<"__builtin_amdgcn_s_incperflevel">,
DefaultAttrsIntrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>, IntrNoMem,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/AMDGPU/SOPInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,8 @@ multiclass SOPP_With_Relaxation <string opName, dag ins,
def _pad_s_nop : SOPP_Pseudo <opName # "_pad_s_nop", ins, asmOps, pattern, " ", opName>;
}

def S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16"> {
def S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16",
[(int_amdgcn_s_nop timm:$simm16)]> {
let hasSideEffects = 1;
}

Expand Down
30 changes: 30 additions & 0 deletions llvm/test/CodeGen/AMDGPU/llvm.amdgcn.s.nop.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
; RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s

define amdgpu_kernel void @test_s_nop() {
; GCN-LABEL: test_s_nop:
; GCN: ; %bb.0:
; GCN-NEXT: s_nop 0
; GCN-NEXT: s_nop 1
; GCN-NEXT: s_nop 2
; GCN-NEXT: s_nop 3
; GCN-NEXT: s_nop 4
; GCN-NEXT: s_nop 5
; GCN-NEXT: s_nop 6
; GCN-NEXT: s_nop 7
; GCN-NEXT: s_nop 63
; GCN-NEXT: s_endpgm
call void @llvm.amdgcn.s.nop(i16 0)
call void @llvm.amdgcn.s.nop(i16 1)
call void @llvm.amdgcn.s.nop(i16 2)
call void @llvm.amdgcn.s.nop(i16 3)
call void @llvm.amdgcn.s.nop(i16 4)
call void @llvm.amdgcn.s.nop(i16 5)
call void @llvm.amdgcn.s.nop(i16 6)
call void @llvm.amdgcn.s.nop(i16 7)
call void @llvm.amdgcn.s.nop(i16 63)
ret void
}

declare void @llvm.amdgcn.s.nop(i16)