• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=x86_64-pc-linux             | FileCheck %s -check-prefix=X64
2; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+avx | FileCheck %s -check-prefix=AVX
3
4
5; CHECK-LABEL: extractelement_index_1:
6define i8 @extractelement_index_1(<32 x i8> %a) nounwind {
7  ; X64:       movaps
8  ; AVX:       vpextrb $1
9  %b = extractelement <32 x i8> %a, i256 1
10  ret i8 %b
11}
12
13; CHECK-LABEL: extractelement_index_2:
14define i32 @extractelement_index_2(<8 x i32> %a) nounwind {
15  ; X64:       pshufd
16  ; AVX:       vextractf128 $1
17  ; AVX-NEXT:  vpextrd      $3
18  %b = extractelement <8 x i32> %a, i64 7
19  ret i32 %b
20}
21
22; CHECK-LABEL: extractelement_index_3:
23define i32 @extractelement_index_3(<8 x i32> %a) nounwind {
24  ; CHECK-NOT: pextr
25  %b = extractelement <8 x i32> %a, i64 15
26  ret i32 %b
27}
28
29; CHECK-LABEL: extractelement_index_4:
30define i32 @extractelement_index_4(<8 x i32> %a) nounwind {
31  ; X64:       movd
32  ; AVX:       vextractf128 $1
33  ; AVX-NEXT:  vmovd
34  %b = extractelement <8 x i32> %a, i256 4
35  ret i32 %b
36}
37
38; CHECK-LABEL: extractelement_index_5:
39define i8 @extractelement_index_5(<32 x i8> %a, i256 %i) nounwind {
40  ; X64:       movaps
41  ; AVX:       vmovaps
42  %b = extractelement <32 x i8> %a, i256 %i
43  ret i8 %b
44}
45
46; CHECK-LABEL: extractelement_index_6:
47define i8 @extractelement_index_6(<32 x i8> %a) nounwind {
48  ; CHECK-NOT: pextr
49  %b = extractelement <32 x i8> %a, i256 -1
50  ret i8 %b
51}