1 ; RUN: llc < %s -march=amdgcn -mcpu=tahiti -verify-machineinstrs | FileCheck -check-prefix=GCN %s
2 ; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck -check-prefix=GCN %s
4 ; GCN-LABEL: {{^}}select0:
5 ; i64 select should be split into two i32 selects, and we shouldn't need
6 ; to use a shfit to extract the hi dword of the input.
10 define amdgpu_kernel void @select0(ptr addrspace(1) %out, i32 %cond, i64 %in) {
12 %0 = icmp ugt i32 %cond, 5
13 %1 = select i1 %0, i64 0, i64 %in
14 store i64 %1, ptr addrspace(1) %out
18 ; GCN-LABEL: {{^}}select_trunc_i64:
20 ; GCN-NOT: s_cselect_b32
21 define amdgpu_kernel void @select_trunc_i64(ptr addrspace(1) %out, i32 %cond, i64 %in) nounwind {
22 %cmp = icmp ugt i32 %cond, 5
23 %sel = select i1 %cmp, i64 0, i64 %in
24 %trunc = trunc i64 %sel to i32
25 store i32 %trunc, ptr addrspace(1) %out, align 4
29 ; GCN-LABEL: {{^}}select_trunc_i64_2:
31 ; GCN-NOT: s_cselect_b32
32 define amdgpu_kernel void @select_trunc_i64_2(ptr addrspace(1) %out, i32 %cond, i64 %a, i64 %b) nounwind {
33 %cmp = icmp ugt i32 %cond, 5
34 %sel = select i1 %cmp, i64 %a, i64 %b
35 %trunc = trunc i64 %sel to i32
36 store i32 %trunc, ptr addrspace(1) %out, align 4
40 ; GCN-LABEL: {{^}}v_select_trunc_i64_2:
42 ; GCN-NOT: s_cselect_b32
43 define amdgpu_kernel void @v_select_trunc_i64_2(ptr addrspace(1) %out, i32 %cond, ptr addrspace(1) %aptr, ptr addrspace(1) %bptr) nounwind {
44 %cmp = icmp ugt i32 %cond, 5
45 %a = load i64, ptr addrspace(1) %aptr, align 8
46 %b = load i64, ptr addrspace(1) %bptr, align 8
47 %sel = select i1 %cmp, i64 %a, i64 %b
48 %trunc = trunc i64 %sel to i32
49 store i32 %trunc, ptr addrspace(1) %out, align 4
53 ; GCN-LABEL: {{^}}v_select_i64_split_imm:
54 ; GCN-DAG: s_cselect_b32
55 ; GCN-DAG: s_cselect_b32
57 define 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, 5
59 %a = load i64, ptr addrspace(1) %aptr, align 8
60 %b = load i64, ptr addrspace(1) %bptr, align 8
61 %sel = select i1 %cmp, i64 %a, i64 270582939648 ; 63 << 32
62 store i64 %sel, ptr addrspace(1) %out, align 8