; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GFX6 %s
; RUN: llc -mtriple=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefix=GFX8 %s


define amdgpu_kernel void @any_extend_vector_inreg_v16i8_to_v4i32(ptr addrspace(1) nocapture readonly %arg, ptr addrspace(1) %arg1) local_unnamed_addr #0 {
; GFX6-LABEL: any_extend_vector_inreg_v16i8_to_v4i32:
; GFX6:       ; %bb.0: ; %bb
; GFX6-NEXT:    s_load_dwordx4 s[12:15], s[4:5], 0x9
; GFX6-NEXT:    s_mov_b32 s3, 0xf000
; GFX6-NEXT:    s_mov_b32 s2, -1
; GFX6-NEXT:    v_mov_b32_e32 v0, 0
; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
; GFX6-NEXT:    s_mov_b32 s0, s14
; GFX6-NEXT:    s_mov_b32 s1, s15
; GFX6-NEXT:    s_load_dwordx8 s[4:11], s[12:13], 0x0
; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
; GFX6-NEXT:    s_load_dword s4, s[12:13], 0x8
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:13
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:15
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:14
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:8
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:11
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:10
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:4
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:6
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:1
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:3
; GFX6-NEXT:    s_lshr_b32 s8, s9, 16
; GFX6-NEXT:    s_waitcnt expcnt(0)
; GFX6-NEXT:    v_mov_b32_e32 v0, s6
; GFX6-NEXT:    s_waitcnt lgkmcnt(0)
; GFX6-NEXT:    s_lshl_b64 s[6:7], s[4:5], 8
; GFX6-NEXT:    v_mov_b32_e32 v1, s11
; GFX6-NEXT:    buffer_store_byte v1, off, s[0:3], 0 offset:9
; GFX6-NEXT:    s_waitcnt expcnt(0)
; GFX6-NEXT:    v_mov_b32_e32 v1, s5
; GFX6-NEXT:    buffer_store_byte v1, off, s[0:3], 0 offset:2
; GFX6-NEXT:    v_alignbit_b32 v0, s8, v0, 16
; GFX6-NEXT:    s_waitcnt expcnt(0)
; GFX6-NEXT:    v_mov_b32_e32 v1, s7
; GFX6-NEXT:    buffer_store_byte v1, off, s[0:3], 0 offset:12
; GFX6-NEXT:    s_waitcnt expcnt(0)
; GFX6-NEXT:    v_lshrrev_b32_e32 v1, 8, v0
; GFX6-NEXT:    v_lshrrev_b32_e32 v0, 24, v0
; GFX6-NEXT:    buffer_store_byte v1, off, s[0:3], 0 offset:5
; GFX6-NEXT:    buffer_store_byte v0, off, s[0:3], 0 offset:7
; GFX6-NEXT:    s_endpgm
;
; GFX8-LABEL: any_extend_vector_inreg_v16i8_to_v4i32:
; GFX8:       ; %bb.0: ; %bb
; GFX8-NEXT:    s_load_dwordx4 s[8:11], s[4:5], 0x24
; GFX8-NEXT:    v_mov_b32_e32 v2, 0
; GFX8-NEXT:    s_waitcnt lgkmcnt(0)
; GFX8-NEXT:    s_load_dwordx8 s[0:7], s[8:9], 0x0
; GFX8-NEXT:    s_waitcnt lgkmcnt(0)
; GFX8-NEXT:    s_load_dword s0, s[8:9], 0x20
; GFX8-NEXT:    s_lshr_b32 s6, s5, 24
; GFX8-NEXT:    s_lshr_b32 s8, s2, 24
; GFX8-NEXT:    s_waitcnt lgkmcnt(0)
; GFX8-NEXT:    s_lshl_b64 s[2:3], s[0:1], 8
; GFX8-NEXT:    s_add_u32 s4, s10, 13
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 15
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 14
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 8
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 11
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 10
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 4
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 6
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 1
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    v_mov_b32_e32 v0, s10
; GFX8-NEXT:    v_mov_b32_e32 v1, s11
; GFX8-NEXT:    s_add_u32 s4, s10, 3
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    s_add_u32 s4, s10, 9
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    v_mov_b32_e32 v2, s7
; GFX8-NEXT:    s_add_u32 s4, s10, 2
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s5, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s4
; GFX8-NEXT:    v_mov_b32_e32 v1, s5
; GFX8-NEXT:    v_mov_b32_e32 v2, s1
; GFX8-NEXT:    s_add_u32 s0, s10, 5
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s1, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s0
; GFX8-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-NEXT:    v_mov_b32_e32 v2, s8
; GFX8-NEXT:    s_add_u32 s0, s10, 12
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s1, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s0
; GFX8-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-NEXT:    v_mov_b32_e32 v2, s3
; GFX8-NEXT:    s_add_u32 s0, s10, 7
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_addc_u32 s1, s11, 0
; GFX8-NEXT:    v_mov_b32_e32 v0, s0
; GFX8-NEXT:    v_mov_b32_e32 v1, s1
; GFX8-NEXT:    v_mov_b32_e32 v2, s6
; GFX8-NEXT:    flat_store_byte v[0:1], v2
; GFX8-NEXT:    s_endpgm
bb:
  %tmp2 = load <16 x i8>, ptr addrspace(1) %arg, align 16
  %tmp3 = extractelement <16 x i8> %tmp2, i64 4
  %tmp6 = extractelement <16 x i8> %tmp2, i64 11
  %tmp10 = getelementptr inbounds <8 x i8>, ptr addrspace(1) %arg, i64 2
  %tmp12 = load <16 x i8>, ptr addrspace(1) %tmp10, align 16
  %tmp13 = extractelement <16 x i8> %tmp12, i64 7
  %tmp17 = extractelement <16 x i8> %tmp12, i64 12
  %tmp21 = getelementptr inbounds <8 x i8>, ptr addrspace(1) %arg, i64 4
  %tmp23 = load <16 x i8>, ptr addrspace(1) %tmp21, align 16
  %tmp24 = extractelement <16 x i8> %tmp23, i64 3
  %tmp1 = insertelement <16 x i8> poison, i8 %tmp3, i32 2
  %tmp4 = insertelement <16 x i8> %tmp1, i8 0, i32 3
  %tmp5 = insertelement <16 x i8> %tmp4, i8 0, i32 4
  %tmp7 = insertelement <16 x i8> %tmp5, i8 %tmp6, i32 5
  %tmp8 = insertelement <16 x i8> %tmp7, i8 0, i32 6
  %tmp9 = insertelement <16 x i8> %tmp8, i8 %tmp13, i32 7
  %tmp14 = insertelement <16 x i8> %tmp9, i8 0, i32 8
  %tmp15 = insertelement <16 x i8> %tmp14, i8 %tmp17, i32 9
  %tmp16 = insertelement <16 x i8> %tmp15, i8 0, i32 10
  %tmp18 = insertelement <16 x i8> %tmp16, i8 0, i32 11
  %tmp19 = insertelement <16 x i8> %tmp18, i8 %tmp24, i32 12
  store <16 x i8> %tmp19, ptr addrspace(1) %arg1, align 1
  ret void
}

attributes #0 = { nounwind }
