3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
6 define <16 x i8> @f1(<16 x i8> %val) {
8 ; CHECK: vlpb %v24, %v24
10 %cmp = icmp slt <16 x i8> %val, zeroinitializer
11 %neg = sub <16 x i8> zeroinitializer, %val
12 %ret = select <16 x i1> %cmp, <16 x i8> %neg, <16 x i8> %val
17 define <16 x i8> @f2(<16 x i8> %val) {
19 ; CHECK: vlpb %v24, %v24
21 %cmp = icmp sle <16 x i8> %val, zeroinitializer
22 %neg = sub <16 x i8> zeroinitializer, %val
23 %ret = select <16 x i1> %cmp, <16 x i8> %neg, <16 x i8> %val
28 define <16 x i8> @f3(<16 x i8> %val) {
30 ; CHECK: vlpb %v24, %v24
32 %cmp = icmp sgt <16 x i8> %val, zeroinitializer
33 %neg = sub <16 x i8> zeroinitializer, %val
34 %ret = select <16 x i1> %cmp, <16 x i8> %val, <16 x i8> %neg
39 define <16 x i8> @f4(<16 x i8> %val) {
41 ; CHECK: vlpb %v24, %v24
43 %cmp = icmp sge <16 x i8> %val, zeroinitializer
44 %neg = sub <16 x i8> zeroinitializer, %val
45 %ret = select <16 x i1> %cmp, <16 x i8> %val, <16 x i8> %neg
49 ; Test that negative absolute uses VLPB too. There is no vector equivalent
51 define <16 x i8> @f5(<16 x i8> %val) {
53 ; CHECK: vlpb [[REG:%v[0-9]+]], %v24
54 ; CHECK: vlcb %v24, [[REG]]
56 %cmp = icmp slt <16 x i8> %val, zeroinitializer
57 %neg = sub <16 x i8> zeroinitializer, %val
58 %abs = select <16 x i1> %cmp, <16 x i8> %neg, <16 x i8> %val
59 %ret = sub <16 x i8> zeroinitializer, %abs
63 ; Try another form of negative absolute (slt version).
64 define <16 x i8> @f6(<16 x i8> %val) {
66 ; CHECK: vlpb [[REG:%v[0-9]+]], %v24
67 ; CHECK: vlcb %v24, [[REG]]
69 %cmp = icmp slt <16 x i8> %val, zeroinitializer
70 %neg = sub <16 x i8> zeroinitializer, %val
71 %ret = select <16 x i1> %cmp, <16 x i8> %val, <16 x i8> %neg
76 define <16 x i8> @f7(<16 x i8> %val) {
78 ; CHECK: vlpb [[REG:%v[0-9]+]], %v24
79 ; CHECK: vlcb %v24, [[REG]]
81 %cmp = icmp sle <16 x i8> %val, zeroinitializer
82 %neg = sub <16 x i8> zeroinitializer, %val
83 %ret = select <16 x i1> %cmp, <16 x i8> %val, <16 x i8> %neg
88 define <16 x i8> @f8(<16 x i8> %val) {
90 ; CHECK: vlpb [[REG:%v[0-9]+]], %v24
91 ; CHECK: vlcb %v24, [[REG]]
93 %cmp = icmp sgt <16 x i8> %val, zeroinitializer
94 %neg = sub <16 x i8> zeroinitializer, %val
95 %ret = select <16 x i1> %cmp, <16 x i8> %neg, <16 x i8> %val
100 define <16 x i8> @f9(<16 x i8> %val) {
102 ; CHECK: vlpb [[REG:%v[0-9]+]], %v24
103 ; CHECK: vlcb %v24, [[REG]]
105 %cmp = icmp sge <16 x i8> %val, zeroinitializer
106 %neg = sub <16 x i8> zeroinitializer, %val
107 %ret = select <16 x i1> %cmp, <16 x i8> %neg, <16 x i8> %val
111 ; Test with an SRA-based boolean vector.
112 define <16 x i8> @f10(<16 x i8> %val) {
114 ; CHECK: vlpb %v24, %v24
116 %shr = ashr <16 x i8> %val,
117 <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,
118 i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
119 %neg = sub <16 x i8> zeroinitializer, %val
120 %and1 = and <16 x i8> %shr, %neg
121 %not = xor <16 x i8> %shr,
122 <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
123 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
124 %and2 = and <16 x i8> %not, %val
125 %ret = or <16 x i8> %and1, %and2
129 ; ...and again in reverse
130 define <16 x i8> @f11(<16 x i8> %val) {
132 ; CHECK: vlpb [[REG:%v[0-9]+]], %v24
133 ; CHECK: vlcb %v24, [[REG]]
135 %shr = ashr <16 x i8> %val,
136 <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7,
137 i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
138 %and1 = and <16 x i8> %shr, %val
139 %not = xor <16 x i8> %shr,
140 <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1,
141 i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
142 %neg = sub <16 x i8> zeroinitializer, %val
143 %and2 = and <16 x i8> %not, %neg
144 %ret = or <16 x i8> %and1, %and2