Home | History | Annotate | Download | only in AMDGPU
      1 ; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=HSA -check-prefix=CI-HSA  %s
      2 ; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=carrizo -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=HSA -check-prefix=VI-HSA  %s
      3 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=MESA -check-prefix=SI-MESA %s
      4 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=MESA -check-prefix=VI-MESA %s
      5 
      6 declare i32 @llvm.amdgcn.workitem.id.x() #0
      7 declare i32 @llvm.amdgcn.workitem.id.y() #0
      8 declare i32 @llvm.amdgcn.workitem.id.z() #0
      9 
     10 ; MESA: .section .AMDGPU.config
     11 ; MESA: .long 47180
     12 ; MESA-NEXT: .long 132{{$}}
     13 
     14 ; ALL-LABEL {{^}}test_workitem_id_x:
     15 ; HSA: compute_pgm_rsrc2_tidig_comp_cnt = 0
     16 
     17 ; ALL-NOT: v0
     18 ; ALL: {{buffer|flat}}_store_dword {{.*}}v0
     19 define void @test_workitem_id_x(i32 addrspace(1)* %out) #1 {
     20   %id = call i32 @llvm.amdgcn.workitem.id.x()
     21   store i32 %id, i32 addrspace(1)* %out
     22   ret void
     23 }
     24 
     25 ; MESA: .section .AMDGPU.config
     26 ; MESA: .long 47180
     27 ; MESA-NEXT: .long 2180{{$}}
     28 
     29 ; ALL-LABEL {{^}}test_workitem_id_y:
     30 ; HSA: compute_pgm_rsrc2_tidig_comp_cnt = 1
     31 
     32 ; ALL-NOT: v1
     33 ; ALL: {{buffer|flat}}_store_dword {{.*}}v1
     34 define void @test_workitem_id_y(i32 addrspace(1)* %out) #1 {
     35   %id = call i32 @llvm.amdgcn.workitem.id.y()
     36   store i32 %id, i32 addrspace(1)* %out
     37   ret void
     38 }
     39 
     40 ; MESA: .section .AMDGPU.config
     41 ; MESA: .long 47180
     42 ; MESA-NEXT: .long 4228{{$}}
     43 
     44 ; ALL-LABEL {{^}}test_workitem_id_z:
     45 ; HSA: compute_pgm_rsrc2_tidig_comp_cnt = 2
     46 
     47 ; ALL-NOT: v2
     48 ; ALL: {{buffer|flat}}_store_dword {{.*}}v2
     49 define void @test_workitem_id_z(i32 addrspace(1)* %out) #1 {
     50   %id = call i32 @llvm.amdgcn.workitem.id.z()
     51   store i32 %id, i32 addrspace(1)* %out
     52   ret void
     53 }
     54 
     55 attributes #0 = { nounwind readnone }
     56 attributes #1 = { nounwind }
     57