summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AMDGPU/write-register-vgpr-into-sgpr.ll
blob: 51d9efee2681511cd1c4d9c3981cf347ae768dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
; XFAIL: *
; REQUIRES: asserts
; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s

; write_register doesn't prevent us from illegally trying to write a
; vgpr value into a scalar register, but I don't think there's much we
; can do to avoid this.

declare void @llvm.write_register.i32(metadata, i32) #0
declare i32 @llvm.amdgcn.workitem.id.x() #0
declare void @llvm.amdgcn.wave.barrier() #2

define amdgpu_kernel void @write_vgpr_into_sgpr() {
  %tid = call i32 @llvm.amdgcn.workitem.id.x()
  call void @llvm.write_register.i32(metadata !0, i32 %tid)
  call void @llvm.amdgcn.wave.barrier() #2
  ret void
}

attributes #0 = { nounwind readnone }
attributes #1 = { nounwind }
attributes #2 = { convergent nounwind }

!0 = !{!"exec_lo"}
OpenPOWER on IntegriCloud