1; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
3
4
5; SI-LABEL: {{^}}global_truncstore_i32_to_i1:
6; SI: s_load_dword [[LOAD:s[0-9]+]],
7; SI: s_and_b32 [[SREG:s[0-9]+]], [[LOAD]], 1
8; SI: v_mov_b32_e32 [[VREG:v[0-9]+]], [[SREG]]
9; SI: buffer_store_byte [[VREG]],
10define void @global_truncstore_i32_to_i1(i1 addrspace(1)* %out, i32 %val) nounwind {
11  %trunc = trunc i32 %val to i1
12  store i1 %trunc, i1 addrspace(1)* %out, align 1
13  ret void
14}
15
16; SI-LABEL: {{^}}global_truncstore_i64_to_i1:
17; SI: buffer_store_byte
18define void @global_truncstore_i64_to_i1(i1 addrspace(1)* %out, i64 %val) nounwind {
19  %trunc = trunc i64 %val to i1
20  store i1 %trunc, i1 addrspace(1)* %out, align 1
21  ret void
22}
23
24; SI-LABEL: {{^}}global_truncstore_i16_to_i1:
25; SI: s_load_dword [[LOAD:s[0-9]+]],
26; SI: s_and_b32 [[SREG:s[0-9]+]], [[LOAD]], 1
27; SI: v_mov_b32_e32 [[VREG:v[0-9]+]], [[SREG]]
28; SI: buffer_store_byte [[VREG]],
29define void @global_truncstore_i16_to_i1(i1 addrspace(1)* %out, i16 %val) nounwind {
30  %trunc = trunc i16 %val to i1
31  store i1 %trunc, i1 addrspace(1)* %out, align 1
32  ret void
33}
34