1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn-amd-amdhsa < %s | FileCheck %s
3
4; FIXME: Inefficient codegen which skips an optimization of load +
5; extractelement when the vector element type is not byte-sized.
6define i1 @extractloadi1(<8 x i1> *%ptr, i32 %idx) {
7; CHECK-LABEL: extractloadi1:
8; CHECK:       ; %bb.0:
9; CHECK-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10; CHECK-NEXT:    flat_load_ubyte v0, v[0:1]
11; CHECK-NEXT:    v_and_b32_e32 v1, 7, v2
12; CHECK-NEXT:    v_lshr_b32_e64 v9, s32, 6
13; CHECK-NEXT:    v_or_b32_e32 v1, v9, v1
14; CHECK-NEXT:    s_waitcnt vmcnt(0) lgkmcnt(0)
15; CHECK-NEXT:    v_bfe_u32 v2, v0, 1, 1
16; CHECK-NEXT:    v_bfe_u32 v3, v0, 2, 2
17; CHECK-NEXT:    v_bfe_u32 v4, v0, 3, 1
18; CHECK-NEXT:    v_lshrrev_b32_e32 v5, 4, v0
19; CHECK-NEXT:    v_bfe_u32 v6, v0, 5, 1
20; CHECK-NEXT:    v_lshrrev_b32_e32 v7, 6, v0
21; CHECK-NEXT:    v_lshrrev_b32_e32 v8, 7, v0
22; CHECK-NEXT:    buffer_store_byte v0, off, s[0:3], s32
23; CHECK-NEXT:    buffer_store_byte v8, off, s[0:3], s32 offset:7
24; CHECK-NEXT:    buffer_store_byte v7, off, s[0:3], s32 offset:6
25; CHECK-NEXT:    buffer_store_byte v6, off, s[0:3], s32 offset:5
26; CHECK-NEXT:    buffer_store_byte v5, off, s[0:3], s32 offset:4
27; CHECK-NEXT:    buffer_store_byte v4, off, s[0:3], s32 offset:3
28; CHECK-NEXT:    buffer_store_byte v3, off, s[0:3], s32 offset:2
29; CHECK-NEXT:    buffer_store_byte v2, off, s[0:3], s32 offset:1
30; CHECK-NEXT:    buffer_load_ubyte v0, v1, s[0:3], 0 offen
31; CHECK-NEXT:    s_waitcnt vmcnt(0)
32; CHECK-NEXT:    s_setpc_b64 s[30:31]
33  %val = load <8 x i1>, <8 x i1> *%ptr
34  %ret = extractelement <8 x i1> %val, i32 %idx
35  ret i1 %ret
36}
37