1 ; RUN: llc < %s -march=amdgcn -mcpu=tahiti -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s
4 ; CHECK-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.
7 ; CHECK-NOT: s_lshr_b64
10 define amdgpu_kernel void @select0(i64 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, i64 addrspace(1)* %out
18 ; CHECK-LABEL: {{^}}select_trunc_i64:
19 ; CHECK: v_cndmask_b32
20 ; CHECK-NOT: v_cndmask_b32
21 define amdgpu_kernel void @select_trunc_i64(i32 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, i32 addrspace(1)* %out, align 4
29 ; CHECK-LABEL: {{^}}select_trunc_i64_2:
30 ; CHECK: v_cndmask_b32
31 ; CHECK-NOT: v_cndmask_b32
32 define amdgpu_kernel void @select_trunc_i64_2(i32 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, i32 addrspace(1)* %out, align 4
40 ; CHECK-LABEL: {{^}}v_select_trunc_i64_2:
41 ; CHECK: v_cndmask_b32
42 ; CHECK-NOT: v_cndmask_b32
43 define amdgpu_kernel void @v_select_trunc_i64_2(i32 addrspace(1)* %out, i32 %cond, i64 addrspace(1)* %aptr, i64 addrspace(1)* %bptr) nounwind {
44 %cmp = icmp ugt i32 %cond, 5
45 %a = load i64, i64 addrspace(1)* %aptr, align 8
46 %b = load i64, i64 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, i32 addrspace(1)* %out, align 4
53 ; CHECK-LABEL: {{^}}v_select_i64_split_imm:
54 ; CHECK-DAG: v_cndmask_b32_e32 {{v[0-9]+}}, 0, {{v[0-9]+}}
55 ; CHECK-DAG: v_cndmask_b32_e32 {{v[0-9]+}}, 63, {{v[0-9]+}}
57 define amdgpu_kernel void @v_select_i64_split_imm(i64 addrspace(1)* %out, i32 %cond, i64 addrspace(1)* %aptr, i64 addrspace(1)* %bptr) nounwind {
58 %cmp = icmp ugt i32 %cond, 5
59 %a = load i64, i64 addrspace(1)* %aptr, align 8
60 %b = load i64, i64 addrspace(1)* %bptr, align 8
61 %sel = select i1 %cmp, i64 %a, i64 270582939648 ; 63 << 32
62 store i64 %sel, i64 addrspace(1)* %out, align 8