1 ;RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=SI %s
2 ;RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI %s
4 ; GCN-LABEL: {{^}}test_interrupt:
6 ; GCN-NOT: s_mov_b32 m0
7 ; GCN: s_sendmsg sendmsg(MSG_INTERRUPT)
8 define amdgpu_kernel void @test_interrupt() {
10 call void @llvm.amdgcn.s.sendmsg(i32 1, i32 0);
14 ; GCN-LABEL: {{^}}test_gs_emit:
15 ; GCN: s_mov_b32 m0, 0
16 ; GCN-NOT: s_mov_b32 m0
17 ; GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT, 0)
18 define amdgpu_kernel void @test_gs_emit() {
20 call void @llvm.amdgcn.s.sendmsg(i32 34, i32 0);
24 ; GCN-LABEL: {{^}}test_gs_cut:
25 ; GCN: s_mov_b32 m0, 0
26 ; GCN-NOT: s_mov_b32 m0
27 ; GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_CUT, 1)
28 define amdgpu_kernel void @test_gs_cut() {
30 call void @llvm.amdgcn.s.sendmsg(i32 274, i32 0);
34 ; GCN-LABEL: {{^}}test_gs_emit_cut:
35 ; GCN: s_mov_b32 m0, 0
36 ; GCN-NOT: s_mov_b32 m0
37 ; GCN: s_sendmsg sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2)
38 define amdgpu_kernel void @test_gs_emit_cut() {
40 call void @llvm.amdgcn.s.sendmsg(i32 562, i32 0)
44 ; GCN-LABEL: {{^}}test_gs_done:
45 ; GCN: s_mov_b32 m0, 0
46 ; GCN-NOT: s_mov_b32 m0
47 ; GCN: s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP)
48 define amdgpu_kernel void @test_gs_done() {
50 call void @llvm.amdgcn.s.sendmsg(i32 3, i32 0)
54 ; GCN-LABEL: {{^}}sendmsg:
55 ; GCN: s_mov_b32 m0, s0
57 ; GCN-NEXT: sendmsg(MSG_GS_DONE, GS_OP_NOP)
59 define amdgpu_gs void @sendmsg(i32 inreg %a) #0 {
60 call void @llvm.amdgcn.s.sendmsg(i32 3, i32 %a)
64 ; GCN-LABEL: {{^}}sendmsghalt:
65 ; GCN: s_mov_b32 m0, s0
67 ; GCN-NEXT: s_sendmsghalt sendmsg(MSG_INTERRUPT)
69 define amdgpu_kernel void @sendmsghalt(i32 inreg %a) #0 {
70 call void @llvm.amdgcn.s.sendmsghalt(i32 1, i32 %a)
74 ; GCN-LABEL: {{^}}test_interrupt_halt:
75 ; GCN: s_mov_b32 m0, 0
76 ; GCN-NOT: s_mov_b32 m0
77 ; GCN: s_sendmsghalt sendmsg(MSG_INTERRUPT)
78 define amdgpu_kernel void @test_interrupt_halt() {
80 call void @llvm.amdgcn.s.sendmsghalt(i32 1, i32 0)
84 ; GCN-LABEL: {{^}}test_gs_emit_halt:
85 ; GCN: s_mov_b32 m0, 0
86 ; GCN-NOT: s_mov_b32 m0
87 ; GCN: s_sendmsghalt sendmsg(MSG_GS, GS_OP_EMIT, 0)
88 define amdgpu_kernel void @test_gs_emit_halt() {
90 call void @llvm.amdgcn.s.sendmsghalt(i32 34, i32 0)
94 ; GCN-LABEL: {{^}}test_gs_cut_halt:
95 ; GCN: s_mov_b32 m0, 0
96 ; GCN-NOT: s_mov_b32 m0
97 ; GCN: s_sendmsghalt sendmsg(MSG_GS, GS_OP_CUT, 1)
98 define amdgpu_kernel void @test_gs_cut_halt() {
100 call void @llvm.amdgcn.s.sendmsghalt(i32 274, i32 0)
104 ; GCN-LABEL: {{^}}test_gs_emit_cut_halt:
105 ; GCN: s_mov_b32 m0, 0
106 ; GCN-NOT: s_mov_b32 m0
107 ; GCN: s_sendmsghalt sendmsg(MSG_GS, GS_OP_EMIT_CUT, 2)
108 define amdgpu_kernel void @test_gs_emit_cut_halt() {
110 call void @llvm.amdgcn.s.sendmsghalt(i32 562, i32 0)
114 ; GCN-LABEL: {{^}}test_gs_done_halt:
115 ; GCN: s_mov_b32 m0, 0
116 ; GCN-NOT: s_mov_b32 m0
117 ; GCN: s_sendmsghalt sendmsg(MSG_GS_DONE, GS_OP_NOP)
118 define amdgpu_kernel void @test_gs_done_halt() {
120 call void @llvm.amdgcn.s.sendmsghalt(i32 3, i32 0)
124 ; TODO: This should use s_mul_i32 instead of v_mul_u32_u24 + v_readfirstlane!
126 ; GCN-LABEL: {{^}}test_mul24:
127 ; GCN: v_mul_u32_u24_e32
128 ; GCN: v_readfirstlane_b32
130 ; GCN: s_sendmsg sendmsg(MSG_INTERRUPT)
131 define amdgpu_gs void @test_mul24(i32 inreg %arg) {
133 %tmp1 = and i32 %arg, 511
134 %tmp2 = mul nuw nsw i32 %tmp1, 12288
135 call void @llvm.amdgcn.s.sendmsg(i32 1, i32 %tmp2)
139 ; GCN-LABEL: {{^}}if_sendmsg:
140 ; GCN: s_cbranch_execz
141 ; GCN: s_sendmsg sendmsg(MSG_GS_DONE, GS_OP_NOP)
142 define amdgpu_gs void @if_sendmsg(i32 %flag) #0 {
143 %cc = icmp eq i32 %flag, 0
144 br i1 %cc, label %sendmsg, label %end
147 call void @llvm.amdgcn.s.sendmsg(i32 3, i32 0)
154 declare void @llvm.amdgcn.s.sendmsg(i32, i32) #0
155 declare void @llvm.amdgcn.s.sendmsghalt(i32, i32) #0
157 attributes #0 = { nounwind }