65 lines · plain
1; RUN: llc < %s -mtriple=amdgcn -mcpu=tahiti | FileCheck -check-prefix=GCN %s2; RUN: llc < %s -mtriple=amdgcn -mcpu=tonga | FileCheck -check-prefix=GCN %s3 4; GCN-LABEL: {{^}}select0:5; i64 select should be split into two i32 selects, and we shouldn't need6; to use a shfit to extract the hi dword of the input.7; GCN-NOT: s_lshr_b648; GCN: s_cselect_b329; GCN: s_cselect_b3210define amdgpu_kernel void @select0(ptr addrspace(1) %out, i32 %cond, i64 %in) {11entry:12 %0 = icmp ugt i32 %cond, 513 %1 = select i1 %0, i64 0, i64 %in14 store i64 %1, ptr addrspace(1) %out15 ret void16}17 18; GCN-LABEL: {{^}}select_trunc_i64:19; GCN: s_cselect_b3220; GCN-NOT: s_cselect_b3221define amdgpu_kernel void @select_trunc_i64(ptr addrspace(1) %out, i32 %cond, i64 %in) nounwind {22 %cmp = icmp ugt i32 %cond, 523 %sel = select i1 %cmp, i64 0, i64 %in24 %trunc = trunc i64 %sel to i3225 store i32 %trunc, ptr addrspace(1) %out, align 426 ret void27}28 29; GCN-LABEL: {{^}}select_trunc_i64_2:30; GCN: s_cselect_b3231; GCN-NOT: s_cselect_b3232define amdgpu_kernel void @select_trunc_i64_2(ptr addrspace(1) %out, i32 %cond, i64 %a, i64 %b) nounwind {33 %cmp = icmp ugt i32 %cond, 534 %sel = select i1 %cmp, i64 %a, i64 %b35 %trunc = trunc i64 %sel to i3236 store i32 %trunc, ptr addrspace(1) %out, align 437 ret void38}39 40; GCN-LABEL: {{^}}v_select_trunc_i64_2:41; GCN: s_cselect_b3242; GCN-NOT: s_cselect_b3243define amdgpu_kernel void @v_select_trunc_i64_2(ptr addrspace(1) %out, i32 %cond, ptr addrspace(1) %aptr, ptr addrspace(4) %bptr) nounwind {44 %cmp = icmp ugt i32 %cond, 545 %a = load i64, ptr addrspace(1) %aptr, align 846 %b = load i64, ptr addrspace(4) %bptr, align 847 %sel = select i1 %cmp, i64 %a, i64 %b48 %trunc = trunc i64 %sel to i3249 store i32 %trunc, ptr addrspace(1) %out, align 450 ret void51}52 53; GCN-LABEL: {{^}}v_select_i64_split_imm:54; GCN-DAG: s_cselect_b3255; GCN-DAG: s_cselect_b3256; GCN: s_endpgm57define amdgpu_kernel void @v_select_i64_split_imm(ptr addrspace(1) %out, i32 %cond, ptr addrspace(1) %aptr, ptr addrspace(1) %bptr) nounwind {58 %cmp = icmp ugt i32 %cond, 559 %a = load i64, ptr addrspace(1) %aptr, align 860 %b = load i64, ptr addrspace(1) %bptr, align 861 %sel = select i1 %cmp, i64 %a, i64 270582939648 ; 63 << 3262 store i64 %sel, ptr addrspace(1) %out, align 863 ret void64}65