1; XFAIL: *
2; REQUIRES: asserts
3; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s
4
5; write_register doesn't prevent us from illegally trying to write a
6; vgpr value into a scalar register, but I don't think there's much we
7; can do to avoid this.
8
9declare void @llvm.write_register.i32(metadata, i32) #0
10declare i32 @llvm.amdgcn.workitem.id.x() #0
11declare void @llvm.amdgcn.wave.barrier() #2
12
13define amdgpu_kernel void @write_vgpr_into_sgpr() {
14  %tid = call i32 @llvm.amdgcn.workitem.id.x()
15  call void @llvm.write_register.i32(metadata !0, i32 %tid)
16  call void @llvm.amdgcn.wave.barrier() #2
17  ret void
18}
19
20attributes #0 = { nounwind readnone }
21attributes #1 = { nounwind }
22attributes #2 = { convergent nounwind }
23
24!0 = !{!"exec_lo"}
25