1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.x() #1 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; SI-LABEL: {{^}}v_cnd_nan_nosgpr: 7*9880d681SAndroid Build Coastguard Worker; SI: v_cndmask_b32_e64 v{{[0-9]}}, v{{[0-9]}}, -1, s{{\[[0-9]+:[0-9]+\]}} 8*9880d681SAndroid Build Coastguard Worker; SI-DAG: v{{[0-9]}} 9*9880d681SAndroid Build Coastguard Worker; All nan values are converted to 0xffffffff 10*9880d681SAndroid Build Coastguard Worker; SI: s_endpgm 11*9880d681SAndroid Build Coastguard Workerdefine void @v_cnd_nan_nosgpr(float addrspace(1)* %out, i32 %c, float addrspace(1)* %fptr) #0 { 12*9880d681SAndroid Build Coastguard Worker %idx = call i32 @llvm.amdgcn.workitem.id.x() #1 13*9880d681SAndroid Build Coastguard Worker %f.gep = getelementptr float, float addrspace(1)* %fptr, i32 %idx 14*9880d681SAndroid Build Coastguard Worker %f = load float, float addrspace(1)* %fptr 15*9880d681SAndroid Build Coastguard Worker %setcc = icmp ne i32 %c, 0 16*9880d681SAndroid Build Coastguard Worker %select = select i1 %setcc, float 0xFFFFFFFFE0000000, float %f 17*9880d681SAndroid Build Coastguard Worker store float %select, float addrspace(1)* %out 18*9880d681SAndroid Build Coastguard Worker ret void 19*9880d681SAndroid Build Coastguard Worker} 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker; This requires slightly trickier SGPR operand legalization since the 23*9880d681SAndroid Build Coastguard Worker; single constant bus SGPR usage is the last operand, and it should 24*9880d681SAndroid Build Coastguard Worker; never be moved. 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker; SI-LABEL: {{^}}v_cnd_nan: 27*9880d681SAndroid Build Coastguard Worker; SI: v_cndmask_b32_e64 v{{[0-9]}}, v{{[0-9]}}, -1, s{{\[[0-9]+:[0-9]+\]}} 28*9880d681SAndroid Build Coastguard Worker; SI-DAG: v{{[0-9]}} 29*9880d681SAndroid Build Coastguard Worker; All nan values are converted to 0xffffffff 30*9880d681SAndroid Build Coastguard Worker; SI: s_endpgm 31*9880d681SAndroid Build Coastguard Workerdefine void @v_cnd_nan(float addrspace(1)* %out, i32 %c, float %f) #0 { 32*9880d681SAndroid Build Coastguard Worker %setcc = icmp ne i32 %c, 0 33*9880d681SAndroid Build Coastguard Worker %select = select i1 %setcc, float 0xFFFFFFFFE0000000, float %f 34*9880d681SAndroid Build Coastguard Worker store float %select, float addrspace(1)* %out 35*9880d681SAndroid Build Coastguard Worker ret void 36*9880d681SAndroid Build Coastguard Worker} 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind } 39*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 40