Changeset View
Changeset View
Standalone View
Standalone View
llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.workitem.id.ll
; RUN: llc -global-isel -mtriple=amdgcn-unknown-amdhsa --amdhsa-code-object-version=2 -mcpu=kaveri -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,CO-V2 %s | ; RUN: llc -global-isel -mtriple=amdgcn-unknown-amdhsa --amdhsa-code-object-version=2 -mcpu=kaveri -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,HSA,CO-V2 %s | ||||
; RUN: llc -global-isel -mtriple=amdgcn-unknown-amdhsa --amdhsa-code-object-version=2 -mcpu=carrizo -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,CO-V2 %s | ; RUN: llc -global-isel -mtriple=amdgcn-unknown-amdhsa --amdhsa-code-object-version=2 -mcpu=carrizo -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,HSA,CO-V2 %s | ||||
; RUN: llc -global-isel -mtriple=amdgcn-- -mcpu=hawaii -mattr=+flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,MESA %s | ; RUN: llc -global-isel -mtriple=amdgcn-- -mcpu=hawaii -mattr=+flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,MESA %s | ||||
; RUN: llc -global-isel -mtriple=amdgcn-- -mcpu=tonga -mattr=+flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,MESA %s | ; RUN: llc -global-isel -mtriple=amdgcn-- -mcpu=tonga -mattr=+flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,MESA %s | ||||
; RUN: llc -global-isel -mtriple=amdgcn-unknown-mesa3d -mattr=+flat-for-global -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s | ; RUN: llc -global-isel -mtriple=amdgcn-unknown-mesa3d -mattr=+flat-for-global -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s | ||||
; RUN: llc -global-isel -mtriple=amdgcn-unknown-mesa3d -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s | ; RUN: llc -global-isel -mtriple=amdgcn-unknown-mesa3d -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s | ||||
declare i32 @llvm.amdgcn.workitem.id.x() #0 | declare i32 @llvm.amdgcn.workitem.id.x() #0 | ||||
declare i32 @llvm.amdgcn.workitem.id.y() #0 | declare i32 @llvm.amdgcn.workitem.id.y() #0 | ||||
declare i32 @llvm.amdgcn.workitem.id.z() #0 | declare i32 @llvm.amdgcn.workitem.id.z() #0 | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | bb1: | ||||
br label %bb2 | br label %bb2 | ||||
bb2: | bb2: | ||||
ret void | ret void | ||||
} | } | ||||
; ALL-LABEL: {{^}}test_workitem_id_x_func: | ; ALL-LABEL: {{^}}test_workitem_id_x_func: | ||||
; ALL: s_waitcnt | ; ALL: s_waitcnt | ||||
; ALL-NEXT: v_and_b32_e32 v2, 0x3ff, v2 | ; HSA-NEXT: v_and_b32_e32 v2, 0x3ff, v31 | ||||
; MESA-NEXT: v_and_b32_e32 v2, 0x3ff, v2 | |||||
define void @test_workitem_id_x_func(i32 addrspace(1)* %out) #1 { | define void @test_workitem_id_x_func(i32 addrspace(1)* %out) #1 { | ||||
%id = call i32 @llvm.amdgcn.workitem.id.x() | %id = call i32 @llvm.amdgcn.workitem.id.x() | ||||
store i32 %id, i32 addrspace(1)* %out | store i32 %id, i32 addrspace(1)* %out | ||||
ret void | ret void | ||||
} | } | ||||
; ALL-LABEL: {{^}}test_workitem_id_y_func: | ; ALL-LABEL: {{^}}test_workitem_id_y_func: | ||||
; ALL: v_lshrrev_b32_e32 v2, 10, v2 | ; HSA: v_lshrrev_b32_e32 v2, 10, v31 | ||||
; ALL-NEXT: v_and_b32_e32 v2, 0x3ff, v2 | ; MESA: v_lshrrev_b32_e32 v2, 10, v2 | ||||
define void @test_workitem_id_y_func(i32 addrspace(1)* %out) #1 { | define void @test_workitem_id_y_func(i32 addrspace(1)* %out) #1 { | ||||
%id = call i32 @llvm.amdgcn.workitem.id.y() | %id = call i32 @llvm.amdgcn.workitem.id.y() | ||||
store i32 %id, i32 addrspace(1)* %out | store i32 %id, i32 addrspace(1)* %out | ||||
ret void | ret void | ||||
} | } | ||||
; ALL-LABEL: {{^}}test_workitem_id_z_func: | ; ALL-LABEL: {{^}}test_workitem_id_z_func: | ||||
; ALL: v_lshrrev_b32_e32 v2, 20, v2 | ; HSA: v_lshrrev_b32_e32 v2, 20, v31 | ||||
; ALL-NEXT: v_and_b32_e32 v2, 0x3ff, v2 | ; MESA: v_lshrrev_b32_e32 v2, 20, v2 | ||||
define void @test_workitem_id_z_func(i32 addrspace(1)* %out) #1 { | define void @test_workitem_id_z_func(i32 addrspace(1)* %out) #1 { | ||||
%id = call i32 @llvm.amdgcn.workitem.id.z() | %id = call i32 @llvm.amdgcn.workitem.id.z() | ||||
store i32 %id, i32 addrspace(1)* %out | store i32 %id, i32 addrspace(1)* %out | ||||
ret void | ret void | ||||
} | } | ||||
attributes #0 = { nounwind readnone } | attributes #0 = { nounwind readnone } | ||||
attributes #1 = { nounwind } | attributes #1 = { nounwind } |