1; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN-OPT %s
2; RUN: llc -march=amdgcn -mcpu=fiji -O0 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GCN-NOOPT %s
3
4; GCN-LABEL: {{^}}scalar_to_vector_i16:
5; GCN-NOOPT: s_mov_b32 [[S:s[0-9]+]], 42
6; GCN-NOOPT: v_mov_b32_e32 [[V:v[0-9]+]], [[S]]
7; GCN-OPT:   v_mov_b32_e32 [[V:v[0-9]+]], 42
8; GCN: buffer_store_short [[V]],
9define void @scalar_to_vector_i16() {
10  %tmp = load <2 x i16>, <2 x i16> addrspace(5)* undef
11  %tmp1 = insertelement <2 x i16> %tmp, i16 42, i64 0
12  store <2 x i16> %tmp1, <2 x i16> addrspace(5)* undef
13  ret void
14}
15
16; GCN-LABEL: {{^}}scalar_to_vector_f16:
17; GCN-NOOPT: s_movk_i32 [[S:s[0-9]+]], 0x3c00
18; GCN-NOOPT: v_mov_b32_e32 [[V:v[0-9]+]], [[S]]
19; GCN-OPT:   v_mov_b32_e32 [[V:v[0-9]+]], 0x3c00
20; GCN: buffer_store_short [[V]],
21define void @scalar_to_vector_f16() {
22  %tmp = load <2 x half>, <2 x half> addrspace(5)* undef
23  %tmp1 = insertelement <2 x half> %tmp, half 1.0, i64 0
24  store <2 x half> %tmp1, <2 x half> addrspace(5)* undef
25  ret void
26}
27