1 ; RUN: llc < %s -march=amdgcn -mcpu=SI -verify-machineinstrs | FileCheck %s
3 ; CHECK-LABEL: {{^}}select0:
4 ; i64 select should be split into two i32 selects, and we shouldn't need
5 ; to use a shfit to extract the hi dword of the input.
6 ; CHECK-NOT: s_lshr_b64
9 define void @select0(i64 addrspace(1)* %out, i32 %cond, i64 %in) {
11 %0 = icmp ugt i32 %cond, 5
12 %1 = select i1 %0, i64 0, i64 %in
13 store i64 %1, i64 addrspace(1)* %out
17 ; CHECK-LABEL: {{^}}select_trunc_i64:
18 ; CHECK: v_cndmask_b32
19 ; CHECK-NOT: v_cndmask_b32
20 define void @select_trunc_i64(i32 addrspace(1)* %out, i32 %cond, i64 %in) nounwind {
21 %cmp = icmp ugt i32 %cond, 5
22 %sel = select i1 %cmp, i64 0, i64 %in
23 %trunc = trunc i64 %sel to i32
24 store i32 %trunc, i32 addrspace(1)* %out, align 4
28 ; CHECK-LABEL: {{^}}select_trunc_i64_2:
29 ; CHECK: v_cndmask_b32
30 ; CHECK-NOT: v_cndmask_b32
31 define void @select_trunc_i64_2(i32 addrspace(1)* %out, i32 %cond, i64 %a, i64 %b) nounwind {
32 %cmp = icmp ugt i32 %cond, 5
33 %sel = select i1 %cmp, i64 %a, i64 %b
34 %trunc = trunc i64 %sel to i32
35 store i32 %trunc, i32 addrspace(1)* %out, align 4
39 ; CHECK-LABEL: {{^}}v_select_trunc_i64_2:
40 ; CHECK: v_cndmask_b32
41 ; CHECK-NOT: v_cndmask_b32
42 define void @v_select_trunc_i64_2(i32 addrspace(1)* %out, i32 %cond, i64 addrspace(1)* %aptr, i64 addrspace(1)* %bptr) nounwind {
43 %cmp = icmp ugt i32 %cond, 5
44 %a = load i64 addrspace(1)* %aptr, align 8
45 %b = load i64 addrspace(1)* %bptr, align 8
46 %sel = select i1 %cmp, i64 %a, i64 %b
47 %trunc = trunc i64 %sel to i32
48 store i32 %trunc, i32 addrspace(1)* %out, align 4