1 ; RUN: llc -march=amdgcn -mcpu=bonaire -enable-misched=0 -verify-machineinstrs < %s | FileCheck %s
3 declare void @llvm.write_register.i32(metadata, i32) #0
4 declare void @llvm.write_register.i64(metadata, i64) #0
6 ; CHECK-LABEL: {{^}}test_write_m0:
7 define amdgpu_kernel void @test_write_m0(i32 %val) #0 {
8 call void @llvm.write_register.i32(metadata !0, i32 0)
9 call void @llvm.write_register.i32(metadata !0, i32 -1)
10 call void @llvm.write_register.i32(metadata !0, i32 %val)
11 call void @llvm.amdgcn.wave.barrier() #1
15 ; CHECK-LABEL: {{^}}test_write_exec:
16 ; CHECK: s_mov_b64 exec, 0
17 ; CHECK: s_mov_b64 exec, -1
18 ; CHECK: s_mov_b64 exec, s{{\[[0-9]+:[0-9]+\]}}
19 define amdgpu_kernel void @test_write_exec(i64 %val) #0 {
20 call void @llvm.write_register.i64(metadata !1, i64 0)
21 call void @llvm.write_register.i64(metadata !1, i64 -1)
22 call void @llvm.write_register.i64(metadata !1, i64 %val)
23 call void @llvm.amdgcn.wave.barrier() #1
27 ; CHECK-LABEL: {{^}}test_write_flat_scratch_0:
28 ; CHECK: s_mov_b64 flat_scratch, 0
29 define amdgpu_kernel void @test_write_flat_scratch_0(i64 %val) #0 {
30 call void @llvm.write_register.i64(metadata !2, i64 0)
31 call void @llvm.amdgcn.wave.barrier() #1
35 ; CHECK-LABEL: {{^}}test_write_flat_scratch_neg1:
36 ; CHECK: s_mov_b64 flat_scratch, -1
37 define amdgpu_kernel void @test_write_flat_scratch_neg1(i64 %val) #0 {
38 call void @llvm.write_register.i64(metadata !2, i64 -1)
39 call void @llvm.amdgcn.wave.barrier() #1
43 ; CHECK-LABEL: {{^}}test_write_flat_scratch_val:
44 ; CHECK: s_load_dwordx2 flat_scratch, s{{\[[0-9]+:[0-9]+\]}}
45 define amdgpu_kernel void @test_write_flat_scratch_val(i64 %val) #0 {
46 call void @llvm.write_register.i64(metadata !2, i64 %val)
47 call void @llvm.amdgcn.wave.barrier() #1
51 ; CHECK-LABEL: {{^}}test_write_flat_scratch_lo:
52 ; CHECK: s_mov_b32 flat_scratch_lo, 0
53 ; CHECK: s_mov_b32 flat_scratch_lo, s{{[0-9]+}}
54 define amdgpu_kernel void @test_write_flat_scratch_lo(i32 %val) #0 {
55 call void @llvm.write_register.i32(metadata !3, i32 0)
56 call void @llvm.write_register.i32(metadata !3, i32 %val)
57 call void @llvm.amdgcn.wave.barrier() #1
61 ; CHECK-LABEL: {{^}}test_write_flat_scratch_hi:
62 ; CHECK: s_mov_b32 flat_scratch_hi, 0
63 ; CHECK: s_mov_b32 flat_scratch_hi, s{{[0-9]+}}
64 define amdgpu_kernel void @test_write_flat_scratch_hi(i32 %val) #0 {
65 call void @llvm.write_register.i32(metadata !4, i32 0)
66 call void @llvm.write_register.i32(metadata !4, i32 %val)
67 call void @llvm.amdgcn.wave.barrier() #1
71 ; CHECK-LABEL: {{^}}test_write_exec_lo:
72 ; CHECK: s_mov_b32 exec_lo, 0
73 ; CHECK: s_mov_b32 exec_lo, s{{[0-9]+}}
74 define amdgpu_kernel void @test_write_exec_lo(i32 %val) #0 {
75 call void @llvm.write_register.i32(metadata !5, i32 0)
76 call void @llvm.write_register.i32(metadata !5, i32 %val)
77 call void @llvm.amdgcn.wave.barrier() #1
81 ; CHECK-LABEL: {{^}}test_write_exec_hi:
82 ; CHECK: s_mov_b32 exec_hi, 0
83 ; CHECK: s_mov_b32 exec_hi, s{{[0-9]+}}
84 define amdgpu_kernel void @test_write_exec_hi(i32 %val) #0 {
85 call void @llvm.write_register.i32(metadata !6, i32 0)
86 call void @llvm.write_register.i32(metadata !6, i32 %val)
87 call void @llvm.amdgcn.wave.barrier() #1
91 declare void @llvm.amdgcn.wave.barrier() #1
93 attributes #0 = { nounwind }
94 attributes #1 = { convergent nounwind }
98 !2 = !{!"flat_scratch"}
99 !3 = !{!"flat_scratch_lo"}
100 !4 = !{!"flat_scratch_hi"}