vec-perm-14.ll
3.2 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
;
; Test that only one vperm of the vector compare is needed for both extracts.
define void @fun() {
; CHECK-LABEL: fun:
; CHECK: vperm
; CHECK-NOT: vperm
bb:
%tmp = load <4 x i8>, <4 x i8>* undef
%tmp1 = icmp eq <4 x i8> zeroinitializer, %tmp
%tmp2 = extractelement <4 x i1> %tmp1, i32 0
br i1 %tmp2, label %bb1, label %bb2
bb1:
unreachable
bb2:
%tmp3 = extractelement <4 x i1> %tmp1, i32 1
br i1 %tmp3, label %bb3, label %bb4
bb3:
unreachable
bb4:
unreachable
}
; Test that a zero index in the permute vector is used instead of VGBM, with
; a zero index into the other source operand.
define <4 x i8> @fun1(<2 x i8> %arg) {
; CHECK-LABEL:.LCPI1_0:
; CHECK-NEXT: .byte 1 # 0x1
; CHECK-NEXT: .byte 18 # 0x12
; CHECK-NEXT: .byte 0 # 0x0
; CHECK-NEXT: .byte 18 # 0x12
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .text
; CHECK-NEXT: .globl fun1
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .type fun1,@function
; CHECK-NEXT: fun1: # @fun1
; CHECK-NEXT: .cfi_startproc
; CHECK-NEXT: # %bb.0:
; CHECK-NEXT: larl %r1, .LCPI1_0
; CHECK-NEXT: vl %v0, 0(%r1), 3
; CHECK-NEXT: vperm %v24, %v24, %v0, %v0
; CHECK-NEXT: br %r14
%res = shufflevector <2 x i8> %arg, <2 x i8> zeroinitializer,
<4 x i32> <i32 1, i32 2, i32 0, i32 3>
ret <4 x i8> %res
}
; Same, but with the first byte indexing into an element of the zero vector.
define <4 x i8> @fun2(<2 x i8> %arg) {
; CHECK-LABEL:.LCPI2_0:
; CHECK-NEXT: .byte 0 # 0x0
; CHECK-NEXT: .byte 17 # 0x11
; CHECK-NEXT: .byte 17 # 0x11
; CHECK-NEXT: .byte 0 # 0x0
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .space 1
; CHECK-NEXT: .text
; CHECK-NEXT: .globl fun2
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .type fun2,@function
; CHECK-NEXT:fun2: # @fun2
; CHECK-NEXT: .cfi_startproc
; CHECK-NEXT:# %bb.0:
; CHECK-NEXT: larl %r1, .LCPI2_0
; CHECK-NEXT: vl %v0, 0(%r1), 3
; CHECK-NEXT: vperm %v24, %v0, %v24, %v0
; CHECK-NEXT: br %r14
%res = shufflevector <2 x i8> %arg, <2 x i8> zeroinitializer,
<4 x i32> <i32 3, i32 1, i32 1, i32 2>
ret <4 x i8> %res
}