1; RUN: llc < %s -o - -mcpu=generic -march=x86-64 -mattr=+sse4.1 | FileCheck %s -check-prefix=SSE41
2; RUN: llc < %s -o - -mcpu=generic -march=x86-64 -mattr=+avx | FileCheck %s -check-prefix=AVX
3
4; CHECK-LABEL: extract_i8
5define void @extract_i8(i8* nocapture %dst, <16 x i8> %foo) {
6; AVX: vpextrb
7; SSE41: pextrb
8; AVX-NOT: movb
9; SSE41-NOT: movb
10  %vecext = extractelement <16 x i8> %foo, i32 15
11  store i8 %vecext, i8* %dst, align 1
12  ret void
13}
14
15; CHECK-LABEL: extract_i16
16define void @extract_i16(i16* nocapture %dst, <8 x i16> %foo) {
17; AVX: vpextrw
18; SSE41: pextrw
19; AVX-NOT: movw
20; SSE41-NOT: movw
21  %vecext = extractelement <8 x i16> %foo, i32 7
22  store i16 %vecext, i16* %dst, align 1
23  ret void
24}
25
26; CHECK-LABEL: extract_i8_undef
27define void @extract_i8_undef(i8* nocapture %dst, <16 x i8> %foo) {
28; AVX-NOT: vpextrb
29; SSE41-NOT: pextrb
30; AVX-NOT: movb
31; SSE41-NOT: movb
32  %vecext = extractelement <16 x i8> %foo, i32 16 ; undef
33  store i8 %vecext, i8* %dst, align 1
34  ret void
35}
36
37; CHECK-LABEL: extract_i16_undef
38define void @extract_i16_undef(i16* nocapture %dst, <8 x i16> %foo) {
39; AVX-NOT: vpextrw
40; SSE41-NOT: pextrw
41; AVX-NOT: movw
42; SSE41-NOT: movw
43  %vecext = extractelement <8 x i16> %foo, i32 9 ; undef
44  store i16 %vecext, i16* %dst, align 1
45  ret void
46}
47