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