1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "gtest/gtest.h"
18 
19 #include <cstdint>
20 #include <cstdlib>
21 #include <cstring>
22 #include <iomanip>
23 #include <iostream>
24 #include <tuple>
25 #include <utility>
26 
27 namespace {
28 
29 template <typename T>
BitUtilLog2(T x)30 constexpr T BitUtilLog2(T x) {
31   return __builtin_ctz(x);
32 }
33 
34 using uint8_16_t = std::tuple<uint8_t,
35                               uint8_t,
36                               uint8_t,
37                               uint8_t,
38                               uint8_t,
39                               uint8_t,
40                               uint8_t,
41                               uint8_t,
42                               uint8_t,
43                               uint8_t,
44                               uint8_t,
45                               uint8_t,
46                               uint8_t,
47                               uint8_t,
48                               uint8_t,
49                               uint8_t>;
50 using uint16_8_t =
51     std::tuple<uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t>;
52 using uint32_4_t = std::tuple<uint32_t, uint32_t, uint32_t, uint32_t>;
53 using uint64_2_t = std::tuple<uint64_t, uint64_t>;
54 
55 enum PrintModeEndianess { kLittleEndian, kBigEndian };
56 
57 // A wrapper around __uint128 which can be constructed from a pair of uint64_t literals.
58 class SIMD128 {
59  public:
SIMD128()60   SIMD128(){};
61 
SIMD128(uint8_16_t u8)62   constexpr SIMD128(uint8_16_t u8) : uint8_{u8} {};
SIMD128(uint16_8_t u16)63   constexpr SIMD128(uint16_8_t u16) : uint16_{u16} {};
SIMD128(uint32_4_t u32)64   constexpr SIMD128(uint32_4_t u32) : uint32_{u32} {};
SIMD128(uint64_2_t u64)65   constexpr SIMD128(uint64_2_t u64) : uint64_{u64} {};
SIMD128(__int128_t i128)66   constexpr SIMD128(__int128_t i128) : i128_{i128} {};
SIMD128(uint8_t u128)67   constexpr SIMD128(uint8_t u128) : u128_{u128} {};
SIMD128(uint16_t u128)68   constexpr SIMD128(uint16_t u128) : u128_{u128} {};
SIMD128(uint32_t u128)69   constexpr SIMD128(uint32_t u128) : u128_{u128} {};
SIMD128(uint64_t u128)70   constexpr SIMD128(uint64_t u128) : u128_{u128} {};
SIMD128(__uint128_t u128)71   constexpr SIMD128(__uint128_t u128) : u128_{u128} {};
72 
Get() const73   [[nodiscard]] constexpr __uint128_t Get() const { return u128_; }
74 
operator =(const SIMD128 & other)75   constexpr SIMD128& operator=(const SIMD128& other) {
76     u128_ = other.u128_;
77     return *this;
78   };
operator |=(const SIMD128 & other)79   constexpr SIMD128& operator|=(const SIMD128& other) {
80     u128_ |= other.u128_;
81     return *this;
82   }
83 
operator ==(const SIMD128 & other) const84   constexpr bool operator==(const SIMD128& other) const { return u128_ == other.u128_; }
operator !=(const SIMD128 & other) const85   constexpr bool operator!=(const SIMD128& other) const { return u128_ != other.u128_; }
operator >>(size_t shift_amount) const86   constexpr SIMD128 operator>>(size_t shift_amount) const { return u128_ >> shift_amount; }
operator <<(size_t shift_amount) const87   constexpr SIMD128 operator<<(size_t shift_amount) const { return u128_ << shift_amount; }
operator &(SIMD128 other) const88   constexpr SIMD128 operator&(SIMD128 other) const { return u128_ & other.u128_; }
operator |(SIMD128 other) const89   constexpr SIMD128 operator|(SIMD128 other) const { return u128_ | other.u128_; }
operator ^(SIMD128 other) const90   constexpr SIMD128 operator^(SIMD128 other) const { return u128_ ^ other.u128_; }
operator ~() const91   constexpr SIMD128 operator~() const { return ~u128_; }
92   friend std::ostream& operator<<(std::ostream& os, const SIMD128& simd);
93 
94   template <size_t N>
Print(std::ostream & os) const95   std::ostream& Print(std::ostream& os) const {
96     if constexpr (kSimd128PrintMode == kBigEndian) {
97       os << std::uppercase << std::hex << std::setw(4) << std::setfill('0') << std::get<N>(uint16_);
98       if constexpr (N > 0) {
99         os << '\'';
100       }
101     } else {
102       os << std::uppercase << std::hex << std::setw(2) << std::setfill('0')
103          << static_cast<int>(std::get<N * 2>(uint8_));
104       os << std::uppercase << std::hex << std::setw(2) << std::setfill('0')
105          << static_cast<int>(std::get<N * 2 + 1>(uint8_));
106       if constexpr (N < 7) {
107         os << '\'';
108       }
109     }
110     return os;
111   }
112 
113   template <size_t... N>
PrintEach(std::ostream & os,std::index_sequence<N...>) const114   std::ostream& PrintEach(std::ostream& os, std::index_sequence<N...>) const {
115     os << "0x";
116     if constexpr (kSimd128PrintMode == kBigEndian) {
117       (Print<7 - N>(os), ...);
118     } else {
119       (Print<N>(os), ...);
120     }
121     return os;
122   }
123 
124  private:
125   union {
126 #ifdef __GNUC__
127     [[gnu::may_alias]] uint8_16_t uint8_;
128     [[gnu::may_alias]] uint16_8_t uint16_;
129     [[gnu::may_alias]] uint32_4_t uint32_;
130     [[gnu::may_alias]] uint64_2_t uint64_;
131     [[gnu::may_alias]] __int128_t i128_;
132     [[gnu::may_alias]] __uint128_t u128_;
133 #endif
134   };
135 
136   // Support for BIG_ENDIAN or LITTLE_ENDIAN printing of SIMD128 values. Change this value
137   // if you want to see failure results in LITTLE_ENDIAN.
138   static constexpr const PrintModeEndianess kSimd128PrintMode = kBigEndian;
139 };
140 
141 // Helps produce easy to read output on failed tests.
operator <<(std::ostream & os,const SIMD128 & simd)142 std::ostream& operator<<(std::ostream& os, const SIMD128& simd) {
143   return simd.PrintEach(os, std::make_index_sequence<8>());
144 }
145 
146 constexpr SIMD128 kVectorCalculationsSourceLegacy[16] = {
147     {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8908}},
148     {{0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9918}},
149     {{0xa726'a524'a322'a120, 0xaf2e'ad2c'ab2a'a928}},
150     {{0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b938}},
151     {{0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948}},
152     {{0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958}},
153     {{0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968}},
154     {{0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
155 
156     {{0x0e0c'0a09'0604'0200, 0x1e1c'1a18'1614'1211}},
157     {{0x2e2c'2a29'2624'2220, 0x3e3c'3a38'3634'3231}},
158     {{0x4e4c'4a49'4644'4240, 0x5e5c'5a58'5654'5251}},
159     {{0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271}},
160     {{0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291}},
161     {{0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1}},
162     {{0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1}},
163     {{0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1}},
164 };
165 
166 constexpr SIMD128 kVectorCalculationsSource[16] = {
167     {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8908}},
168     {{0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9918}},
169     {{0xa726'a524'a322'a120, 0xaf2e'ad2c'ab2a'a928}},
170     {{0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b938}},
171     {{0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948}},
172     {{0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958}},
173     {{0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968}},
174     {{0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
175 
176     {{0x9e0c'9a09'9604'9200, 0x8e1c'8a18'8614'8211}},
177     {{0xbe2c'ba29'b624'b220, 0xae3c'aa38'a634'a231}},
178     {{0xde4c'da49'd644'd240, 0xce5c'ca58'c654'c251}},
179     {{0xfe6c'fa69'f664'f260, 0xee7c'ea78'e674'e271}},
180     {{0x1e8c'1a89'1684'1280, 0x0e9c'0a98'0694'0291}},
181     {{0x3eac'3aa9'36a4'32a0, 0x2ebc'2ab8'26b4'22b1}},
182     {{0x5ecc'5ac9'56c4'52c0, 0x4edc'4ad8'46d4'42d1}},
183     {{0x7eec'7ae9'76e4'72e0, 0x6efc'6af8'66f4'62f1}},
184 };
185 
186 constexpr SIMD128 kVectorComparisonSource[16] = {
187     {{0xf005'f005'f005'f005, 0xffff'ffff'4040'4040}},
188     {{0xffff'ffff'40b4'40b4, 0xffff'ffff'40b4'0000}},
189     {{0x4016'4016'4016'4016, 0x4016'8000'0000'0000}},
190     {{0xaaaa'aaaa'aaaa'aaaa, 0x1111'1111'1111'1111}},
191     {{0xfff4'fff4'fff4'fff4, 0xfff6'fff6'fff6'fff6}},
192     {{0xfff8'fff8'fff4'fff4, 0xfff5'fff5'fff5'fff5}},
193     {{0xa9bb'bbbb'a9bb'bbbb, 0xa9bb'bbbb'a9bb'bbbb}},
194     {{0xa9a9'a9a9'a9a9'a9a9, 0xa9a9'a9a9'a9a9'a9a9}},
195 
196     {{0xf005'f005'f005'f005, 0xffff'ffff'4040'4040}},
197     {{0x1111'1111'1111'1111, 0x1111'1111'1111'1111}},
198     {{0xfff1'fff1'fff1'fff1, 0xfff1'fff1'fff1'fff1}},
199     {{0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271}},
200     {{0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291}},
201     {{0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1}},
202     {{0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1}},
203     {{0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1}},
204 };
205 
206 namespace VXRMFlags {
207 
208 inline constexpr uint64_t RNU = 0b00;
209 inline constexpr uint64_t RNE = 0b01;
210 inline constexpr uint64_t RDN = 0b10;
211 inline constexpr uint64_t ROD = 0b11;
212 
213 }  // namespace VXRMFlags
214 
215 // Easily recognizable bit pattern for target register.
216 constexpr SIMD128 kUndisturbedResult{{0x5555'5555'5555'5555, 0x5555'5555'5555'5555}};
217 
GetAgnosticResult()218 SIMD128 GetAgnosticResult() {
219   static const bool kRvvAgnosticIsUndisturbed = getenv("RVV_AGNOSTIC_IS_UNDISTURBED") != nullptr;
220   if (kRvvAgnosticIsUndisturbed) {
221     return kUndisturbedResult;
222   }
223   return {{~uint64_t{0U}, ~uint64_t{0U}}};
224 }
225 
226 const SIMD128 kAgnosticResult = GetAgnosticResult();
227 
228 // Mask in form suitable for storing in v0 and use in v0.t form.
229 static constexpr SIMD128 kMask{{0xd5ad'd6b5'ad6b'b5ad, 0x6af7'57bb'deed'7bb5}};
230 // Mask used with vsew = 0 (8bit) elements.
231 static constexpr SIMD128 kMaskInt8[8] = {
232     {{255, 0, 255, 255, 0, 255, 0, 255, 255, 0, 255, 0, 255, 255, 0, 255}},
233     {{255, 255, 0, 255, 0, 255, 255, 0, 255, 0, 255, 255, 0, 255, 0, 255}},
234     {{255, 0, 255, 0, 255, 255, 0, 255, 0, 255, 255, 0, 255, 0, 255, 255}},
235     {{255, 0, 255, 255, 0, 255, 0, 255, 255, 0, 255, 0, 255, 0, 255, 255}},
236     {{255, 0, 255, 0, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 255, 0}},
237     {{255, 0, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 255, 0, 255, 255}},
238     {{255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 255, 0, 255, 0, 255, 0}},
239     {{255, 255, 255, 0, 255, 255, 255, 255, 0, 255, 0, 255, 0, 255, 255, 0}},
240 };
241 // Mask used with vsew = 1 (16bit) elements.
242 static constexpr SIMD128 kMaskInt16[8] = {
243     {{0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff}},
244     {{0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff}},
245     {{0xffff, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000}},
246     {{0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff}},
247     {{0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff}},
248     {{0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffff}},
249     {{0xffff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff}},
250     {{0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffff}},
251 };
252 // Mask used with vsew = 2 (32bit) elements.
253 static constexpr SIMD128 kMaskInt32[8] = {
254     {{0xffff'ffff, 0x0000'0000, 0xffff'ffff, 0xffff'ffff}},
255     {{0x0000'0000, 0xffff'ffff, 0x0000'0000, 0xffff'ffff}},
256     {{0xffff'ffff, 0x0000'0000, 0xffff'ffff, 0x0000'0000}},
257     {{0xffff'ffff, 0xffff'ffff, 0x0000'0000, 0xffff'ffff}},
258     {{0xffff'ffff, 0xffff'ffff, 0x0000'0000, 0xffff'ffff}},
259     {{0x0000'0000, 0xffff'ffff, 0xffff'ffff, 0x0000'0000}},
260     {{0xffff'ffff, 0x0000'0000, 0xffff'ffff, 0xffff'ffff}},
261     {{0x0000'0000, 0xffff'ffff, 0x0000'0000, 0xffff'ffff}},
262 };
263 // Mask used with vsew = 3 (64bit) elements.
264 static constexpr SIMD128 kMaskInt64[8] = {
265     {{0xffff'ffff'ffff'ffff, 0x0000'0000'0000'0000}},
266     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
267     {{0x0000'0000'0000'0000, 0xffff'ffff'ffff'ffff}},
268     {{0x0000'0000'0000'0000, 0xffff'ffff'ffff'ffff}},
269     {{0xffff'ffff'ffff'ffff, 0x0000'0000'0000'0000}},
270     {{0xffff'ffff'ffff'ffff, 0x0000'0000'0000'0000}},
271     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
272     {{0x0000'0000'0000'0000, 0xffff'ffff'ffff'ffff}},
273 };
274 // To verify operations without masking.
275 static constexpr SIMD128 kNoMask[8] = {
276     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
277     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
278     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
279     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
280     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
281     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
282     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
283     {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
284 };
285 
286 // Half of sub-register lmul.
287 static constexpr SIMD128 kFractionMaskInt8[5] = {
288     {{255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},                // Half of 1/8 reg = 1/16
289     {{255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},              // Half of 1/4 reg = 1/8
290     {{255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},          // Half of 1/2 reg = 1/4
291     {{255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0}},  // Half of full reg = 1/2
292     {{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}},  // Full reg
293 };
294 
MakeBitmaskFromVl(size_t vl)295 SIMD128 MakeBitmaskFromVl(size_t vl) {
296   if (vl == 128) {
297     return {__uint128_t(0)};
298   } else {
299     return {(~__int128(0)) << vl};
300   }
301 }
302 
303 template <typename ElementType>
MaskForElem()304 auto MaskForElem() {
305   if constexpr (std::is_same_v<ElementType, uint8_t>) {
306     return kMaskInt8;
307   } else if constexpr (std::is_same_v<ElementType, uint16_t>) {
308     return kMaskInt16;
309   } else if constexpr (std::is_same_v<ElementType, uint32_t>) {
310     return kMaskInt32;
311   } else if constexpr (std::is_same_v<ElementType, uint64_t>) {
312     return kMaskInt64;
313   } else {
314     static_assert(false);
315   }
316 }
317 
318 template <bool kIsMasked, typename ElementType>
MaskForElemIfMasked()319 auto MaskForElemIfMasked() {
320   if constexpr (!kIsMasked) {
321     return kNoMask;
322   } else {
323     return MaskForElem<ElementType>();
324   }
325 }
326 
327 using ExecInsnFunc = void (*)();
328 
RunTwoVectorArgsOneRes(ExecInsnFunc exec_insn,const SIMD128 * src,SIMD128 * res,uint64_t vtype,uint64_t vlmax)329 void RunTwoVectorArgsOneRes(ExecInsnFunc exec_insn,
330                             const SIMD128* src,
331                             SIMD128* res,
332                             uint64_t vtype,
333                             uint64_t vlmax) {
334   uint64_t vstart, vl;
335   // Mask register is, unconditionally, v0, and we need 8, 16, or 24 to handle full 8-registers
336   // inputs thus we use v8..v15 for destination and place sources into v16..v23 and v24..v31.
337   asm(  // Load arguments and undisturbed result.
338       "vsetvli t0, zero, e64, m8, ta, ma\n\t"
339       "vle64.v v8, (%[res])\n\t"
340       "vle64.v v16, (%[src])\n\t"
341       "addi t0, %[src], 128\n\t"
342       "vle64.v v24, (t0)\n\t"
343       // Load mask.
344       "vsetvli t0, zero, e64, m1, ta, ma\n\t"
345       "vle64.v v0, (%[mask])\n\t"
346       // Execute tested instruction.
347       "vsetvl t0, zero, %[vtype]\n\t"
348       "jalr %[exec_insn]\n\t"
349       // Save vstart and vl just after insn execution for checks.
350       "csrr %[vstart], vstart\n\t"
351       "csrr %[vl], vl\n\t"
352       // Store the result.
353       "vsetvli t0, zero, e64, m8, ta, ma\n\t"
354       "vse64.v v8, (%[res])\n\t"
355       : [vstart] "=&r"(vstart), [vl] "=&r"(vl)
356       : [exec_insn] "r"(exec_insn),
357         [src] "r"(src),
358         [res] "r"(res),
359         [vtype] "r"(vtype),
360         [mask] "r"(&kMask)
361       : "t0",
362         "ra",
363         "v0",
364         "v8",
365         "v9",
366         "v10",
367         "v11",
368         "v12",
369         "v13",
370         "v14",
371         "v15",
372         "v16",
373         "v17",
374         "v18",
375         "v19",
376         "v20",
377         "v21",
378         "v22",
379         "v23",
380         "v24",
381         "v25",
382         "v26",
383         "v27",
384         "v28",
385         "v29",
386         "v30",
387         "v31",
388         "memory");
389   // Every vector instruction must set vstart to 0, but shouldn't touch vl.
390   EXPECT_EQ(vstart, 0);
391   EXPECT_EQ(vl, vlmax);
392 }
393 
394 // Supports ExecInsnFuncs that fit the following [inputs...] -> output formats:
395 //   vector -> vector
396 //   vector, vector -> vector
397 //   vector, scalar -> vector
398 //   vector, float -> vector
399 // Vectors will be used in v16 first, then v24
400 // scalar and float will be filled from scalar_src, and will use t0 and ft0,
401 // respectively.
RunCommonVectorFunc(ExecInsnFunc exec_insn,const SIMD128 * src,SIMD128 * res,uint64_t * scalar_int_res,uint64_t * scalar_float_res,uint64_t scalar_src,uint64_t vstart,uint64_t vtype,uint64_t vlin)402 void RunCommonVectorFunc(ExecInsnFunc exec_insn,
403                          const SIMD128* src,
404                          SIMD128* res,
405                          uint64_t* scalar_int_res,
406                          uint64_t* scalar_float_res,
407                          uint64_t scalar_src,
408                          uint64_t vstart,
409                          uint64_t vtype,
410                          uint64_t vlin) {
411   uint64_t unused_local;
412   if (scalar_int_res == nullptr) {
413     scalar_int_res = &unused_local;
414   }
415   if (scalar_float_res == nullptr) {
416     scalar_float_res = &unused_local;
417   }
418 
419   uint64_t vl = vlin;
420   // Mask register is, unconditionally, v0, and we need 8 or 24 to handle full 8-registers
421   // inputs thus we use v8..v15 for destination and place sources into v24..v31.
422   asm(  // Load arguments and undisturbed result.
423       "vsetvli t0, zero, e64, m8, ta, ma\n\t"
424       "vle64.v v8, (%[res])\n\t"
425       "vle64.v v16, (%[src])\n\t"
426       "addi t0, %[src], 128\n\t"
427       "vle64.v v24, (t0)\n\t"
428       // Load mask.
429       "vsetvli t0, zero, e64, m1, ta, ma\n\t"
430       "vle64.v v0, (%[mask])\n\t"
431       // Execute tested instruction.
432       "vsetvl t0, %[vl], %[vtype]\n\t"
433       "csrw vstart, %[vstart]\n\t"
434       "mv t0, %[scalar_src]\n\t"
435       "fmv.d.x ft0, %[scalar_src]\n\t"
436       "jalr %[exec_insn]\n\t"
437       // Save t0, ft0 just after insn execution for return.
438       "sd t0, %[scalar_int]\n\t"
439       "fsd ft0, %[scalar_float]\n\t"
440       // Save vstart and vl just after insn execution for checks.
441       "csrr %[vstart], vstart\n\t"
442       "csrr %[vl], vl\n\t"
443       // Store the result.
444       "vsetvli t0, zero, e64, m8, ta, ma\n\t"
445       "vse64.v v8, (%[res])\n\t"
446       : [vstart] "=r"(vstart), [vl] "=r"(vl)
447       : [exec_insn] "r"(exec_insn),
448         [src] "r"(src),
449         [res] "r"(res),
450         [vtype] "r"(vtype),
451         "0"(vstart),
452         "1"(vl),
453         [mask] "r"(&kMask),
454         [scalar_src] "r"(scalar_src),
455         [scalar_float] "m"(*scalar_float_res),
456         [scalar_int] "m"(*scalar_int_res)
457       : "t0",
458         "ra",
459         "ft0",
460         "v0",
461         "v8",
462         "v9",
463         "v10",
464         "v11",
465         "v12",
466         "v13",
467         "v14",
468         "v15",
469         "v16",
470         "v17",
471         "v18",
472         "v19",
473         "v20",
474         "v21",
475         "v22",
476         "v23",
477         "v24",
478         "v25",
479         "v26",
480         "v27",
481         "v28",
482         "v29",
483         "v30",
484         "v31",
485         "memory");
486   // Every vector instruction must set vstart to 0, but shouldn't touch vl.
487   EXPECT_EQ(vstart, 0);
488   EXPECT_EQ(vl, vlin);
489 }
490 
491 enum class TestVectorInstructionKind { kInteger, kFloat };
492 enum class TestVectorInstructionMode { kDefault, kWidening, kNarrowing, kVMerge };
493 
494 template <TestVectorInstructionKind kTestVectorInstructionKind,
495           TestVectorInstructionMode kTestVectorInstructionMode,
496           typename... ExpectedResultType,
497           size_t... kResultsCount>
TestVectorInstructionInternal(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const SIMD128 dst_result,const SIMD128 (& source)[16],const ExpectedResultType (&...expected_result)[kResultsCount])498 void TestVectorInstructionInternal(ExecInsnFunc exec_insn,
499                                    ExecInsnFunc exec_masked_insn,
500                                    const SIMD128 dst_result,
501                                    const SIMD128 (&source)[16],
502                                    const ExpectedResultType (&... expected_result)[kResultsCount]) {
503   auto Verify = [&source, dst_result](ExecInsnFunc exec_insn,
504                                       uint8_t vsew,
505                                       const auto& expected_result,
506                                       const auto& mask) {
507     uint64_t scalar_src = 0;
508     if constexpr (kTestVectorInstructionKind == TestVectorInstructionKind::kInteger) {
509       // Set t0 for vx instructions.
510       scalar_src = 0xaaaa'aaaa'aaaa'aaaa;
511     } else {
512       // We only support Float32/Float64 for float instructions, but there are conversion
513       // instructions that work with double width floats.
514       // These instructions never use float registers though and thus we don't need to store
515       // anything into ft0 register, if they are used.
516       // For Float32/Float64 case we load 5.625 of the appropriate type into ft0.
517       ASSERT_LE(vsew, 3);
518       if (vsew == 2) {
519         scalar_src = 0xffff'ffff'40b4'0000;  // float 5.625
520       } else if (vsew == 3) {
521         scalar_src = 0x4016'8000'0000'0000;  // double 5.625
522       }
523     }
524     for (uint8_t vlmul = 0; vlmul < 8; ++vlmul) {
525       if constexpr (kTestVectorInstructionMode == TestVectorInstructionMode::kNarrowing ||
526                     kTestVectorInstructionMode == TestVectorInstructionMode::kWidening) {
527         // Incompatible vlmul for narrowing.
528         if (vlmul == 3) {
529           continue;
530         }
531       }
532       for (uint8_t vta = 0; vta < 2; ++vta) {
533         for (uint8_t vma = 0; vma < 2; ++vma) {
534           uint64_t vtype = (vma << 7) | (vta << 6) | (vsew << 3) | vlmul;
535           uint64_t vlmax = 0;
536           asm("vsetvl %0, zero, %1" : "=r"(vlmax) : "r"(vtype));
537           // Incompatible vsew and vlmax. Skip it.
538           if (vlmax == 0) {
539             continue;
540           }
541           uint8_t emul =
542               (vlmul + (kTestVectorInstructionMode == TestVectorInstructionMode::kWidening)) &
543               0b111;
544 
545           // To make tests quick enough we don't test vstart and vl change with small register
546           // sets. Only with vlmul == 2 (4 registers) we set vstart and vl to skip half of first
547           // register, last register and half of next-to last register.
548           // Don't use vlmul == 3 because that one may not be supported if instruction widens the
549           // result.
550           uint64_t vstart;
551           uint64_t vl;
552           if (emul == 2) {
553             vstart = vlmax / 8;
554             vl = (vlmax * 5) / 8;
555           } else {
556             vstart = 0;
557             vl = vlmax;
558           }
559 
560           SIMD128 result[8];
561           // Set expected_result vector registers into 0b01010101… pattern.
562           // Set undisturbed result vector registers.
563           std::fill_n(result, 8, dst_result);
564 
565           RunCommonVectorFunc(
566               exec_insn, &source[0], &result[0], nullptr, nullptr, scalar_src, vstart, vtype, vl);
567 
568           // Values for inactive elements (i.e. corresponding mask bit is 0).
569           SIMD128 expected_inactive[8];
570           if constexpr (kTestVectorInstructionMode == TestVectorInstructionMode::kVMerge) {
571             // vs2 is the start of the source vector register group.
572             // Note: copy_n input/output args are backwards compared to fill_n below.
573             std::copy_n(source, 8, expected_inactive);
574           } else {
575             // For most instructions, follow basic inactive processing rules based on vma flag.
576             std::fill_n(expected_inactive, 8, (vma ? kAgnosticResult : dst_result));
577           }
578 
579           if (emul < 4) {
580             for (size_t index = 0; index < 1 << emul; ++index) {
581               if (index == 0 && emul == 2) {
582                 EXPECT_EQ(result[index],
583                           ((dst_result & kFractionMaskInt8[3]) |
584                            (SIMD128{expected_result[index]} & mask[index] & ~kFractionMaskInt8[3]) |
585                            (expected_inactive[index] & ~mask[index] & ~kFractionMaskInt8[3])));
586               } else if (index == 2 && emul == 2) {
587                 EXPECT_EQ(result[index],
588                           ((SIMD128{expected_result[index]} & mask[index] & kFractionMaskInt8[3]) |
589                            (expected_inactive[index] & ~mask[index] & kFractionMaskInt8[3]) |
590                            ((vta ? kAgnosticResult : dst_result) & ~kFractionMaskInt8[3])));
591               } else if (index == 3 && emul == 2 && vta) {
592                 EXPECT_EQ(result[index], kAgnosticResult);
593               } else if (index == 3 && emul == 2) {
594                 EXPECT_EQ(result[index], dst_result);
595               } else {
596                 EXPECT_EQ(result[index],
597                           ((SIMD128{expected_result[index]} & mask[index]) |
598                            ((expected_inactive[index] & ~mask[index]))));
599               }
600             }
601           } else {
602             EXPECT_EQ(result[0],
603                       ((SIMD128{expected_result[0]} & mask[0] & kFractionMaskInt8[emul - 4]) |
604                        (expected_inactive[0] & ~mask[0] & kFractionMaskInt8[emul - 4]) |
605                        ((vta ? kAgnosticResult : dst_result) & ~kFractionMaskInt8[emul - 4])));
606           }
607         }
608       }
609     }
610   };
611 
612   ((Verify(exec_insn,
613            BitUtilLog2(sizeof(std::tuple_element_t<0, ExpectedResultType>)) -
614                (kTestVectorInstructionMode == TestVectorInstructionMode::kWidening),
615            expected_result,
616            kNoMask),
617     Verify(exec_masked_insn,
618            BitUtilLog2(sizeof(std::tuple_element_t<0, ExpectedResultType>)) -
619                (kTestVectorInstructionMode == TestVectorInstructionMode::kWidening),
620            expected_result,
621            MaskForElem<std::tuple_element_t<0, ExpectedResultType>>())),
622    ...);
623 }
624 
625 template <TestVectorInstructionKind kTestVectorInstructionKind,
626           TestVectorInstructionMode kTestVectorInstructionMode,
627           typename... ExpectedResultType,
628           size_t... kResultsCount>
TestVectorInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const SIMD128 (& source)[16],const ExpectedResultType (&...expected_result)[kResultsCount])629 void TestVectorInstruction(ExecInsnFunc exec_insn,
630                            ExecInsnFunc exec_masked_insn,
631                            const SIMD128 (&source)[16],
632                            const ExpectedResultType (&... expected_result)[kResultsCount]) {
633   TestVectorInstructionInternal<kTestVectorInstructionKind, kTestVectorInstructionMode>(
634       exec_insn, exec_masked_insn, kUndisturbedResult, source, expected_result...);
635 }
636 
TestVectorInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint8_16_t (& expected_result_int8)[8],const uint16_8_t (& expected_result_int16)[8],const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16])637 void TestVectorInstruction(ExecInsnFunc exec_insn,
638                            ExecInsnFunc exec_masked_insn,
639                            const uint8_16_t (&expected_result_int8)[8],
640                            const uint16_8_t (&expected_result_int16)[8],
641                            const uint32_4_t (&expected_result_int32)[8],
642                            const uint64_2_t (&expected_result_int64)[8],
643                            const SIMD128 (&source)[16]) {
644   TestVectorInstruction<TestVectorInstructionKind::kInteger, TestVectorInstructionMode::kDefault>(
645       exec_insn,
646       exec_masked_insn,
647       source,
648       expected_result_int8,
649       expected_result_int16,
650       expected_result_int32,
651       expected_result_int64);
652 }
653 
TestVectorFloatInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16])654 void TestVectorFloatInstruction(ExecInsnFunc exec_insn,
655                                 ExecInsnFunc exec_masked_insn,
656                                 const uint32_4_t (&expected_result_int32)[8],
657                                 const uint64_2_t (&expected_result_int64)[8],
658                                 const SIMD128 (&source)[16]) {
659   TestVectorInstruction<TestVectorInstructionKind::kFloat, TestVectorInstructionMode::kDefault>(
660       exec_insn, exec_masked_insn, source, expected_result_int32, expected_result_int64);
661 }
662 
TestNarrowingVectorInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint8_16_t (& expected_result_int8)[4],const uint16_8_t (& expected_result_int16)[4],const uint32_4_t (& expected_result_int32)[4],const SIMD128 (& source)[16])663 void TestNarrowingVectorInstruction(ExecInsnFunc exec_insn,
664                                     ExecInsnFunc exec_masked_insn,
665                                     const uint8_16_t (&expected_result_int8)[4],
666                                     const uint16_8_t (&expected_result_int16)[4],
667                                     const uint32_4_t (&expected_result_int32)[4],
668                                     const SIMD128 (&source)[16]) {
669   TestVectorInstruction<TestVectorInstructionKind::kInteger, TestVectorInstructionMode::kNarrowing>(
670       exec_insn,
671       exec_masked_insn,
672       source,
673       expected_result_int8,
674       expected_result_int16,
675       expected_result_int32);
676 }
677 
TestNarrowingVectorFloatInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint32_4_t (& expected_result_int32)[4],const SIMD128 (& source)[16])678 void TestNarrowingVectorFloatInstruction(ExecInsnFunc exec_insn,
679                                          ExecInsnFunc exec_masked_insn,
680                                          const uint32_4_t (&expected_result_int32)[4],
681                                          const SIMD128 (&source)[16]) {
682   TestVectorInstruction<TestVectorInstructionKind::kFloat, TestVectorInstructionMode::kNarrowing>(
683       exec_insn, exec_masked_insn, source, expected_result_int32);
684 }
685 
TestNarrowingVectorFloatInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint16_8_t (& expected_result_int16)[4],const uint32_4_t (& expected_result_int32)[4],const SIMD128 (& source)[16])686 void TestNarrowingVectorFloatInstruction(ExecInsnFunc exec_insn,
687                                          ExecInsnFunc exec_masked_insn,
688                                          const uint16_8_t (&expected_result_int16)[4],
689                                          const uint32_4_t (&expected_result_int32)[4],
690                                          const SIMD128 (&source)[16]) {
691   TestVectorInstruction<TestVectorInstructionKind::kFloat, TestVectorInstructionMode::kNarrowing>(
692       exec_insn, exec_masked_insn, source, expected_result_int16, expected_result_int32);
693 }
694 
TestWideningVectorFloatInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16],SIMD128 dst_result=kUndisturbedResult)695 void TestWideningVectorFloatInstruction(ExecInsnFunc exec_insn,
696                                         ExecInsnFunc exec_masked_insn,
697                                         const uint64_2_t (&expected_result_int64)[8],
698                                         const SIMD128 (&source)[16],
699                                         SIMD128 dst_result = kUndisturbedResult) {
700   TestVectorInstructionInternal<TestVectorInstructionKind::kFloat,
701                                 TestVectorInstructionMode::kWidening>(
702       exec_insn, exec_masked_insn, dst_result, source, expected_result_int64);
703 }
704 
TestWideningVectorFloatInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16])705 void TestWideningVectorFloatInstruction(ExecInsnFunc exec_insn,
706                                         ExecInsnFunc exec_masked_insn,
707                                         const uint32_4_t (&expected_result_int32)[8],
708                                         const uint64_2_t (&expected_result_int64)[8],
709                                         const SIMD128 (&source)[16]) {
710   TestVectorInstruction<TestVectorInstructionKind::kFloat, TestVectorInstructionMode::kWidening>(
711       exec_insn, exec_masked_insn, source, expected_result_int32, expected_result_int64);
712 }
713 
TestWideningVectorInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint16_8_t (& expected_result_int16)[8],const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16])714 void TestWideningVectorInstruction(ExecInsnFunc exec_insn,
715                                    ExecInsnFunc exec_masked_insn,
716                                    const uint16_8_t (&expected_result_int16)[8],
717                                    const uint32_4_t (&expected_result_int32)[8],
718                                    const uint64_2_t (&expected_result_int64)[8],
719                                    const SIMD128 (&source)[16]) {
720   TestVectorInstruction<TestVectorInstructionKind::kInteger, TestVectorInstructionMode::kWidening>(
721       exec_insn,
722       exec_masked_insn,
723       source,
724       expected_result_int16,
725       expected_result_int32,
726       expected_result_int64);
727 }
728 
729 template <typename... ExpectedResultType>
TestVectorReductionInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const SIMD128 (& source)[16],std::tuple<const ExpectedResultType (&)[8],const ExpectedResultType (&)[8]>...expected_result)730 void TestVectorReductionInstruction(
731     ExecInsnFunc exec_insn,
732     ExecInsnFunc exec_masked_insn,
733     const SIMD128 (&source)[16],
734     std::tuple<const ExpectedResultType (&)[8],
735                const ExpectedResultType (&)[8]>... expected_result) {
736   // Each expected_result input to this function is the vd[0] value of the reduction, for each
737   // of the possible vlmul, i.e. expected_result_vd0_int8[n] = vd[0], int8, no mask, vlmul=n.
738   //
739   // As vlmul=4 is reserved, expected_result_vd0_*[4] is ignored.
740   auto Verify = [&source](ExecInsnFunc exec_insn,
741                           uint8_t vsew,
742                           uint8_t vlmul,
743                           const auto& expected_result) {
744     for (uint8_t vta = 0; vta < 2; ++vta) {
745       for (uint8_t vma = 0; vma < 2; ++vma) {
746         uint64_t vtype = (vma << 7) | (vta << 6) | (vsew << 3) | vlmul;
747         uint64_t vlmax = 0;
748         asm("vsetvl %0, zero, %1" : "=r"(vlmax) : "r"(vtype));
749         if (vlmax == 0) {
750           continue;
751         }
752 
753         SIMD128 result[8];
754         // Set undisturbed result vector registers.
755         for (size_t index = 0; index < 8; ++index) {
756           result[index] = kUndisturbedResult;
757         }
758 
759         // Exectations for reductions are for swapped source arguments.
760         SIMD128 two_sources[16]{};
761         memcpy(&two_sources[0], &source[8], sizeof(two_sources[0]) * 8);
762         memcpy(&two_sources[8], &source[0], sizeof(two_sources[0]) * 8);
763 
764         RunTwoVectorArgsOneRes(exec_insn, &two_sources[0], &result[0], vtype, vlmax);
765 
766         // Reduction instructions are unique in that they produce a scalar
767         // output to a single vector register as opposed to a register group.
768         // This allows us to take some short-cuts when validating:
769         //
770         // - The mask setting is only useful during computation, as the body
771         // of the destination is always only element 0, which will always be
772         // written to, regardless of mask setting.
773         // - The tail is guaranteed to be 1..VLEN/SEW, so the vlmul setting
774         // does not affect the elements that the tail policy applies to in the
775         // destination register.
776 
777         // Verify that the destination register holds the reduction in the
778         // first element and the tail policy applies to the remaining.
779         SIMD128 expected_result_register = vta ? kAgnosticResult : kUndisturbedResult;
780         size_t vsew_bits = 8 << vsew;
781         expected_result_register = (expected_result_register >> vsew_bits) << vsew_bits;
782         expected_result_register |= SIMD128{expected_result};
783         EXPECT_EQ(result[0], expected_result_register) << " vtype=" << vtype;
784 
785         // Verify all non-destination registers are undisturbed.
786         for (size_t index = 1; index < 8; ++index) {
787           EXPECT_EQ(result[index], kUndisturbedResult) << " vtype=" << vtype;
788         }
789       }
790     }
791   };
792 
793   for (int vlmul = 0; vlmul < 8; vlmul++) {
794     ((Verify(exec_insn,
795              BitUtilLog2(sizeof(ExpectedResultType)),
796              vlmul,
797              std::get<0>(expected_result)[vlmul]),
798       Verify(exec_masked_insn,
799              BitUtilLog2(sizeof(ExpectedResultType)),
800              vlmul,
801              std::get<1>(expected_result)[vlmul])),
802      ...);
803   }
804 }
805 
TestVectorReductionInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint32_t (& expected_result_vd0_int32)[8],const uint64_t (& expected_result_vd0_int64)[8],const uint32_t (& expected_result_vd0_with_mask_int32)[8],const uint64_t (& expected_result_vd0_with_mask_int64)[8],const SIMD128 (& source)[16])806 void TestVectorReductionInstruction(ExecInsnFunc exec_insn,
807                                     ExecInsnFunc exec_masked_insn,
808                                     const uint32_t (&expected_result_vd0_int32)[8],
809                                     const uint64_t (&expected_result_vd0_int64)[8],
810                                     const uint32_t (&expected_result_vd0_with_mask_int32)[8],
811                                     const uint64_t (&expected_result_vd0_with_mask_int64)[8],
812                                     const SIMD128 (&source)[16]) {
813   TestVectorReductionInstruction(
814       exec_insn,
815       exec_masked_insn,
816       source,
817       std::tuple<const uint32_t(&)[8], const uint32_t(&)[8]>{expected_result_vd0_int32,
818                                                              expected_result_vd0_with_mask_int32},
819       std::tuple<const uint64_t(&)[8], const uint64_t(&)[8]>{expected_result_vd0_int64,
820                                                              expected_result_vd0_with_mask_int64});
821 }
822 
TestVectorReductionInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint8_t (& expected_result_vd0_int8)[8],const uint16_t (& expected_result_vd0_int16)[8],const uint32_t (& expected_result_vd0_int32)[8],const uint64_t (& expected_result_vd0_int64)[8],const uint8_t (& expected_result_vd0_with_mask_int8)[8],const uint16_t (& expected_result_vd0_with_mask_int16)[8],const uint32_t (& expected_result_vd0_with_mask_int32)[8],const uint64_t (& expected_result_vd0_with_mask_int64)[8],const SIMD128 (& source)[16])823 void TestVectorReductionInstruction(ExecInsnFunc exec_insn,
824                                     ExecInsnFunc exec_masked_insn,
825                                     const uint8_t (&expected_result_vd0_int8)[8],
826                                     const uint16_t (&expected_result_vd0_int16)[8],
827                                     const uint32_t (&expected_result_vd0_int32)[8],
828                                     const uint64_t (&expected_result_vd0_int64)[8],
829                                     const uint8_t (&expected_result_vd0_with_mask_int8)[8],
830                                     const uint16_t (&expected_result_vd0_with_mask_int16)[8],
831                                     const uint32_t (&expected_result_vd0_with_mask_int32)[8],
832                                     const uint64_t (&expected_result_vd0_with_mask_int64)[8],
833                                     const SIMD128 (&source)[16]) {
834   TestVectorReductionInstruction(
835       exec_insn,
836       exec_masked_insn,
837       source,
838       std::tuple<const uint8_t(&)[8], const uint8_t(&)[8]>{expected_result_vd0_int8,
839                                                            expected_result_vd0_with_mask_int8},
840       std::tuple<const uint16_t(&)[8], const uint16_t(&)[8]>{expected_result_vd0_int16,
841                                                              expected_result_vd0_with_mask_int16},
842       std::tuple<const uint32_t(&)[8], const uint32_t(&)[8]>{expected_result_vd0_int32,
843                                                              expected_result_vd0_with_mask_int32},
844       std::tuple<const uint64_t(&)[8], const uint64_t(&)[8]>{expected_result_vd0_int64,
845                                                              expected_result_vd0_with_mask_int64});
846 }
847 
848 template <bool kIsMasked, typename... ExpectedResultType, size_t... kResultsCount>
TestVectorIota(ExecInsnFunc exec_insn,const SIMD128 (& source)[16],const ExpectedResultType (&...expected_result)[kResultsCount])849 void TestVectorIota(ExecInsnFunc exec_insn,
850                     const SIMD128 (&source)[16],
851                     const ExpectedResultType (&... expected_result)[kResultsCount]) {
852   auto Verify = [&source](ExecInsnFunc exec_insn,
853                           uint8_t vsew,
854                           const auto& expected_result,
855                           auto elem_mask) {
856     for (uint8_t vlmul = 0; vlmul < 8; ++vlmul) {
857       for (uint8_t vta = 0; vta < 2; ++vta) {
858         for (uint8_t vma = 0; vma < 2; ++vma) {
859           uint64_t vtype = (vma << 7) | (vta << 6) | (vsew << 3) | vlmul;
860           uint64_t vlmax = 0;
861           asm("vsetvl %0, zero, %1" : "=r"(vlmax) : "r"(vtype));
862           if (vlmax == 0) {
863             continue;
864           }
865 
866           for (uint8_t vl = 0; vl < vlmax; vl += vlmax) {
867             // To make tests quick enough we don't test vl change with small register sets. Only
868             // with vlmul == 2 (4 registers) we set vl to skip last register and half of next-to
869             // last register.
870             uint64_t vlin;
871             if (vlmul == 2 && vl == vlmax) {
872               vlin = 5 * vlmax / 8;
873             } else {
874               vlin = vl;
875             }
876 
877             SIMD128 result[8];
878             // Set expected_result vector registers into 0b01010101… pattern.
879             // Set undisturbed result vector registers.
880             std::fill_n(result, 8, kUndisturbedResult);
881 
882             RunCommonVectorFunc(
883                 exec_insn, &source[0], &result[0], nullptr, nullptr, 0, 0, vtype, vlin);
884 
885             SIMD128 expected_inactive[8];
886             std::fill_n(expected_inactive, 8, (vma ? kAgnosticResult : kUndisturbedResult));
887 
888             // vl of 0 should never change dst registers
889             if (vl == 0) {
890               for (size_t index = 0; index < 8; ++index) {
891                 EXPECT_EQ(result[index], kUndisturbedResult);
892               }
893             } else if (vlmul < 4) {
894               for (size_t index = 0; index < 1 << vlmul; ++index) {
895                 for (size_t index = 0; index < 1 << vlmul; ++index) {
896                   if (index == 2 && vlmul == 2) {
897                     EXPECT_EQ(
898                         result[index],
899                         ((SIMD128{expected_result[index]} & elem_mask[index] &
900                           kFractionMaskInt8[3]) |
901                          (expected_inactive[index] & ~elem_mask[index] & kFractionMaskInt8[3]) |
902                          ((vta ? kAgnosticResult : kUndisturbedResult) & ~kFractionMaskInt8[3])));
903                   } else if (index == 3 && vlmul == 2) {
904                     EXPECT_EQ(result[index], vta ? kAgnosticResult : kUndisturbedResult);
905                   } else {
906                     EXPECT_EQ(result[index],
907                               ((SIMD128{expected_result[index]} & elem_mask[index]) |
908                                (expected_inactive[index] & ~elem_mask[index])));
909                   }
910                 }
911               }
912             } else {
913               // vlmul >= 4 only uses 1 register
914               EXPECT_EQ(
915                   result[0],
916                   ((SIMD128{expected_result[0]} & elem_mask[0] & kFractionMaskInt8[vlmul - 4]) |
917                    (expected_inactive[0] & ~elem_mask[0] & kFractionMaskInt8[vlmul - 4]) |
918                    ((vta ? kAgnosticResult : kUndisturbedResult) & ~kFractionMaskInt8[vlmul - 4])));
919             }
920           }
921         }
922       }
923     }
924   };
925 
926   (Verify(exec_insn,
927           BitUtilLog2(sizeof(std::tuple_element_t<0, ExpectedResultType>)),
928           expected_result,
929           MaskForElemIfMasked<kIsMasked, std::tuple_element_t<0, ExpectedResultType>>()),
930    ...);
931 }
932 
933 template <bool kIsMasked>
TestVectorIota(ExecInsnFunc exec_insn,const uint8_16_t (& expected_result_int8)[8],const uint16_8_t (& expected_result_int16)[8],const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16])934 void TestVectorIota(ExecInsnFunc exec_insn,
935                     const uint8_16_t (&expected_result_int8)[8],
936                     const uint16_8_t (&expected_result_int16)[8],
937                     const uint32_4_t (&expected_result_int32)[8],
938                     const uint64_2_t (&expected_result_int64)[8],
939                     const SIMD128 (&source)[16]) {
940   TestVectorIota<kIsMasked>(exec_insn,
941                             source,
942                             expected_result_int8,
943                             expected_result_int16,
944                             expected_result_int32,
945                             expected_result_int64);
946 }
947 
TestExtendingVectorInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint16_8_t (& expected_result_int16)[8],const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16],const uint8_t factor)948 void TestExtendingVectorInstruction(ExecInsnFunc exec_insn,
949                                     ExecInsnFunc exec_masked_insn,
950                                     const uint16_8_t (&expected_result_int16)[8],
951                                     const uint32_4_t (&expected_result_int32)[8],
952                                     const uint64_2_t (&expected_result_int64)[8],
953                                     const SIMD128 (&source)[16],
954                                     const uint8_t factor) {
955   auto Verify = [&source, &factor](ExecInsnFunc exec_insn,
956                                    uint8_t vsew,
957                                    uint8_t vlmul_max,
958                                    const auto& expected_result,
959                                    auto mask) {
960     EXPECT_TRUE((factor == 2) || (factor == 4) || (factor == 8));
961     for (uint8_t vlmul = 0; vlmul < vlmul_max; ++vlmul) {
962       if (vlmul == 3) {
963         continue;
964       }
965       for (uint8_t vta = 0; vta < 2; ++vta) {
966         for (uint8_t vma = 0; vma < 2; ++vma) {
967           uint64_t vtype = (vma << 7) | (vta << 6) | (vsew << 3) | vlmul;
968           uint64_t vlmax = 0;
969           asm("vsetvl %0, zero, %1" : "=r"(vlmax) : "r"(vtype));
970           // Incompatible vsew and vlmax. Skip it.
971           if (vlmax == 0) {
972             continue;
973           }
974           // To make tests quick enough we don't test vstart and vl change with small register
975           // sets. Only with vlmul == 2 (4 registers) we set vstart and vl to skip half of
976           // first
977           // register and half of last register.
978           // Don't use vlmul == 3 because that one may not be supported if instruction widens
979           // the result.
980           uint64_t vstart;
981           uint64_t vl;
982           if (vlmul == 2) {
983             vstart = vlmax / 8;
984             vl = (vlmax * 5) / 8;
985           } else {
986             vstart = 0;
987             vl = vlmax;
988           }
989 
990           SIMD128 result[8];
991           // Set expected_result vector registers into 0b01010101… pattern.
992           // Set undisturbed result vector registers.
993           std::fill_n(result, 8, kUndisturbedResult);
994 
995           RunCommonVectorFunc(
996               exec_insn, &source[0], &result[0], nullptr, nullptr, 0, vstart, vtype, vl);
997 
998           // Values for inactive elements (i.e. corresponding mask bit is 0).
999           const size_t n = std::size(source) * 2;
1000           SIMD128 expected_inactive[n];
1001           // For most instructions, follow basic inactive processing rules based on vma flag.
1002           std::fill_n(expected_inactive, n, (vma ? kAgnosticResult : kUndisturbedResult));
1003 
1004           if (vlmul < 4) {
1005             for (size_t index = 0; index < 1 << vlmul; ++index) {
1006               if (index == 0 && vlmul == 2) {
1007                 EXPECT_EQ(
1008                     result[index],
1009                     (kUndisturbedResult & kFractionMaskInt8[3]) |
1010                         (SIMD128{expected_result[index]} & mask[index] & ~kFractionMaskInt8[3]) |
1011                         (expected_inactive[index] & ~mask[index] & ~kFractionMaskInt8[3]));
1012               } else if (index == 2 && vlmul == 2) {
1013                 EXPECT_EQ(
1014                     result[index],
1015                     (SIMD128{expected_result[index]} & mask[index] & kFractionMaskInt8[3]) |
1016                         (expected_inactive[index] & ~mask[index] & kFractionMaskInt8[3]) |
1017                         ((vta ? kAgnosticResult : kUndisturbedResult) & ~kFractionMaskInt8[3]));
1018               } else if (index == 3 && vlmul == 2 && vta) {
1019                 EXPECT_EQ(result[index], kAgnosticResult);
1020               } else if (index == 3 && vlmul == 2) {
1021                 EXPECT_EQ(result[index], kUndisturbedResult);
1022               } else {
1023                 EXPECT_EQ(result[index],
1024                           (SIMD128{expected_result[index]} & mask[index]) |
1025                               (expected_inactive[index] & ~mask[index]));
1026               }
1027             }
1028           } else {
1029             EXPECT_EQ(
1030                 result[0],
1031                 (SIMD128{expected_result[0]} & mask[0] & kFractionMaskInt8[vlmul - 4]) |
1032                     (expected_inactive[0] & ~mask[0] & kFractionMaskInt8[vlmul - 4]) |
1033                     ((vta ? kAgnosticResult : kUndisturbedResult) & ~kFractionMaskInt8[vlmul - 4]));
1034           }
1035         }
1036       }
1037     }
1038   };
1039 
1040   if (factor == 2) {
1041     Verify(exec_masked_insn, 1, 8, expected_result_int16, kMaskInt16);
1042     Verify(exec_insn, 1, 8, expected_result_int16, kNoMask);
1043   }
1044   if (factor == 2 || factor == 4) {
1045     Verify(exec_masked_insn, 2, 8, expected_result_int32, kMaskInt32);
1046     Verify(exec_insn, 2, 8, expected_result_int32, kNoMask);
1047   }
1048   Verify(exec_masked_insn, 3, 8, expected_result_int64, kMaskInt64);
1049   Verify(exec_insn, 3, 8, expected_result_int64, kNoMask);
1050 }
1051 
1052 // Unlike regular arithmetic instructions, the result of a permutation
1053 // instruction depends also on vlmul.  Also, the vslideup specs mention that
1054 // the destination vector remains unchanged the first |offset| elements (in
1055 // effect, the offset acts akin to vstart), in those cases skip can be used
1056 // to specify how many elements' mask will be skipped (counting from the
1057 // beginning, should be the same as the offset).
1058 //
1059 // If |ignore_vma_for_last| is true, an inactive element at vl-1 will be
1060 // treated as if vma=0 (Undisturbed).
1061 // If |last_elem_is_reg1| is true, the last element of the vector in
1062 // expected_result (that is, at vl-1) will be expected to be the same as
1063 // |regx1| when VL < VMAX and said element is active.
1064 template <TestVectorInstructionKind kTestVectorInstructionKind,
1065           typename... ExpectedResultType,
1066           size_t... kResultsCount>
TestVectorPermutationInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const SIMD128 (& source)[16],uint8_t vlmul,uint64_t skip,bool ignore_vma_for_last,bool last_elem_is_reg1,uint64_t regt0,const ExpectedResultType (&...expected_result)[kResultsCount])1067 void TestVectorPermutationInstruction(
1068     ExecInsnFunc exec_insn,
1069     ExecInsnFunc exec_masked_insn,
1070     const SIMD128 (&source)[16],
1071     uint8_t vlmul,
1072     uint64_t skip,
1073     bool ignore_vma_for_last,
1074     bool last_elem_is_reg1,
1075     uint64_t regt0,
1076     const ExpectedResultType (&... expected_result)[kResultsCount]) {
1077   auto Verify = [&source, vlmul, regt0, skip, ignore_vma_for_last, last_elem_is_reg1](
1078                     ExecInsnFunc exec_insn,
1079                     uint8_t vsew,
1080                     const auto& expected_result_raw,
1081                     auto mask) {
1082     uint64_t scalar_src = 0;
1083     if constexpr (kTestVectorInstructionKind == TestVectorInstructionKind::kFloat) {
1084       (void)(regt0);
1085       // We only support Float32/Float64 for float instructions, but there are conversion
1086       // instructions that work with double width floats.
1087       // These instructions never use float registers though and thus we don't need to store
1088       // anything into f1 register, if they are used.
1089       // For Float32/Float64 case we load 5.625 of the appropriate type into ft0.
1090       ASSERT_LE(vsew, 3);
1091       if (vsew == 2) {
1092         scalar_src = 0xffff'ffff'40b4'0000;  // float 5.625
1093       } else if (vsew == 3) {
1094         scalar_src = 0x4016'8000'0000'0000;  // double 5.625
1095       }
1096     } else {
1097       // Set t0 for vx instructions.
1098       scalar_src = regt0;
1099     }
1100 
1101     const size_t kElementSize = 1 << vsew;
1102     size_t num_regs = 1 << vlmul;
1103     if (vlmul > 3) {
1104       num_regs = 1;
1105     }
1106     // Values for which the mask is not applied due to being before the offset when doing
1107     // vslideup.
1108     SIMD128 skip_mask[num_regs];
1109     int64_t toskip = skip;
1110     for (size_t index = 0; index < num_regs && toskip > 0; ++index) {
1111       size_t skip_bits = toskip * kElementSize * 8;
1112       skip_mask[index] = ~MakeBitmaskFromVl(skip_bits > 128 ? 128 : skip_bits);
1113       toskip -= 16 / kElementSize;
1114     }
1115 
1116     for (uint8_t vta = 0; vta < 2; ++vta) {
1117       for (uint8_t vma = 0; vma < 2; ++vma) {
1118         uint64_t vtype = (vma << 7) | (vta << 6) | (vsew << 3) | vlmul;
1119         uint64_t vlmax = 0;
1120         asm("vsetvl %0, zero, %1" : "=r"(vlmax) : "r"(vtype));
1121         // Incompatible vsew and vlmax. Skip it.
1122         if (vlmax == 0) {
1123           continue;
1124         }
1125 
1126         // To make tests quick enough we don't test vstart and vl change with small register
1127         // sets. Only with vlmul == 2 (4 registers) we set vstart and vl to skip half of first
1128         // register, last register and half of next-to last register.
1129         // Don't use vlmul == 3 because that one may not be supported if instruction widens the
1130         // result.
1131         uint64_t vstart;
1132         uint64_t vl;
1133         if (vlmul == 2) {
1134           vstart = vlmax / 8;
1135           vl = (vlmax * 5) / 8;
1136         } else {
1137           vstart = 0;
1138           vl = vlmax;
1139         }
1140 
1141         SIMD128 result[8];
1142         // Set expected_result vector registers into 0b01010101… pattern.
1143         // Set undisturbed result vector registers.
1144         std::fill_n(result, 8, kUndisturbedResult);
1145 
1146         uint64_t int_res, float_res;
1147         RunCommonVectorFunc(
1148             exec_insn, &source[0], &result[0], &int_res, &float_res, scalar_src, vstart, vtype, vl);
1149 
1150         const size_t n = std::size(source);
1151         // Values for inactive elements (i.e. corresponding mask bit is 0).
1152         SIMD128 expected_inactive[n];
1153         // For most instructions, follow basic inactive processing rules based on vma flag.
1154         std::fill_n(expected_inactive, n, (vma ? kAgnosticResult : kUndisturbedResult));
1155 
1156         const size_t kElementsPerRegister = 16 / kElementSize;
1157         // TODO is this vl the input vl or vl after commands run?
1158         const size_t last_reg = (vl - 1) / kElementsPerRegister;
1159         const size_t last_elem = (vl - 1) % kElementsPerRegister;
1160         const auto mask_for_vl = MakeBitmaskFromVl(last_elem * kElementSize * 8);
1161         if (vma && ignore_vma_for_last) {
1162           // Set expected value for inactive element at vl-1 to Undisturbed.
1163           expected_inactive[last_reg] =
1164               (expected_inactive[last_reg] & ~mask_for_vl) | (kUndisturbedResult & mask_for_vl);
1165         }
1166 
1167         SIMD128 expected_result[std::size(expected_result_raw)];
1168         for (size_t index = 0; index < std::size(expected_result_raw); ++index) {
1169           expected_result[index] = SIMD128{expected_result_raw[index]};
1170         }
1171 
1172         if (vlmul == 2 && last_elem_is_reg1) {
1173           switch (kElementSize) {
1174             case 1:
1175               expected_result[last_reg] = static_cast<__uint128_t>(static_cast<uint8_t>(int_res))
1176                                           << (last_elem * 8);
1177               break;
1178             case 2:
1179               expected_result[last_reg] = static_cast<__uint128_t>(static_cast<uint16_t>(int_res))
1180                                           << (last_elem * 16);
1181               break;
1182             case 4:
1183               if constexpr (kTestVectorInstructionKind == TestVectorInstructionKind::kFloat) {
1184                 expected_result[last_reg] =
1185                     static_cast<__uint128_t>(static_cast<uint32_t>(float_res)) << (last_elem * 32);
1186               } else {
1187                 expected_result[last_reg] = static_cast<__uint128_t>(static_cast<uint32_t>(int_res))
1188                                             << (last_elem * 32);
1189               }
1190               break;
1191             case 8:
1192               if constexpr (kTestVectorInstructionKind == TestVectorInstructionKind::kFloat) {
1193                 expected_result[last_reg] =
1194                     static_cast<__uint128_t>(static_cast<uint64_t>(float_res)) << (last_elem * 64);
1195               } else {
1196                 expected_result[last_reg] = static_cast<__uint128_t>(static_cast<uint64_t>(int_res))
1197                                             << (last_elem * 64);
1198               }
1199               break;
1200             default:
1201               FAIL() << "Element size is " << kElementSize;
1202           }
1203         }
1204 
1205         if (vlmul < 4) {
1206           for (size_t index = 0; index < num_regs; ++index) {
1207             if (index == 0 && vlmul == 2) {
1208               EXPECT_EQ(result[index],
1209                         (kUndisturbedResult & kFractionMaskInt8[3]) |
1210                             (expected_result[index] & (mask[index] | skip_mask[index]) &
1211                              ~kFractionMaskInt8[3]) |
1212                             (expected_inactive[index] & ~mask[index] & ~skip_mask[index] &
1213                              ~kFractionMaskInt8[3]));
1214             } else if (index == 2 && vlmul == 2) {
1215               EXPECT_EQ(result[index],
1216                         (expected_result[index] & (mask[index] | skip_mask[index]) &
1217                          kFractionMaskInt8[3]) |
1218                             (expected_inactive[index] & ~mask[index] & ~skip_mask[index] &
1219                              kFractionMaskInt8[3]) |
1220                             ((vta ? kAgnosticResult : kUndisturbedResult) & ~kFractionMaskInt8[3]));
1221             } else if (index == 3 && vlmul == 2 && vta) {
1222               EXPECT_EQ(result[index], kAgnosticResult);
1223             } else if (index == 3 && vlmul == 2) {
1224               EXPECT_EQ(result[index], kUndisturbedResult);
1225             } else {
1226               EXPECT_EQ(result[index],
1227                         (expected_result[index] & (mask[index] | skip_mask[index])) |
1228                             (expected_inactive[index] & ~(mask[index] | skip_mask[index])));
1229             }
1230           }
1231         } else {
1232           SIMD128 v8 = result[0];
1233           SIMD128 affected_part{expected_result[0] &
1234                                 ((mask[0] & kFractionMaskInt8[vlmul - 4]) | skip_mask[0])};
1235           SIMD128 masked_part{expected_inactive[0] & ~mask[0] & ~skip_mask[0] &
1236                               kFractionMaskInt8[vlmul - 4]};
1237           SIMD128 tail_part{(vta ? kAgnosticResult : kUndisturbedResult) &
1238                             ~kFractionMaskInt8[vlmul - 4]};
1239 
1240           EXPECT_EQ(v8, affected_part | masked_part | tail_part);
1241         }
1242       }
1243     }
1244   };
1245 
1246   // Test with and without masking enabled.
1247   (Verify(exec_masked_insn,
1248           BitUtilLog2(sizeof(std::tuple_element_t<0, ExpectedResultType>)),
1249           expected_result,
1250           MaskForElem<std::tuple_element_t<0, ExpectedResultType>>()),
1251    ...);
1252   (Verify(exec_insn,
1253           BitUtilLog2(sizeof(std::tuple_element_t<0, ExpectedResultType>)),
1254           expected_result,
1255           kNoMask),
1256    ...);
1257 }
1258 
TestVectorPermutationInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint8_16_t (& expected_result_int8)[8],const uint16_8_t (& expected_result_int16)[8],const uint32_4_t (& expected_result_int32)[8],const uint64_2_t (& expected_result_int64)[8],const SIMD128 (& source)[16],uint8_t vlmul,uint64_t regt0=0x0,uint64_t skip=0,bool ignore_vma_for_last=false,bool last_elem_is_x1=false)1259 void TestVectorPermutationInstruction(ExecInsnFunc exec_insn,
1260                                       ExecInsnFunc exec_masked_insn,
1261                                       const uint8_16_t (&expected_result_int8)[8],
1262                                       const uint16_8_t (&expected_result_int16)[8],
1263                                       const uint32_4_t (&expected_result_int32)[8],
1264                                       const uint64_2_t (&expected_result_int64)[8],
1265                                       const SIMD128 (&source)[16],
1266                                       uint8_t vlmul,
1267                                       uint64_t regt0 = 0x0,
1268                                       uint64_t skip = 0,
1269                                       bool ignore_vma_for_last = false,
1270                                       bool last_elem_is_x1 = false) {
1271   TestVectorPermutationInstruction<TestVectorInstructionKind::kInteger>(exec_insn,
1272                                                                         exec_masked_insn,
1273                                                                         source,
1274                                                                         vlmul,
1275                                                                         skip,
1276                                                                         ignore_vma_for_last,
1277                                                                         last_elem_is_x1,
1278                                                                         regt0,
1279                                                                         expected_result_int8,
1280                                                                         expected_result_int16,
1281                                                                         expected_result_int32,
1282                                                                         expected_result_int64);
1283 }
1284 
1285 template <typename... ExpectedResultType>
TestVectorMaskTargetInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const SIMD128 (& source)[16],const ExpectedResultType (&...expected_result))1286 void TestVectorMaskTargetInstruction(ExecInsnFunc exec_insn,
1287                                      ExecInsnFunc exec_masked_insn,
1288                                      const SIMD128 (&source)[16],
1289                                      const ExpectedResultType(&... expected_result)) {
1290   auto Verify = [&source](
1291                     ExecInsnFunc exec_insn, uint8_t vsew, const auto& expected_result, auto mask) {
1292     // Set t0 for vx instructions.
1293     uint64_t scalar_src = 0xaaaa'aaaa'aaaa'aaaa;
1294 
1295     // Set ft0 for vf instructions.
1296     if (vsew == 2) {
1297       scalar_src = 0xffff'ffff'40b4'0000;  // float 5.625
1298     } else if (vsew == 3) {
1299       scalar_src = 0x4016'8000'0000'0000;  // double 5.625
1300     }
1301     for (uint8_t vlmul = 0; vlmul < 8; ++vlmul) {
1302       for (uint8_t vta = 0; vta < 2; ++vta) {  // vta should be ignored but we test both values!
1303         for (uint8_t vma = 0; vma < 2; ++vma) {
1304           uint64_t vtype = (vma << 7) | (vta << 6) | (vsew << 3) | vlmul;
1305           uint64_t vlmax = 0;
1306           asm("vsetvl %0, zero, %1" : "=r"(vlmax) : "r"(vtype));
1307           // Incompatible vsew and vlmax. Skip it.
1308           if (vlmax == 0) {
1309             continue;
1310           }
1311 
1312           // To make tests quick enough we don't test vstart and vl change with small register
1313           // sets. Only with vlmul == 2 (4 registers) we set vstart and vl to skip half of first
1314           // register, last register and half of next-to last register.
1315           // Don't use vlmul == 3 because that one may not be supported if instruction widens the
1316           // result.
1317           uint64_t vstart;
1318           uint64_t vl;
1319           if (vlmul == 2) {
1320             vstart = vlmax / 8;
1321             vl = (vlmax * 5) / 8;
1322           } else {
1323             vstart = 0;
1324             vl = vlmax;
1325           }
1326 
1327           SIMD128 result[8];
1328           // Set expected_result vector registers into 0b01010101… pattern.
1329           // Set undisturbed result vector registers.
1330           std::fill_n(result, 8, kUndisturbedResult);
1331 
1332           RunCommonVectorFunc(
1333               exec_insn, &source[0], &result[0], nullptr, nullptr, scalar_src, vstart, vtype, vl);
1334 
1335           SIMD128 expected_result_in_register(expected_result);
1336           if (vma == 0) {
1337             expected_result_in_register =
1338                 (expected_result_in_register & mask) | (kUndisturbedResult & ~mask);
1339           } else {
1340             expected_result_in_register |= ~mask;
1341           }
1342           // Mask registers are always processing tail like vta is set.
1343           if (vlmax != 128) {
1344             expected_result_in_register |= MakeBitmaskFromVl(vl);
1345           }
1346           if (vlmul == 2) {
1347             const SIMD128 start_mask = MakeBitmaskFromVl(vstart);
1348             expected_result_in_register =
1349                 (kUndisturbedResult & ~start_mask) | (expected_result_in_register & start_mask);
1350           }
1351           EXPECT_EQ(result[0], expected_result_in_register);
1352         }
1353       }
1354     }
1355   };
1356 
1357   ((Verify(exec_insn,
1358            BitUtilLog2(sizeof(__uint128_t) / sizeof(ExpectedResultType)),
1359            expected_result,
1360            kNoMask[0]),
1361     Verify(exec_masked_insn,
1362            BitUtilLog2(sizeof(__uint128_t) / sizeof(ExpectedResultType)),
1363            expected_result,
1364            kMask)),
1365    ...);
1366 }
1367 
TestVectorMaskTargetInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint32_t expected_result_int32,const uint16_t expected_result_int64,const SIMD128 (& source)[16])1368 void TestVectorMaskTargetInstruction(ExecInsnFunc exec_insn,
1369                                      ExecInsnFunc exec_masked_insn,
1370                                      const uint32_t expected_result_int32,
1371                                      const uint16_t expected_result_int64,
1372                                      const SIMD128 (&source)[16]) {
1373   TestVectorMaskTargetInstruction(
1374       exec_insn, exec_masked_insn, source, expected_result_int32, expected_result_int64);
1375 }
1376 
TestVectorMaskTargetInstruction(ExecInsnFunc exec_insn,ExecInsnFunc exec_masked_insn,const uint8_16_t expected_result_int8,const uint64_t expected_result_int16,const uint32_t expected_result_int32,const uint16_t expected_result_int64,const SIMD128 (& source)[16])1377 void TestVectorMaskTargetInstruction(ExecInsnFunc exec_insn,
1378                                      ExecInsnFunc exec_masked_insn,
1379                                      const uint8_16_t expected_result_int8,
1380                                      const uint64_t expected_result_int16,
1381                                      const uint32_t expected_result_int32,
1382                                      const uint16_t expected_result_int64,
1383                                      const SIMD128 (&source)[16]) {
1384   TestVectorMaskTargetInstruction(exec_insn,
1385                                   exec_masked_insn,
1386                                   source,
1387                                   expected_result_int8,
1388                                   expected_result_int16,
1389                                   expected_result_int32,
1390                                   expected_result_int64);
1391 }
1392 
1393 // clang-format off
1394 #define DEFINE_TWO_ARG_ONE_RES_FUNCTION(Name, Asm) \
1395   [[gnu::naked]] void Exec##Name() {               \
1396     asm(#Asm " v8, v16, v24\n\t"                   \
1397         "ret\n\t");                                \
1398   }                                                \
1399   [[gnu::naked]] void ExecMasked##Name() {         \
1400     asm(#Asm " v8, v16, v24, v0.t\n\t"             \
1401         "ret\n\t");                                \
1402   }
1403 // clang-format on
1404 
1405 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredsum, vredsum.vs)
1406 
TEST(InlineAsmTestRiscv64,TestVredsum)1407 TEST(InlineAsmTestRiscv64, TestVredsum) {
1408   TestVectorReductionInstruction(
1409       ExecVredsum,
1410       ExecMaskedVredsum,
1411       // expected_result_vd0_int8
1412       {242, 228, 200, 144, /* unused */ 0, 146, 44, 121},
1413       // expected_result_vd0_int16
1414       {0x0172, 0x82e4, 0x88c8, 0xa090, /* unused */ 0, 0x1300, 0xa904, 0xe119},
1415       // expected_result_vd0_int32
1416       {0xcb44'b932,
1417        0x9407'71e4,
1418        0xa70e'64c8,
1419        0xd312'5090,
1420        /* unused */ 0,
1421        /* unused */ 0,
1422        0x1907'1300,
1423        0xb713'ad09},
1424       // expected_result_vd0_int64
1425       {0xb32f'a926'9f1b'9511,
1426        0x1f99'0d88'fb74'e962,
1427        0xb92c'970e'74e8'52c4,
1428        0xef4e'ad14'6aca'2888,
1429        /* unused */ 0,
1430        /* unused */ 0,
1431        /* unused */ 0,
1432        0x2513'1f0e'1907'1300},
1433       // expected_result_vd0_with_mask_int8
1434       {39, 248, 142, 27, /* unused */ 0, 0, 154, 210},
1435       // expected_result_vd0_with_mask_int16
1436       {0x5f45, 0xc22f, 0x99d0, 0x98bf, /* unused */ 0, 0x1300, 0x1300, 0x4b15},
1437       // expected_result_vd0_with_mask_int32
1438       {0x2d38'1f29,
1439        0x99a1'838a,
1440        0x1989'ef5c,
1441        0x9cf4'4aa1,
1442        /* unused */ 0,
1443        /* unused */ 0,
1444        0x1907'1300,
1445        0x1907'1300},
1446       // expected_result_vd0_with_mask_int64
1447       {0x2513'1f0e'1907'1300,
1448        0x917c'8370'7560'6751,
1449        0x4e56'3842'222a'0c13,
1450        0xc833'9e0e'73df'49b5,
1451        /* unused */ 0,
1452        /* unused */ 0,
1453        /* unused */ 0,
1454        0x2513'1f0e'1907'1300},
1455       kVectorCalculationsSource);
1456 }
1457 
1458 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vfredosum, vfredosum.vs)
1459 
TEST(InlineAsmTestRiscv64,TestVfredosum)1460 TEST(InlineAsmTestRiscv64, TestVfredosum) {
1461   TestVectorReductionInstruction(ExecVfredosum,
1462                                  ExecMaskedVfredosum,
1463                                  // expected_result_vd0_int32
1464                                  {0x9e0c'9a8e,
1465                                   0xbe2c'bace,
1466                                   0xfe6c'fb4e,
1467                                   0x7e6b'fc4d,
1468                                   /* unused */ 0,
1469                                   /* unused */ 0,
1470                                   0x9604'9200,
1471                                   0x9e0c'9a8e},
1472                                  // expected_result_vd0_int64
1473                                  {0x9e0c'9a09'9604'9200,
1474                                   0xbe2c'ba29'b624'b220,
1475                                   0xfe6c'fa69'f664'f260,
1476                                   0x7eec'5def'0cee'0dee,
1477                                   /* unused */ 0,
1478                                   /* unused */ 0,
1479                                   /* unused */ 0,
1480                                   0x9e0c'9a09'9604'9200},
1481                                  // expected_result_vd0_with_mask_int32
1482                                  {0x9604'929d,
1483                                   0xbe2c'ba29,
1484                                   0xfe6c'fb4e,
1485                                   0x7e6b'fa84,
1486                                   /* unused */ 0,
1487                                   /* unused */ 0,
1488                                   0x9604'9200,
1489                                   0x9604'9200},
1490                                  // expected_result_vd0_with_mask_int64
1491                                  {0x9e0c'9a09'9604'9200,
1492                                   0xbe2c'ba29'b624'b220,
1493                                   0xee7c'ea78'e674'e271,
1494                                   0x6efc'4e0d'ee0d'ee0f,
1495                                   /* unused */ 0,
1496                                   /* unused */ 0,
1497                                   /* unused */ 0,
1498                                   0x9e0c'9a09'9604'9200},
1499                                  kVectorCalculationsSource);
1500 }
1501 
1502 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vfredusum, vfredusum.vs)
1503 
1504 // Currently Vfredusum is implemented as Vfredosum (as explicitly permitted by RVV 1.0).
1505 // If we would implement some speedups which would change results then we may need to alter tests.
TEST(InlineAsmTestRiscv64,TestVfredusum)1506 TEST(InlineAsmTestRiscv64, TestVfredusum) {
1507   TestVectorReductionInstruction(ExecVfredusum,
1508                                  ExecMaskedVfredusum,
1509                                  // expected_result_vd0_int32
1510                                  {0x9e0c'9a8e,
1511                                   0xbe2c'bace,
1512                                   0xfe6c'fb4e,
1513                                   0x7e6b'fc4d,
1514                                   /* unused */ 0,
1515                                   /* unused */ 0,
1516                                   0x9604'9200,
1517                                   0x9e0c'9a8e},
1518                                  // expected_result_vd0_int64
1519                                  {0x9e0c'9a09'9604'9200,
1520                                   0xbe2c'ba29'b624'b220,
1521                                   0xfe6c'fa69'f664'f260,
1522                                   0x7eec'5def'0cee'0dee,
1523                                   /* unused */ 0,
1524                                   /* unused */ 0,
1525                                   /* unused */ 0,
1526                                   0x9e0c'9a09'9604'9200},
1527                                  // expected_result_vd0_with_mask_int32
1528                                  {0x9604'929d,
1529                                   0xbe2c'ba29,
1530                                   0xfe6c'fb4e,
1531                                   0x7e6b'fa84,
1532                                   /* unused */ 0,
1533                                   /* unused */ 0,
1534                                   0x9604'9200,
1535                                   0x9604'9200},
1536                                  // expected_result_vd0_with_mask_int64
1537                                  {0x9e0c'9a09'9604'9200,
1538                                   0xbe2c'ba29'b624'b220,
1539                                   0xee7c'ea78'e674'e271,
1540                                   0x6efc'4e0d'ee0d'ee0f,
1541                                   /* unused */ 0,
1542                                   /* unused */ 0,
1543                                   /* unused */ 0,
1544                                   0x9e0c'9a09'9604'9200},
1545                                  kVectorCalculationsSource);
1546 }
1547 
1548 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredand, vredand.vs)
1549 
TEST(InlineAsmTestRiscv64,TestVredand)1550 TEST(InlineAsmTestRiscv64, TestVredand) {
1551   TestVectorReductionInstruction(
1552       ExecVredand,
1553       ExecMaskedVredand,
1554       // expected_result_vd0_int8
1555       {0, 0, 0, 0, /* unused */ 0, 0, 0, 0},
1556       // expected_result_vd0_int16
1557       {0x8000, 0x8000, 0x8000, 0x0000, /* unused */ 0, 0x8000, 0x8000, 0x8000},
1558       // expected_result_vd0_int32
1559       {0x8200'8000,
1560        0x8200'8000,
1561        0x8200'8000,
1562        0x0200'0000,
1563        /* unused */ 0,
1564        /* unused */ 0,
1565        0x8200'8000,
1566        0x8200'8000},
1567       // expected_result_vd0_int64
1568       {0x8604'8000'8200'8000,
1569        0x8604'8000'8200'8000,
1570        0x8604'8000'8200'8000,
1571        0x0604'0000'0200'0000,
1572        /* unused */ 0,
1573        /* unused */ 0,
1574        /* unused */ 0,
1575        0x8604'8000'8200'8000},
1576       // expected_result_vd0_with_mask_int8
1577       {0, 0, 0, 0, /* unused */ 0, 0, 0, 0},
1578       // expected_result_vd0_with_mask_int16
1579       {0x8000, 0x8000, 0x8000, 0x0000, /* unused */ 0, 0x8000, 0x8000, 0x8000},
1580       // expected_result_vd0_with_mask_int32
1581       {0x8200'8000,
1582        0x8200'8000,
1583        0x8200'8000,
1584        0x0200'0000,
1585        /* unused */ 0,
1586        /* unused */ 0,
1587        0x8200'8000,
1588        0x8200'8000},
1589       // expected_result_vd0_with_mask_int64
1590       {0x8604'8000'8200'8000,
1591        0x8604'8000'8200'8000,
1592        0x8604'8000'8200'8000,
1593        0x0604'0000'0200'0000,
1594        /* unused */ 0,
1595        /* unused */ 0,
1596        /* unused */ 0,
1597        0x8604'8000'8200'8000},
1598       kVectorCalculationsSource);
1599 }
1600 
1601 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredor, vredor.vs)
1602 
TEST(InlineAsmTestRiscv64,TestVredor)1603 TEST(InlineAsmTestRiscv64, TestVredor) {
1604   TestVectorReductionInstruction(
1605       ExecVredor,
1606       ExecMaskedVredor,
1607       // expected_result_vd0_int8
1608       {159, 191, 255, 255, /* unused */ 0, 146, 150, 159},
1609       // expected_result_vd0_int16
1610       {0x9f1d, 0xbf3d, 0xff7d, 0xfffd, /* unused */ 0, 0x9300, 0x9704, 0x9f0d},
1611       // expected_result_vd0_int32
1612       {0x9f1e'9b19,
1613        0xbf3e'bb39,
1614        0xff7e'fb79,
1615        0xfffe'fbf9,
1616        /* unused */ 0,
1617        /* unused */ 0,
1618        0x9706'9300,
1619        0x9f0e'9b09},
1620       // expected_result_vd0_int64
1621       {0x9f1e'9f1d'9716'9311,
1622        0xbf3e'bf3d'b736'b331,
1623        0xff7e'ff7d'f776'f371,
1624        0xfffe'fffd'f7f6'f3f1,
1625        /* unused */ 0,
1626        /* unused */ 0,
1627        /* unused */ 0,
1628        0x9f0e'9f0d'9706'9300},
1629       // expected_result_vd0_with_mask_int8
1630       {159, 191, 255, 255, /* unused */ 0, 0, 150, 158},
1631       // expected_result_vd0_with_mask_int16
1632       {0x9f1d, 0xbf3d, 0xff7d, 0xfffd, /* unused */ 0, 0x9300, 0x9300, 0x9f0d},
1633       // expected_result_vd0_with_mask_int32
1634       {0x9f1e'9b19,
1635        0xbf3e'bb39,
1636        0xff7e'fb79,
1637        0xfffe'fbf9,
1638        /* unused */ 0,
1639        /* unused */ 0,
1640        0x9706'9300,
1641        0x9706'9300},
1642       // expected_result_vd0_with_mask_int64
1643       {0x9f0e'9f0d'9706'9300,
1644        0xbf3e'bf3d'b736'b331,
1645        0xff7e'ff7d'f776'f371,
1646        0xfffe'fffd'f7f6'f3f1,
1647        /* unused */ 0,
1648        /* unused */ 0,
1649        /* unused */ 0,
1650        0x9f0e'9f0d'9706'9300},
1651       kVectorCalculationsSource);
1652 }
1653 
1654 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredxor, vredxor.vs)
1655 
TEST(InlineAsmTestRiscv64,TestVredxor)1656 TEST(InlineAsmTestRiscv64, TestVredxor) {
1657   TestVectorReductionInstruction(
1658       ExecVredxor,
1659       ExecMaskedVredxor,
1660       // expected_result_vd0_int8
1661       {0, 0, 0, 0, /* unused */ 0, 146, 0, 1},
1662       // expected_result_vd0_int16
1663       {0x8100, 0x8100, 0x8100, 0x8100, /* unused */ 0, 0x1300, 0x8504, 0x8101},
1664       // expected_result_vd0_int32
1665       {0x8302'8100,
1666        0x8302'8100,
1667        0x8302'8100,
1668        0x8302'8100,
1669        /* unused */ 0,
1670        /* unused */ 0,
1671        0x1506'1300,
1672        0x8b0a'8909},
1673       // expected_result_vd0_int64
1674       {0x9716'9515'9312'9111,
1675        0x8706'8504'8302'8100,
1676        0x8706'8504'8302'8100,
1677        0x8706'8504'8302'8100,
1678        /* unused */ 0,
1679        /* unused */ 0,
1680        /* unused */ 0,
1681        0x190a'1f0d'1506'1300},
1682       // expected_result_vd0_with_mask_int8
1683       {143, 154, 150, 43, /* unused */ 0, 0, 146, 150},
1684       // expected_result_vd0_with_mask_int16
1685       {0x1f0d, 0xbd3d, 0x9514, 0x8d0d, /* unused */ 0, 0x1300, 0x1300, 0x1705},
1686       // expected_result_vd0_with_mask_int32
1687       {0x1d0e'1b09,
1688        0x0d1e'0b18,
1689        0xfb7a'f978,
1690        0xab2a'a929,
1691        /* unused */ 0,
1692        /* unused */ 0,
1693        0x1506'1300,
1694        0x1506'1300},
1695       // expected_result_vd0_with_mask_int64
1696       {0x190a'1f0d'1506'1300,
1697        0x091a'0f1c'0516'0311,
1698        0x293a'2f3c'2536'2331,
1699        0x77f6'75f5'73f2'71f1,
1700        /* unused */ 0,
1701        /* unused */ 0,
1702        /* unused */ 0,
1703        0x190a'1f0d'1506'1300},
1704       kVectorCalculationsSource);
1705 }
1706 
1707 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredminu, vredminu.vs)
1708 
TEST(InlineAsmTestRiscv64,TestVredminu)1709 TEST(InlineAsmTestRiscv64, TestVredminu) {
1710   TestVectorReductionInstruction(
1711       ExecVredminu,
1712       ExecMaskedVredminu,
1713       // expected_result_vd0_int8
1714       {0, 0, 0, 0, /* unused */ 0, 0, 0, 0},
1715       // expected_result_vd0_int16
1716       {0x8100, 0x8100, 0x8100, 0x0291, /* unused */ 0, 0x8100, 0x8100, 0x8100},
1717       // expected_result_vd0_int32
1718       {0x83028100,
1719        0x83028100,
1720        0x83028100,
1721        0x06940291,
1722        /* unused */ 0,
1723        /* unused */ 0,
1724        0x83028100,
1725        0x83028100},
1726       // expected_result_vd0_int64
1727       {0x8706'8504'8302'8100,
1728        0x8706'8504'8302'8100,
1729        0x8706'8504'8302'8100,
1730        0x0e9c'0a98'0694'0291,
1731        /* unused */ 0,
1732        /* unused */ 0,
1733        /* unused */ 0,
1734        0x8706'8504'8302'8100},
1735       // expected_result_vd0_with_mask_int8
1736       {0, 0, 0, 0, /* unused */ 0, 0, 0, 0},
1737       // expected_result_vd0_with_mask_int16
1738       {0x8100, 0x8100, 0x8100, 0x0291, /* unused */ 0, 0x8100, 0x8100, 0x8100},
1739       // expected_result_vd0_with_mask_int32
1740       {0x8302'8100,
1741        0x8302'8100,
1742        0x8302'8100,
1743        0x0e9c'0a98,
1744        /* unused */ 0,
1745        /* unused */ 0,
1746        0x8302'8100,
1747        0x8302'8100},
1748       // expected_result_vd0_with_mask_int64
1749       {0x8706'8504'8302'8100,
1750        0x8706'8504'8302'8100,
1751        0x8706'8504'8302'8100,
1752        0x1e8c'1a89'1684'1280,
1753        /* unused */ 0,
1754        /* unused */ 0,
1755        /* unused */ 0,
1756        0x8706'8504'8302'8100},
1757       kVectorCalculationsSource);
1758 }
1759 
1760 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredmin, vredmin.vs)
1761 
TEST(InlineAsmTestRiscv64,TestVredmin)1762 TEST(InlineAsmTestRiscv64, TestVredmin) {
1763   TestVectorReductionInstruction(
1764       ExecVredmin,
1765       ExecMaskedVredmin,
1766       // expected_result_vd0_int8
1767       {130, 130, 130, 128, /* unused */ 0, 146, 146, 146},
1768       // expected_result_vd0_int16
1769       {0x8100, 0x8100, 0x8100, 0x8100, /* unused */ 0, 0x8100, 0x8100, 0x8100},
1770       // expected_result_vd0_int32
1771       {0x8302'8100,
1772        0x8302'8100,
1773        0x8302'8100,
1774        0x8302'8100,
1775        /* unused */ 0,
1776        /* unused */ 0,
1777        0x8302'8100,
1778        0x8302'8100},
1779       // expected_result_vd0_int64
1780       {0x8706'8504'8302'8100,
1781        0x8706'8504'8302'8100,
1782        0x8706'8504'8302'8100,
1783        0x8706'8504'8302'8100,
1784        /* unused */ 0,
1785        /* unused */ 0,
1786        /* unused */ 0,
1787        0x8706'8504'8302'8100},
1788       // expected_result_vd0_with_mask_int8
1789       {138, 138, 138, 128, /* unused */ 0, 0, 150, 150},
1790       // expected_result_vd0_with_mask_int16
1791       {0x8100, 0x8100, 0x8100, 0x8100, /* unused */ 0, 0x8100, 0x8100, 0x8100},
1792       // expected_result_vd0_with_mask_int32
1793       {0x8302'8100,
1794        0x8302'8100,
1795        0x8302'8100,
1796        0x8302'8100,
1797        /* unused */ 0,
1798        /* unused */ 0,
1799        0x8302'8100,
1800        0x8302'8100},
1801       // expected_result_vd0_with_mask_int64
1802       {0x8706'8504'8302'8100,
1803        0x8706'8504'8302'8100,
1804        0x8706'8504'8302'8100,
1805        0x8706'8504'8302'8100,
1806        /* unused */ 0,
1807        /* unused */ 0,
1808        /* unused */ 0,
1809        0x8706'8504'8302'8100},
1810       kVectorCalculationsSource);
1811 }
1812 
1813 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vfredmin, vfredmin.vs)
1814 
TEST(InlineAsmTestRiscv64,TestVfredmin)1815 TEST(InlineAsmTestRiscv64, TestVfredmin) {
1816   TestVectorReductionInstruction(ExecVfredmin,
1817                                  ExecMaskedVfredmin,
1818                                  // expected_result_vd0_int32
1819                                  {0x9e0c'9a09,
1820                                   0xbe2c'ba29,
1821                                   0xfe6c'fa69,
1822                                   0xfe6c'fa69,
1823                                   /* unused */ 0,
1824                                   /* unused */ 0,
1825                                   0x9604'9200,
1826                                   0x9e0c'9a09},
1827                                  // expected_result_vd0_int64
1828                                  {0x9e0c'9a09'9604'9200,
1829                                   0xbe2c'ba29'b624'b220,
1830                                   0xfe6c'fa69'f664'f260,
1831                                   0xfe6c'fa69'f664'f260,
1832                                   /* unused */ 0,
1833                                   /* unused */ 0,
1834                                   /* unused */ 0,
1835                                   0x9e0c'9a09'9604'9200},
1836                                  // expected_result_vd0_with_mask_int32
1837                                  {0x9604'9200,
1838                                   0xbe2c'ba29,
1839                                   0xfe6c'fa69,
1840                                   0xfe6c'fa69,
1841                                   /* unused */ 0,
1842                                   /* unused */ 0,
1843                                   0x9604'9200,
1844                                   0x9604'9200},
1845                                  // expected_result_vd0_with_mask_int64
1846                                  {0x9e0c'9a09'9604'9200,
1847                                   0xbe2c'ba29'b624'b220,
1848                                   0xee7c'ea78'e674'e271,
1849                                   0xee7c'ea78'e674'e271,
1850                                   /* unused */ 0,
1851                                   /* unused */ 0,
1852                                   /* unused */ 0,
1853                                   0x9e0c'9a09'9604'9200},
1854                                  kVectorCalculationsSource);
1855 }
1856 
1857 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredmaxu, vredmaxu.vs)
1858 
TEST(InlineAsmTestRiscv64,TestVredmaxu)1859 TEST(InlineAsmTestRiscv64, TestVredmaxu) {
1860   TestVectorReductionInstruction(
1861       ExecVredmaxu,
1862       ExecMaskedVredmaxu,
1863       // expected_result_vd0_int8
1864       {158, 190, 254, 254, /* unused */ 0, 146, 150, 158},
1865       // expected_result_vd0_int16
1866       {0x9e0c, 0xbe2c, 0xfe6c, 0xfe6c, /* unused */ 0, 0x9200, 0x9604, 0x9e0c},
1867       // expected_result_vd0_int32
1868       {0x9e0c'9a09,
1869        0xbe2c'ba29,
1870        0xfe6c'fa69,
1871        0xfe6c'fa69,
1872        /* unused */ 0,
1873        /* unused */ 0,
1874        0x9604'9200,
1875        0x9e0c'9a09},
1876       // expected_result_vd0_int64
1877       {0x9e0c'9a09'9604'9200,
1878        0xbe2c'ba29'b624'b220,
1879        0xfe6c'fa69'f664'f260,
1880        0xfe6c'fa69'f664'f260,
1881        /* unused */ 0,
1882        /* unused */ 0,
1883        /* unused */ 0,
1884        0x9e0c'9a09'9604'9200},
1885       // expected_result_vd0_with_mask_int8
1886       {158, 186, 254, 254, /* unused */ 0, 0, 150, 158},
1887       // expected_result_vd0_with_mask_int16
1888       {0x9e0c, 0xba29, 0xfe6c, 0xfe6c, /* unused */ 0, 0x9200, 0x9200, 0x9e0c},
1889       // expected_result_vd0_with_mask_int32
1890       {0x9604'9200,
1891        0xbe2c'ba29,
1892        0xfe6c'fa69,
1893        0xfe6c'fa69,
1894        /* unused */ 0,
1895        /* unused */ 0,
1896        0x9604'9200,
1897        0x9604'9200},
1898       // expected_result_vd0_with_mask_int64
1899       {0x9e0c'9a09'9604'9200,
1900        0xbe2c'ba29'b624'b220,
1901        0xee7c'ea78'e674'e271,
1902        0xee7c'ea78'e674'e271,
1903        /* unused */ 0,
1904        /* unused */ 0,
1905        /* unused */ 0,
1906        0x9e0c'9a09'9604'9200},
1907       kVectorCalculationsSource);
1908 }
1909 
1910 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vredmax, vredmax.vs)
1911 
TEST(InlineAsmTestRiscv64,TestVredmax)1912 TEST(InlineAsmTestRiscv64, TestVredmax) {
1913   TestVectorReductionInstruction(
1914       ExecVredmax,
1915       ExecMaskedVredmax,
1916       // expected_result_vd0_int8
1917       {28, 60, 124, 126, /* unused */ 0, 0, 4, 12},
1918       // expected_result_vd0_int16
1919       {0x9e0c, 0xbe2c, 0xfe6c, 0x7eec, /* unused */ 0, 0x9200, 0x9604, 0x9e0c},
1920       // expected_result_vd0_int32
1921       {0x9e0c'9a09,
1922        0xbe2c'ba29,
1923        0xfe6c'fa69,
1924        0x7eec'7ae9,
1925        /* unused */ 0,
1926        /* unused */ 0,
1927        0x9604'9200,
1928        0x9e0c'9a09},
1929       // expected_result_vd0_int64
1930       {0x9e0c'9a09'9604'9200,
1931        0xbe2c'ba29'b624'b220,
1932        0xfe6c'fa69'f664'f260,
1933        0x7eec'7ae9'76e4'72e0,
1934        /* unused */ 0,
1935        /* unused */ 0,
1936        /* unused */ 0,
1937        0x9e0c'9a09'9604'9200},
1938       // expected_result_vd0_with_mask_int8
1939       {24, 52, 124, 126, /* unused */ 0, 0, 4, 4},
1940       // expected_result_vd0_with_mask_int16
1941       {0x9e0c, 0xba29, 0xfe6c, 0x7ae9, /* unused */ 0, 0x9200, 0x9200, 0x9e0c},
1942       // expected_result_vd0_with_mask_int32
1943       {0x9604'9200,
1944        0xbe2c'ba29,
1945        0xfe6c'fa69,
1946        0x7eec'7ae9,
1947        /* unused */ 0,
1948        /* unused */ 0,
1949        0x9604'9200,
1950        0x9604'9200},
1951       // expected_result_vd0_with_mask_int64
1952       {0x9e0c'9a09'9604'9200,
1953        0xbe2c'ba29'b624'b220,
1954        0xee7c'ea78'e674'e271,
1955        0x6efc'6af8'66f4'62f1,
1956        /* unused */ 0,
1957        /* unused */ 0,
1958        /* unused */ 0,
1959        0x9e0c'9a09'9604'9200},
1960       kVectorCalculationsSource);
1961 }
1962 
1963 DEFINE_TWO_ARG_ONE_RES_FUNCTION(Vfredmax, vfredmax.vs)
1964 
TEST(InlineAsmTestRiscv64,TestVfredmax)1965 TEST(InlineAsmTestRiscv64, TestVfredmax) {
1966   TestVectorReductionInstruction(ExecVfredmax,
1967                                  ExecMaskedVfredmax,
1968                                  // expected_result_vd0_int32
1969                                  {0x8302'8100,
1970                                   0x8302'8100,
1971                                   0x8302'8100,
1972                                   0x7eec'7ae9,
1973                                   /* unused */ 0,
1974                                   /* unused */ 0,
1975                                   0x8302'8100,
1976                                   0x8302'8100},
1977                                  // expected_result_vd0_int64
1978                                  {0x8706'8504'8302'8100,
1979                                   0x8706'8504'8302'8100,
1980                                   0x8706'8504'8302'8100,
1981                                   0x7eec'7ae9'76e4'72e0,
1982                                   /* unused */ 0,
1983                                   /* unused */ 0,
1984                                   /* unused */ 0,
1985                                   0x8706'8504'8302'8100},
1986                                  // expected_result_vd0_with_mask_int32
1987                                  {0x8302'8100,
1988                                   0x8302'8100,
1989                                   0x8302'8100,
1990                                   0x7eec'7ae9,
1991                                   /* unused */ 0,
1992                                   /* unused */ 0,
1993                                   0x8302'8100,
1994                                   0x8302'8100},
1995                                  // expected_result_vd0_with_mask_int64
1996                                  {0x8706'8504'8302'8100,
1997                                   0x8706'8504'8302'8100,
1998                                   0x8706'8504'8302'8100,
1999                                   0x6efc'6af8'66f4'62f1,
2000                                   /* unused */ 0,
2001                                   /* unused */ 0,
2002                                   /* unused */ 0,
2003                                   0x8706'8504'8302'8100},
2004                                  kVectorCalculationsSource);
2005 }
2006 
2007 #undef DEFINE_TWO_ARG_ONE_RES_FUNCTION
2008 
ExecVfsqrtv()2009 [[gnu::naked]] void ExecVfsqrtv() {
2010   asm("vfsqrt.v v8, v24\n\t"
2011       "ret\n\t");
2012 }
2013 
ExecMaskedVfsqrtv()2014 [[gnu::naked]] void ExecMaskedVfsqrtv() {
2015   asm("vfsqrt.v v8, v24, v0.t\n\t"
2016       "ret\n\t");
2017 }
2018 
TEST(InlineAsmTestRiscv64,TestVfsqrtv)2019 TEST(InlineAsmTestRiscv64, TestVfsqrtv) {
2020   TestVectorFloatInstruction(ExecVfsqrtv,
2021                              ExecMaskedVfsqrtv,
2022                              {{0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000},
2023                               {0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000},
2024                               {0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000},
2025                               {0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000, 0x7fc0'0000},
2026                               {0x2b02'052b, 0x2f05'ea47, 0x2309'a451, 0x270d'53b1},
2027                               {0x3b10'f937, 0x3f14'7a09, 0x3317'd8b1, 0x371b'31d0},
2028                               {0x4b1e'85c1, 0x4f21'bb83, 0x4324'd4da, 0x4727'ebbf},
2029                               {0x5b2b'0054, 0x5f2d'fb2f, 0x5330'dd9e, 0x5733'bf97}},
2030                              {{0x7ff8'0000'0000'0000, 0x7ff8'0000'0000'0000},
2031                               {0x7ff8'0000'0000'0000, 0x7ff8'0000'0000'0000},
2032                               {0x7ff8'0000'0000'0000, 0x7ff8'0000'0000'0000},
2033                               {0x7ff8'0000'0000'0000, 0x7ff8'0000'0000'0000},
2034                               {0x2f3d'fd15'c59f'19b3, 0x2745'2e80'5593'4661},
2035                               {0x3f4e'0e34'c013'd37a, 0x3755'3a9e'ffea'ec9f},
2036                               {0x4f5e'1f49'ff52'69b6, 0x4765'46b6'c2dc'cddd},
2037                               {0x5f6e'3055'93df'fb07, 0x5775'52c7'aa27'df73}},
2038                              kVectorCalculationsSource);
2039 }
2040 
ExecVfcvtxufv()2041 [[gnu::naked]] void ExecVfcvtxufv() {
2042   asm("vfcvt.xu.f.v v8, v24\n\t"
2043       "ret\n\t");
2044 }
2045 
ExecMaskedVfcvtxufv()2046 [[gnu::naked]] void ExecMaskedVfcvtxufv() {
2047   asm("vfcvt.xu.f.v v8, v24, v0.t\n\t"
2048       "ret\n\t");
2049 }
2050 
ExecVfcvtxfv()2051 [[gnu::naked]] void ExecVfcvtxfv() {
2052   asm("vfcvt.x.f.v v8, v24\n\t"
2053       "ret\n\t");
2054 }
2055 
ExecMaskedVfcvtxfv()2056 [[gnu::naked]] void ExecMaskedVfcvtxfv() {
2057   asm("vfcvt.x.f.v v8, v24, v0.t\n\t"
2058       "ret\n\t");
2059 }
2060 
ExecVfcvtfxuv()2061 [[gnu::naked]] void ExecVfcvtfxuv() {
2062   asm("vfcvt.f.xu.v v8, v24\n\t"
2063       "ret\n\t");
2064 }
2065 
ExecMaskedVfcvtfxuv()2066 [[gnu::naked]] void ExecMaskedVfcvtfxuv() {
2067   asm("vfcvt.f.xu.v v8, v24, v0.t\n\t"
2068       "ret\n\t");
2069 }
2070 
ExecVfcvtfxv()2071 [[gnu::naked]] void ExecVfcvtfxv() {
2072   asm("vfcvt.f.x.v v8, v24\n\t"
2073       "ret\n\t");
2074 }
2075 
ExecMaskedVfcvtfxv()2076 [[gnu::naked]] void ExecMaskedVfcvtfxv() {
2077   asm("vfcvt.f.x.v v8, v24, v0.t\n\t"
2078       "ret\n\t");
2079 }
2080 
ExecVfcvtrtzxuf()2081 [[gnu::naked]] void ExecVfcvtrtzxuf() {
2082   asm("vfcvt.rtz.xu.f.v v8, v24\n\t"
2083       "ret\n\t");
2084 }
2085 
ExecMaskedVfcvtrtzxuf()2086 [[gnu::naked]] void ExecMaskedVfcvtrtzxuf() {
2087   asm("vfcvt.rtz.xu.f.v v8, v24, v0.t\n\t"
2088       "ret\n\t");
2089 }
2090 
ExecVfcvtrtzxf()2091 [[gnu::naked]] void ExecVfcvtrtzxf() {
2092   asm("vfcvt.rtz.x.f.v v8, v24\n\t"
2093       "ret\n\t");
2094 }
2095 
ExecMaskedVfcvtrtzxf()2096 [[gnu::naked]] void ExecMaskedVfcvtrtzxf() {
2097   asm("vfcvt.rtz.x.f.v v8, v24, v0.t\n\t"
2098       "ret\n\t");
2099 }
2100 
ExecVfwcvtxufv()2101 [[gnu::naked]] void ExecVfwcvtxufv() {
2102   asm("vfwcvt.xu.f.v v8, v28\n\t"
2103       "ret\n\t");
2104 }
2105 
ExecMaskedVfwcvtxufv()2106 [[gnu::naked]] void ExecMaskedVfwcvtxufv() {
2107   asm("vfwcvt.xu.f.v v8, v28, v0.t\n\t"
2108       "ret\n\t");
2109 }
2110 
ExecVfwcvtxfv()2111 [[gnu::naked]] void ExecVfwcvtxfv() {
2112   asm("vfwcvt.x.f.v v8, v24\n\t"
2113       "ret\n\t");
2114 }
2115 
ExecMaskedVfwcvtxfv()2116 [[gnu::naked]] void ExecMaskedVfwcvtxfv() {
2117   asm("vfwcvt.x.f.v v8, v24, v0.t\n\t"
2118       "ret\n\t");
2119 }
2120 
ExecVfwcvtffv()2121 [[gnu::naked]] void ExecVfwcvtffv() {
2122   asm("vfwcvt.f.f.v v8, v24\n\t"
2123       "ret\n\t");
2124 }
2125 
ExecMaskedVfwcvtffv()2126 [[gnu::naked]] void ExecMaskedVfwcvtffv() {
2127   asm("vfwcvt.f.f.v v8, v24, v0.t\n\t"
2128       "ret\n\t");
2129 }
2130 
ExecVfwcvtfxuv()2131 [[gnu::naked]] void ExecVfwcvtfxuv() {
2132   asm("vfwcvt.f.xu.v v8, v24\n\t"
2133       "ret\n\t");
2134 }
2135 
ExecMaskedVfwcvtfxuv()2136 [[gnu::naked]] void ExecMaskedVfwcvtfxuv() {
2137   asm("vfwcvt.f.xu.v v8, v24, v0.t\n\t"
2138       "ret\n\t");
2139 }
2140 
ExecVfwcvtfxv()2141 [[gnu::naked]] void ExecVfwcvtfxv() {
2142   asm("vfwcvt.f.x.v v8, v24\n\t"
2143       "ret\n\t");
2144 }
2145 
ExecMaskedVfwcvtfxv()2146 [[gnu::naked]] void ExecMaskedVfwcvtfxv() {
2147   asm("vfwcvt.f.x.v v8, v24, v0.t\n\t"
2148       "ret\n\t");
2149 }
2150 
ExecVfwcvtrtzxuf()2151 [[gnu::naked]] void ExecVfwcvtrtzxuf() {
2152   asm("vfwcvt.rtz.xu.f.v v8, v28\n\t"
2153       "ret\n\t");
2154 }
2155 
ExecMaskedVfwcvtrtzxuf()2156 [[gnu::naked]] void ExecMaskedVfwcvtrtzxuf() {
2157   asm("vfwcvt.rtz.xu.f.v v8, v28, v0.t\n\t"
2158       "ret\n\t");
2159 }
2160 
ExecVfwcvtrtzxf()2161 [[gnu::naked]] void ExecVfwcvtrtzxf() {
2162   asm("vfwcvt.rtz.x.f.v v8, v24\n\t"
2163       "ret\n\t");
2164 }
2165 
ExecMaskedVfwcvtrtzxf()2166 [[gnu::naked]] void ExecMaskedVfwcvtrtzxf() {
2167   asm("vfwcvt.rtz.x.f.v v8, v24, v0.t\n\t"
2168       "ret\n\t");
2169 }
2170 
ExecVfncvtxufw()2171 [[gnu::naked]] void ExecVfncvtxufw() {
2172   asm("vfncvt.xu.f.w v8, v24\n\t"
2173       "ret\n\t");
2174 }
2175 
ExecMaskedVfncvtxufw()2176 [[gnu::naked]] void ExecMaskedVfncvtxufw() {
2177   asm("vfncvt.xu.f.w v8, v24, v0.t\n\t"
2178       "ret\n\t");
2179 }
2180 
ExecVfncvtxfw()2181 [[gnu::naked]] void ExecVfncvtxfw() {
2182   asm("vfncvt.x.f.w v8, v24\n\t"
2183       "ret\n\t");
2184 }
2185 
ExecMaskedVfncvtxfw()2186 [[gnu::naked]] void ExecMaskedVfncvtxfw() {
2187   asm("vfncvt.x.f.w v8, v24, v0.t\n\t"
2188       "ret\n\t");
2189 }
2190 
ExecVfncvtffw()2191 [[gnu::naked]] void ExecVfncvtffw() {
2192   asm("vfncvt.f.f.w v8, v24\n\t"
2193       "ret\n\t");
2194 }
2195 
ExecMaskedVfncvtffw()2196 [[gnu::naked]] void ExecMaskedVfncvtffw() {
2197   asm("vfncvt.f.f.w v8, v24, v0.t\n\t"
2198       "ret\n\t");
2199 }
2200 
ExecVfncvtfxuw()2201 [[gnu::naked]] void ExecVfncvtfxuw() {
2202   asm("vfncvt.f.xu.w v8, v24\n\t"
2203       "ret\n\t");
2204 }
2205 
ExecMaskedVfncvtfxuw()2206 [[gnu::naked]] void ExecMaskedVfncvtfxuw() {
2207   asm("vfncvt.f.xu.w v8, v24, v0.t\n\t"
2208       "ret\n\t");
2209 }
2210 
ExecVfncvtfxw()2211 [[gnu::naked]] void ExecVfncvtfxw() {
2212   asm("vfncvt.f.x.w v8, v24\n\t"
2213       "ret\n\t");
2214 }
2215 
ExecMaskedVfncvtfxw()2216 [[gnu::naked]] void ExecMaskedVfncvtfxw() {
2217   asm("vfncvt.f.x.w v8, v24, v0.t\n\t"
2218       "ret\n\t");
2219 }
2220 
ExecVfncvtrtzxuf()2221 [[gnu::naked]] void ExecVfncvtrtzxuf() {
2222   asm("vfncvt.rtz.xu.f.w v8, v24\n\t"
2223       "ret\n\t");
2224 }
2225 
ExecMaskedVfncvtrtzxuf()2226 [[gnu::naked]] void ExecMaskedVfncvtrtzxuf() {
2227   asm("vfncvt.rtz.xu.f.w v8, v24, v0.t\n\t"
2228       "ret\n\t");
2229 }
2230 
ExecVfncvtrtzxfw()2231 [[gnu::naked]] void ExecVfncvtrtzxfw() {
2232   asm("vfncvt.rtz.x.f.w v8, v24\n\t"
2233       "ret\n\t");
2234 }
2235 
ExecMaskedVfncvtrtzxfw()2236 [[gnu::naked]] void ExecMaskedVfncvtrtzxfw() {
2237   asm("vfncvt.rtz.x.f.w v8, v24, v0.t\n\t"
2238       "ret\n\t");
2239 }
2240 
TEST(InlineAsmTestRiscv64,TestVfcvtxfv)2241 TEST(InlineAsmTestRiscv64, TestVfcvtxfv) {
2242   TestVectorFloatInstruction(ExecVfcvtxufv,
2243                              ExecMaskedVfcvtxufv,
2244                              {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2245                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2246                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2247                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2248                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2249                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2250                               {0xffff'ffff, 0xffff'ffff, 0x0000'6a21, 0x6e25'6c00},
2251                               {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
2252                              {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2253                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2254                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2255                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2256                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2257                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2258                               {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
2259                               {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
2260                              kVectorCalculationsSource);
2261   TestVectorFloatInstruction(ExecVfcvtxfv,
2262                              ExecMaskedVfcvtxfv,
2263                              {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2264                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2265                               {0x8000'0000, 0x8000'0000, 0xffff'cacf, 0xc8cd'6a00},
2266                               {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
2267                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2268                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2269                               {0x7fff'ffff, 0x7fff'ffff, 0x0000'6a21, 0x6e25'6c00},
2270                               {0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff}},
2271                              {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2272                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2273                               {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
2274                               {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
2275                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2276                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2277                               {0x7fff'ffff'ffff'ffff, 0x7fff'ffff'ffff'ffff},
2278                               {0x7fff'ffff'ffff'ffff, 0x7fff'ffff'ffff'ffff}},
2279                              kVectorCalculationsSource);
2280   TestVectorFloatInstruction(ExecVfcvtfxuv,
2281                              ExecMaskedVfcvtfxuv,
2282                              {{0x4f16'0492, 0x4f1e'0c9a, 0x4f06'1482, 0x4f0e'1c8a},
2283                               {0x4f36'24b2, 0x4f3e'2cba, 0x4f26'34a2, 0x4f2e'3caa},
2284                               {0x4f56'44d2, 0x4f5e'4cda, 0x4f46'54c2, 0x4f4e'5cca},
2285                               {0x4f76'64f2, 0x4f7e'6cfa, 0x4f66'74e2, 0x4f6e'7cea},
2286                               {0x4db4'2094, 0x4df4'60d4, 0x4cd2'8052, 0x4d69'c0aa},
2287                               {0x4e5a'90ca, 0x4e7a'b0eb, 0x4e1a'd08b, 0x4e3a'f0ab},
2288                               {0x4ead'88a6, 0x4ebd'98b6, 0x4e8d'a886, 0x4e9d'b896},
2289                               {0x4eed'c8e6, 0x4efd'd8f6, 0x4ecd'e8c6, 0x4edd'f8d6}},
2290                              {{0x43e3'c193'4132'c092, 0x43e1'c391'4310'c290},
2291                               {0x43e7'c597'4536'c496, 0x43e5'c795'4714'c694},
2292                               {0x43eb'c99b'493a'c89a, 0x43e9'cb99'4b18'ca98},
2293                               {0x43ef'cd9f'4d3e'cc9e, 0x43ed'cf9d'4f1c'ce9c},
2294                               {0x43be'8c1a'8916'8412, 0x43ad'3815'300d'2805},
2295                               {0x43cf'561d'549b'5219, 0x43c7'5e15'5c13'5a11},
2296                               {0x43d7'b316'b255'b115, 0x43d3'b712'b611'b511},
2297                               {0x43df'bb1e'ba5d'b91d, 0x43db'bf1a'be19'bd19}},
2298                              kVectorCalculationsSource);
2299   TestVectorFloatInstruction(ExecVfcvtfxv,
2300                              ExecMaskedVfcvtfxv,
2301                              {{0xced3'f6dc, 0xcec3'e6cc, 0xcef3'd6fc, 0xcee3'c6ec},
2302                               {0xce93'b69c, 0xce83'a68c, 0xceb3'96bc, 0xcea3'86ac},
2303                               {0xce26'ecb7, 0xce06'cc97, 0xce66'acf7, 0xce46'8cd7},
2304                               {0xcd19'b0da, 0xcbc9'82cc, 0xcdcc'58ec, 0xcd8c'18ac},
2305                               {0x4db4'2094, 0x4df4'60d4, 0x4cd2'8052, 0x4d69'c0aa},
2306                               {0x4e5a'90ca, 0x4e7a'b0eb, 0x4e1a'd08b, 0x4e3a'f0ab},
2307                               {0x4ead'88a6, 0x4ebd'98b6, 0x4e8d'a886, 0x4e9d'b896},
2308                               {0x4eed'c8e6, 0x4efd'd8f6, 0x4ecd'e8c6, 0x4edd'f8d6}},
2309                              {{0xc3d8'7cd9'7d9a'7edc, 0xc3dc'78dd'79de'7adf},
2310                               {0xc3d0'74d1'7592'76d3, 0xc3d4'70d5'71d6'72d7},
2311                               {0xc3c0'd992'db14'dd97, 0xc3c8'd19a'd39c'd59f},
2312                               {0xc379'3059'6099'b0da, 0xc3b1'8315'8719'8b1e},
2313                               {0x43be'8c1a'8916'8412, 0x43ad'3815'300d'2805},
2314                               {0x43cf'561d'549b'5219, 0x43c7'5e15'5c13'5a11},
2315                               {0x43d7'b316'b255'b115, 0x43d3'b712'b611'b511},
2316                               {0x43df'bb1e'ba5d'b91d, 0x43db'bf1a'be19'bd19}},
2317                              kVectorCalculationsSource);
2318   TestVectorFloatInstruction(ExecVfcvtrtzxuf,
2319                              ExecMaskedVfcvtrtzxuf,
2320                              {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2321                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2322                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2323                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2324                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2325                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2326                               {0xffff'ffff, 0xffff'ffff, 0x0000'6a21, 0x6e25'6c00},
2327                               {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
2328                              {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2329                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2330                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2331                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2332                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2333                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2334                               {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
2335                               {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
2336                              kVectorCalculationsSource);
2337   TestVectorFloatInstruction(ExecVfcvtrtzxf,
2338                              ExecMaskedVfcvtrtzxf,
2339                              {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2340                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2341                               {0x8000'0000, 0x8000'0000, 0xffff'cad0, 0xc8cd'6a00},
2342                               {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
2343                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2344                               {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2345                               {0x7fff'ffff, 0x7fff'ffff, 0x0000'6a21, 0x6e25'6c00},
2346                               {0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff}},
2347                              {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2348                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2349                               {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
2350                               {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
2351                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2352                               {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2353                               {0x7fff'ffff'ffff'ffff, 0x7fff'ffff'ffff'ffff},
2354                               {0x7fff'ffff'ffff'ffff, 0x7fff'ffff'ffff'ffff}},
2355                              kVectorCalculationsSource);
2356   TestWideningVectorFloatInstruction(ExecVfwcvtxufv,
2357                                      ExecMaskedVfwcvtxufv,
2358                                      {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2359                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2360                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2361                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2362                                       {0x0000'6229'6000'0000, 0x662d'6480'0000'0000},
2363                                       {0x0000'0000'0000'6a21, 0x0000'0000'6e25'6c00},
2364                                       {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
2365                                       {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
2366                                      kVectorCalculationsSource);
2367   TestWideningVectorFloatInstruction(ExecVfwcvtxfv,
2368                                      ExecMaskedVfwcvtxfv,
2369                                      {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2370                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2371                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2372                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2373                                       {0xffff'cecb'7000'0000, 0xccc9'6dc0'0000'0000},
2374                                       {0xffff'ffff'ffff'cacf, 0xffff'ffff'c8cd'6a00},
2375                                       {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
2376                                       {0x8000'0000'0000'0000, 0x8000'0000'0000'0000}},
2377                                      kVectorCalculationsSource);
2378   TestWideningVectorFloatInstruction(ExecVfwcvtffv,
2379                                      ExecMaskedVfwcvtffv,
2380                                      {{0xbac0'9240'0000'0000, 0xbbc1'9341'2000'0000},
2381                                       {0xb8c2'9042'2000'0000, 0xb9c3'9143'0000'0000},
2382                                       {0xbec4'9644'0000'0000, 0xbfc5'9745'2000'0000},
2383                                       {0xbcc6'9446'2000'0000, 0xbdc7'9547'0000'0000},
2384                                       {0xc2c8'9a48'0000'0000, 0xc3c9'9b49'2000'0000},
2385                                       {0xc0ca'984a'2000'0000, 0xc1cb'994b'0000'0000},
2386                                       {0xc6cc'9e4c'0000'0000, 0xc7cd'9f4d'2000'0000},
2387                                       {0xc4ce'9c4e'2000'0000, 0xc5cf'9d4f'0000'0000}},
2388                                      kVectorCalculationsSource);
2389   TestWideningVectorFloatInstruction(ExecVfwcvtfxuv,
2390                                      ExecMaskedVfwcvtfxuv,
2391                                      {{0x4712'0000, 0x4716'0400, 0x471a'0900, 0x471e'0c00},
2392                                       {0x4702'1100, 0x4706'1400, 0x470a'1800, 0x470e'1c00},
2393                                       {0x4732'2000, 0x4736'2400, 0x473a'2900, 0x473e'2c00},
2394                                       {0x4722'3100, 0x4726'3400, 0x472a'3800, 0x472e'3c00},
2395                                       {0x4752'4000, 0x4756'4400, 0x475a'4900, 0x475e'4c00},
2396                                       {0x4742'5100, 0x4746'5400, 0x474a'5800, 0x474e'5c00},
2397                                       {0x4772'6000, 0x4776'6400, 0x477a'6900, 0x477e'6c00},
2398                                       {0x4762'7100, 0x4766'7400, 0x476a'7800, 0x476e'7c00}},
2399                                      {{0x41e2'c092'4000'0000, 0x41e3'c193'4120'0000},
2400                                       {0x41e0'c290'4220'0000, 0x41e1'c391'4300'0000},
2401                                       {0x41e6'c496'4400'0000, 0x41e7'c597'4520'0000},
2402                                       {0x41e4'c694'4620'0000, 0x41e5'c795'4700'0000},
2403                                       {0x41ea'c89a'4800'0000, 0x41eb'c99b'4920'0000},
2404                                       {0x41e8'ca98'4a20'0000, 0x41e9'cb99'4b00'0000},
2405                                       {0x41ee'cc9e'4c00'0000, 0x41ef'cd9f'4d20'0000},
2406                                       {0x41ec'ce9c'4e20'0000, 0x41ed'cf9d'4f00'0000}},
2407                                      kVectorCalculationsSource);
2408   TestWideningVectorFloatInstruction(ExecVfwcvtfxv,
2409                                      ExecMaskedVfwcvtfxv,
2410                                      {{0xc6dc'0000, 0xc6d3'f800, 0xc6cb'ee00, 0xc6c3'e800},
2411                                       {0xc6fb'de00, 0xc6f3'd800, 0xc6eb'd000, 0xc6e3'c800},
2412                                       {0xc69b'c000, 0xc693'b800, 0xc68b'ae00, 0xc683'a800},
2413                                       {0xc6bb'9e00, 0xc6b3'9800, 0xc6ab'9000, 0xc6a3'8800},
2414                                       {0xc637'0000, 0xc626'f000, 0xc616'dc00, 0xc606'd000},
2415                                       {0xc676'bc00, 0xc666'b000, 0xc656'a000, 0xc646'9000},
2416                                       {0xc55a'0000, 0xc519'c000, 0xc4b2'e000, 0xc3ca'0000},
2417                                       {0xc5ec'7800, 0xc5cc'6000, 0xc5ac'4000, 0xc58c'2000}},
2418                                      {{0xc1da'7edb'8000'0000, 0xc1d8'7cd9'7dc0'0000},
2419                                       {0xc1de'7adf'7bc0'0000, 0xc1dc'78dd'7a00'0000},
2420                                       {0xc1d2'76d3'7800'0000, 0xc1d0'74d1'75c0'0000},
2421                                       {0xc1d6'72d7'73c0'0000, 0xc1d4'70d5'7200'0000},
2422                                       {0xc1c4'dd96'e000'0000, 0xc1c0'd992'db80'0000},
2423                                       {0xc1cc'd59e'd780'0000, 0xc1c8'd19a'd400'0000},
2424                                       {0xc1a3'361b'4000'0000, 0xc179'3059'7000'0000},
2425                                       {0xc1b9'8b1d'8f00'0000, 0xc1b1'8315'8800'0000}},
2426                                      kVectorCalculationsSource);
2427   TestWideningVectorFloatInstruction(ExecVfwcvtrtzxuf,
2428                                      ExecMaskedVfwcvtrtzxuf,
2429                                      {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2430                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2431                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2432                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2433                                       {0x0000'6229'6000'0000, 0x662d'6480'0000'0000},
2434                                       {0x0000'0000'0000'6a21, 0x0000'0000'6e25'6c00},
2435                                       {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
2436                                       {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
2437                                      kVectorCalculationsSource);
2438   TestWideningVectorFloatInstruction(ExecVfwcvtrtzxf,
2439                                      ExecMaskedVfwcvtrtzxf,
2440                                      {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2441                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2442                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2443                                       {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2444                                       {0xffff'cecb'7000'0000, 0xccc9'6dc0'0000'0000},
2445                                       {0xffff'ffff'ffff'cad0, 0xffff'ffff'c8cd'6a00},
2446                                       {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
2447                                       {0x8000'0000'0000'0000, 0x8000'0000'0000'0000}},
2448                                      kVectorCalculationsSource);
2449   TestNarrowingVectorFloatInstruction(
2450       ExecVfncvtxufw,
2451       ExecMaskedVfncvtxufw,
2452       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2453        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2454        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2455        {0xffff, 0xffff, 0x6a21, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
2456       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2457        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2458        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2459        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
2460       kVectorCalculationsSource);
2461   TestNarrowingVectorFloatInstruction(
2462       ExecVfncvtxfw,
2463       ExecMaskedVfncvtxfw,
2464       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2465        {0x8000, 0x8000, 0xcacf, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
2466        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2467        {0x7fff, 0x7fff, 0x6a21, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff}},
2468       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2469        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
2470        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2471        {0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff}},
2472       kVectorCalculationsSource);
2473   TestNarrowingVectorFloatInstruction(ExecVfncvtffw,
2474                                       ExecMaskedVfncvtffw,
2475                                       {{0x8000'0000, 0x8000'0000, 0xb165'd14e, 0x8000'0000},
2476                                        {0xff80'0000, 0xff80'0000, 0xff80'0000, 0xff80'0000},
2477                                        {0x0000'0000, 0x0000'0000, 0x3561'd54a, 0x0000'0000},
2478                                        {0x7f80'0000, 0x7f80'0000, 0x7f80'0000, 0x7f80'0000}},
2479                                       kVectorCalculationsSource);
2480   TestNarrowingVectorFloatInstruction(ExecVfncvtfxuw,
2481                                       ExecMaskedVfncvtfxuw,
2482                                       {{0x5f1e'0c9a, 0x5f0e'1c8a, 0x5f3e'2cba, 0x5f2e'3caa},
2483                                        {0x5f5e'4cda, 0x5f4e'5cca, 0x5f7e'6cfa, 0x5f6e'7cea},
2484                                        {0x5df4'60d4, 0x5d69'c0aa, 0x5e7a'b0eb, 0x5e3a'f0ab},
2485                                        {0x5ebd'98b6, 0x5e9d'b896, 0x5efd'd8f6, 0x5edd'f8d6}},
2486                                       kVectorCalculationsSource);
2487   TestNarrowingVectorFloatInstruction(ExecVfncvtfxw,
2488                                       ExecMaskedVfncvtfxw,
2489                                       {{0xdec3'e6cc, 0xdee3'c6ec, 0xde83'a68c, 0xdea3'86ac},
2490                                        {0xde06'cc97, 0xde46'8cd7, 0xdbc9'82cb, 0xdd8c'18ac},
2491                                        {0x5df4'60d4, 0x5d69'c0aa, 0x5e7a'b0eb, 0x5e3a'f0ab},
2492                                        {0x5ebd'98b6, 0x5e9d'b896, 0x5efd'd8f6, 0x5edd'f8d6}},
2493                                       kVectorCalculationsSource);
2494   TestNarrowingVectorFloatInstruction(
2495       ExecVfncvtrtzxuf,
2496       ExecMaskedVfncvtrtzxuf,
2497       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2498        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2499        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2500        {0xffff, 0xffff, 0x6a21, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
2501       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2502        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2503        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2504        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
2505       kVectorCalculationsSource);
2506   TestNarrowingVectorFloatInstruction(
2507       ExecVfncvtrtzxfw,
2508       ExecMaskedVfncvtrtzxfw,
2509       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2510        {0x8000, 0x8000, 0xcad0, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
2511        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2512        {0x7fff, 0x7fff, 0x6a21, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff}},
2513       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2514        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
2515        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2516        {0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff, 0x7fff'ffff}},
2517       kVectorCalculationsSource);
2518 }
2519 
ExecVid()2520 [[gnu::naked]] void ExecVid() {
2521   asm("vid.v v8\n\t"
2522       "ret\n\t");
2523 }
2524 
ExecMaskedVid()2525 [[gnu::naked]] void ExecMaskedVid() {
2526   asm("vid.v v8, v0.t\n\t"
2527       "ret\n\t");
2528 }
2529 
TEST(InlineAsmTestRiscv64,TestVid)2530 TEST(InlineAsmTestRiscv64, TestVid) {
2531   TestVectorInstruction(
2532       ExecVid,
2533       ExecMaskedVid,
2534       {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
2535        {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31},
2536        {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47},
2537        {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63},
2538        {64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79},
2539        {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95},
2540        {96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111},
2541        {112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127}},
2542       {{0, 1, 2, 3, 4, 5, 6, 7},
2543        {8, 9, 10, 11, 12, 13, 14, 15},
2544        {16, 17, 18, 19, 20, 21, 22, 23},
2545        {24, 25, 26, 27, 28, 29, 30, 31},
2546        {32, 33, 34, 35, 36, 37, 38, 39},
2547        {40, 41, 42, 43, 44, 45, 46, 47},
2548        {48, 49, 50, 51, 52, 53, 54, 55},
2549        {56, 57, 58, 59, 60, 61, 62, 63}},
2550       {{0, 1, 2, 3},
2551        {4, 5, 6, 7},
2552        {8, 9, 10, 11},
2553        {12, 13, 14, 15},
2554        {16, 17, 18, 19},
2555        {20, 21, 22, 23},
2556        {24, 25, 26, 27},
2557        {28, 29, 30, 31}},
2558       {{0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {12, 13}, {14, 15}},
2559       kVectorCalculationsSourceLegacy);
2560 }
2561 
ExecViotam()2562 [[gnu::naked]] void ExecViotam() {
2563   asm("viota.m v8, v16\n\t"
2564       "ret\n\t");
2565 }
2566 
ExecMaskedViotam()2567 [[gnu::naked]] void ExecMaskedViotam() {
2568   asm("viota.m v8, v16, v0.t\n\t"
2569       "ret\n\t");
2570 }
2571 
TEST(InlineAsmTestRiscv64,TestIota)2572 TEST(InlineAsmTestRiscv64, TestIota) {
2573   TestVectorIota<false>(ExecViotam,
2574                         {{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1},
2575                          {2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 5, 5},
2576                          {6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9},
2577                          {10, 10, 11, 12, 12, 12, 12, 12, 12, 13, 14, 15, 15, 15, 15, 15},
2578                          {16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19},
2579                          {20, 20, 21, 21, 22, 22, 22, 22, 22, 23, 24, 24, 25, 25, 25, 25},
2580                          {26, 26, 26, 27, 28, 28, 28, 28, 28, 29, 29, 30, 31, 31, 31, 31},
2581                          {32, 32, 33, 34, 35, 35, 35, 35, 35, 36, 37, 38, 39, 39, 39, 39}},
2582                         {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
2583                          {0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
2584                          {0x0002, 0x0002, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003},
2585                          {0x0003, 0x0004, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005},
2586                          {0x0006, 0x0006, 0x0006, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007},
2587                          {0x0007, 0x0008, 0x0008, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009},
2588                          {0x000a, 0x000a, 0x000b, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c},
2589                          {0x000c, 0x000d, 0x000e, 0x000f, 0x000f, 0x000f, 0x000f, 0x000f}},
2590                         {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2591                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
2592                          {0x0000'0000, 0x0000'0001, 0x0000'0001, 0x0000'0001},
2593                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
2594                          {0x0000'0002, 0x0000'0002, 0x0000'0003, 0x0000'0003},
2595                          {0x0000'0003, 0x0000'0003, 0x0000'0003, 0x0000'0003},
2596                          {0x0000'0003, 0x0000'0004, 0x0000'0005, 0x0000'0005},
2597                          {0x0000'0005, 0x0000'0005, 0x0000'0005, 0x0000'0005}},
2598                         {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2599                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2600                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2601                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2602                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0001},
2603                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
2604                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
2605                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001}},
2606                         kVectorCalculationsSource);
2607   TestVectorIota<true>(ExecMaskedViotam,
2608                        {{0, 0x55, 0, 0, 0x55, 0, 0x55, 0, 0, 0x55, 1, 0x55, 1, 1, 0x55, 1},
2609                         {2, 2, 0x55, 3, 0x55, 3, 3, 0x55, 3, 0x55, 4, 4, 0x55, 4, 0x55, 4},
2610                         {5, 0x55, 5, 0x55, 6, 6, 0x55, 6, 0x55, 6, 6, 0x55, 7, 0x55, 7, 7},
2611                         {8, 0x55, 8, 9, 0x55, 9, 0x55, 9, 9, 0x55, 10, 0x55, 11, 0x55, 11, 11},
2612                         {12, 0x55, 12, 0x55, 12, 12, 0x55, 12, 12, 13, 0x55, 13, 14, 14, 14, 0x55},
2613                         {14, 0x55, 14, 14, 0x55, 15, 15, 15, 0x55, 15, 16, 16, 17, 0x55, 17, 17},
2614                         {18, 18, 0x55, 18, 19, 19, 0x55, 19, 19, 20, 20, 0x55, 21, 0x55, 21, 0x55},
2615                         {21, 21, 22, 0x55, 23, 23, 23, 23, 0x55, 23, 0x55, 24, 0x55, 25, 25, 0x55}},
2616                        {{0x0000, 0x5555, 0x0000, 0x0000, 0x5555, 0x0000, 0x5555, 0x0000},
2617                         {0x0000, 0x5555, 0x0001, 0x5555, 0x0001, 0x0001, 0x5555, 0x0001},
2618                         {0x0002, 0x0002, 0x5555, 0x0003, 0x5555, 0x0003, 0x0003, 0x5555},
2619                         {0x0003, 0x5555, 0x0004, 0x0004, 0x5555, 0x0004, 0x5555, 0x0004},
2620                         {0x0005, 0x5555, 0x0005, 0x5555, 0x0006, 0x0006, 0x5555, 0x0006},
2621                         {0x5555, 0x0006, 0x0006, 0x5555, 0x0007, 0x5555, 0x0007, 0x0007},
2622                         {0x0008, 0x5555, 0x0008, 0x0009, 0x5555, 0x0009, 0x5555, 0x0009},
2623                         {0x0009, 0x5555, 0x000a, 0x5555, 0x000b, 0x5555, 0x000b, 0x000b}},
2624                        {{0x0000'0000, 0x5555'5555, 0x0000'0000, 0x0000'0000},
2625                         {0x5555'5555, 0x0000'0000, 0x5555'5555, 0x0000'0000},
2626                         {0x0000'0000, 0x5555'5555, 0x0000'0001, 0x5555'5555},
2627                         {0x0000'0001, 0x0000'0001, 0x5555'5555, 0x0000'0001},
2628                         {0x0000'0002, 0x0000'0002, 0x5555'5555, 0x0000'0003},
2629                         {0x5555'5555, 0x0000'0003, 0x0000'0003, 0x5555'5555},
2630                         {0x0000'0003, 0x5555'5555, 0x0000'0004, 0x0000'0004},
2631                         {0x5555'5555, 0x0000'0004, 0x5555'5555, 0x0000'0004}},
2632                        {{0x0000'0000'0000'0000, 0x5555'5555'5555'5555},
2633                         {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
2634                         {0x5555'5555'5555'5555, 0x0000'0000'0000'0000},
2635                         {0x5555'5555'5555'5555, 0x0000'0000'0000'0000},
2636                         {0x0000'0000'0000'0000, 0x5555'5555'5555'5555},
2637                         {0x0000'0000'0000'0001, 0x5555'5555'5555'5555},
2638                         {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
2639                         {0x5555'5555'5555'5555, 0x0000'0000'0000'0001}},
2640                        kVectorCalculationsSource);
2641 }
2642 
ExecVrsubvx()2643 [[gnu::naked]] void ExecVrsubvx() {
2644   asm("vrsub.vx v8, v16, t0\n\t"
2645       "ret\n\t");
2646 }
2647 
ExecMaskedVrsubvx()2648 [[gnu::naked]] void ExecMaskedVrsubvx() {
2649   asm("vrsub.vx v8, v16, t0, v0.t\n\t"
2650       "ret\n\t");
2651 }
2652 
ExecVrsubvi()2653 [[gnu::naked]] void ExecVrsubvi() {
2654   asm("vrsub.vi v8, v16, -0xb\n\t"
2655       "ret\n\t");
2656 }
2657 
ExecMaskedVrsubvi()2658 [[gnu::naked]] void ExecMaskedVrsubvi() {
2659   asm("vrsub.vi v8, v16, -0xb, v0.t\n\t"
2660       "ret\n\t");
2661 }
2662 
ExecVfrsubvf()2663 [[gnu::naked]] void ExecVfrsubvf() {
2664   asm("vfrsub.vf v8, v16, ft0\n\t"
2665       "ret\n\t");
2666 }
2667 
ExecMaskedVfrsubvf()2668 [[gnu::naked]] void ExecMaskedVfrsubvf() {
2669   asm("vfrsub.vf v8, v16, ft0, v0.t\n\t"
2670       "ret\n\t");
2671 }
2672 
TEST(InlineAsmTestRiscv64,TestVrsub)2673 TEST(InlineAsmTestRiscv64, TestVrsub) {
2674   TestVectorInstruction(
2675       ExecVrsubvx,
2676       ExecMaskedVrsubvx,
2677       {{170, 41, 168, 39, 166, 37, 164, 35, 162, 33, 160, 31, 158, 29, 156, 27},
2678        {154, 25, 152, 23, 150, 21, 148, 19, 146, 17, 144, 15, 142, 13, 140, 11},
2679        {138, 9, 136, 7, 134, 5, 132, 3, 130, 1, 128, 255, 126, 253, 124, 251},
2680        {122, 249, 120, 247, 118, 245, 116, 243, 114, 241, 112, 239, 110, 237, 108, 235},
2681        {106, 233, 104, 231, 102, 229, 100, 227, 98, 225, 96, 223, 94, 221, 92, 219},
2682        {90, 217, 88, 215, 86, 213, 84, 211, 82, 209, 80, 207, 78, 205, 76, 203},
2683        {74, 201, 72, 199, 70, 197, 68, 195, 66, 193, 64, 191, 62, 189, 60, 187},
2684        {58, 185, 56, 183, 54, 181, 52, 179, 50, 177, 48, 175, 46, 173, 44, 171}},
2685       {{0x29aa, 0x27a8, 0x25a6, 0x23a4, 0x21a2, 0x1fa0, 0x1d9e, 0x1b9c},
2686        {0x199a, 0x1798, 0x1596, 0x1394, 0x1192, 0x0f90, 0x0d8e, 0x0b8c},
2687        {0x098a, 0x0788, 0x0586, 0x0384, 0x0182, 0xff80, 0xfd7e, 0xfb7c},
2688        {0xf97a, 0xf778, 0xf576, 0xf374, 0xf172, 0xef70, 0xed6e, 0xeb6c},
2689        {0xe96a, 0xe768, 0xe566, 0xe364, 0xe162, 0xdf60, 0xdd5e, 0xdb5c},
2690        {0xd95a, 0xd758, 0xd556, 0xd354, 0xd152, 0xcf50, 0xcd4e, 0xcb4c},
2691        {0xc94a, 0xc748, 0xc546, 0xc344, 0xc142, 0xbf40, 0xbd3e, 0xbb3c},
2692        {0xb93a, 0xb738, 0xb536, 0xb334, 0xb132, 0xaf30, 0xad2e, 0xab2c}},
2693       {{0x27a8'29aa, 0x23a4'25a6, 0x1fa0'21a2, 0x1b9c'1d9e},
2694        {0x1798'199a, 0x1394'1596, 0x0f90'1192, 0x0b8c'0d8e},
2695        {0x0788'098a, 0x0384'0586, 0xff80'0182, 0xfb7b'fd7e},
2696        {0xf777'f97a, 0xf373'f576, 0xef6f'f172, 0xeb6b'ed6e},
2697        {0xe767'e96a, 0xe363'e566, 0xdf5f'e162, 0xdb5b'dd5e},
2698        {0xd757'd95a, 0xd353'd556, 0xcf4f'd152, 0xcb4b'cd4e},
2699        {0xc747'c94a, 0xc343'c546, 0xbf3f'c142, 0xbb3b'bd3e},
2700        {0xb737'b93a, 0xb333'b536, 0xaf2f'b132, 0xab2b'ad2e}},
2701       {{0x23a4'25a6'27a8'29aa, 0x1b9c'1d9e'1fa0'21a2},
2702        {0x1394'1596'1798'199a, 0x0b8c'0d8e'0f90'1192},
2703        {0x0384'0586'0788'098a, 0xfb7b'fd7d'ff80'0182},
2704        {0xf373'f575'f777'f97a, 0xeb6b'ed6d'ef6f'f172},
2705        {0xe363'e565'e767'e96a, 0xdb5b'dd5d'df5f'e162},
2706        {0xd353'd555'd757'd95a, 0xcb4b'cd4d'cf4f'd152},
2707        {0xc343'c545'c747'c94a, 0xbb3b'bd3d'bf3f'c142},
2708        {0xb333'b535'b737'b93a, 0xab2b'ad2d'af2f'b132}},
2709       kVectorCalculationsSourceLegacy);
2710   TestVectorInstruction(
2711       ExecVrsubvi,
2712       ExecMaskedVrsubvi,
2713       {{245, 116, 243, 114, 241, 112, 239, 110, 237, 108, 235, 106, 233, 104, 231, 102},
2714        {229, 100, 227, 98, 225, 96, 223, 94, 221, 92, 219, 90, 217, 88, 215, 86},
2715        {213, 84, 211, 82, 209, 80, 207, 78, 205, 76, 203, 74, 201, 72, 199, 70},
2716        {197, 68, 195, 66, 193, 64, 191, 62, 189, 60, 187, 58, 185, 56, 183, 54},
2717        {181, 52, 179, 50, 177, 48, 175, 46, 173, 44, 171, 42, 169, 40, 167, 38},
2718        {165, 36, 163, 34, 161, 32, 159, 30, 157, 28, 155, 26, 153, 24, 151, 22},
2719        {149, 20, 147, 18, 145, 16, 143, 14, 141, 12, 139, 10, 137, 8, 135, 6},
2720        {133, 4, 131, 2, 129, 0, 127, 254, 125, 252, 123, 250, 121, 248, 119, 246}},
2721       {{0x7ef5, 0x7cf3, 0x7af1, 0x78ef, 0x76ed, 0x74eb, 0x72e9, 0x70e7},
2722        {0x6ee5, 0x6ce3, 0x6ae1, 0x68df, 0x66dd, 0x64db, 0x62d9, 0x60d7},
2723        {0x5ed5, 0x5cd3, 0x5ad1, 0x58cf, 0x56cd, 0x54cb, 0x52c9, 0x50c7},
2724        {0x4ec5, 0x4cc3, 0x4ac1, 0x48bf, 0x46bd, 0x44bb, 0x42b9, 0x40b7},
2725        {0x3eb5, 0x3cb3, 0x3ab1, 0x38af, 0x36ad, 0x34ab, 0x32a9, 0x30a7},
2726        {0x2ea5, 0x2ca3, 0x2aa1, 0x289f, 0x269d, 0x249b, 0x2299, 0x2097},
2727        {0x1e95, 0x1c93, 0x1a91, 0x188f, 0x168d, 0x148b, 0x1289, 0x1087},
2728        {0x0e85, 0x0c83, 0x0a81, 0x087f, 0x067d, 0x047b, 0x0279, 0x0077}},
2729       {{0x7cfd'7ef5, 0x78f9'7af1, 0x74f5'76ed, 0x70f1'72e9},
2730        {0x6ced'6ee5, 0x68e9'6ae1, 0x64e5'66dd, 0x60e1'62d9},
2731        {0x5cdd'5ed5, 0x58d9'5ad1, 0x54d5'56cd, 0x50d1'52c9},
2732        {0x4ccd'4ec5, 0x48c9'4ac1, 0x44c5'46bd, 0x40c1'42b9},
2733        {0x3cbd'3eb5, 0x38b9'3ab1, 0x34b5'36ad, 0x30b1'32a9},
2734        {0x2cad'2ea5, 0x28a9'2aa1, 0x24a5'269d, 0x20a1'2299},
2735        {0x1c9d'1e95, 0x1899'1a91, 0x1495'168d, 0x1091'1289},
2736        {0x0c8d'0e85, 0x0889'0a81, 0x0485'067d, 0x0081'0279}},
2737       {{0x78f9'7afb'7cfd'7ef5, 0x70f1'72f3'74f5'76ed},
2738        {0x68e9'6aeb'6ced'6ee5, 0x60e1'62e3'64e5'66dd},
2739        {0x58d9'5adb'5cdd'5ed5, 0x50d1'52d3'54d5'56cd},
2740        {0x48c9'4acb'4ccd'4ec5, 0x40c1'42c3'44c5'46bd},
2741        {0x38b9'3abb'3cbd'3eb5, 0x30b1'32b3'34b5'36ad},
2742        {0x28a9'2aab'2cad'2ea5, 0x20a1'22a3'24a5'269d},
2743        {0x1899'1a9b'1c9d'1e95, 0x1091'1293'1495'168d},
2744        {0x0889'0a8b'0c8d'0e85, 0x0081'0283'0485'067d}},
2745       kVectorCalculationsSourceLegacy);
2746 
2747   TestVectorFloatInstruction(ExecVfrsubvf,
2748                              ExecMaskedVfrsubvf,
2749                              {{0x40b4'0000, 0x40b4'0000, 0x40b4'0000, 0x40b4'0000},
2750                               {0x40b4'0000, 0x40b4'0000, 0x40b4'0000, 0x40b4'0000},
2751                               {0x40b4'0000, 0x40b4'0000, 0x40b4'0000, 0x40b4'0000},
2752                               {0x40b4'0000, 0x40b4'0017, 0x40b4'1757, 0x40cb'd7a8},
2753                               {0x4348'6140, 0x4746'cae4, 0x4b4a'c94e, 0x4f4e'cd4c},
2754                               {0x5352'd150, 0x5756'd554, 0x5b5a'd958, 0x5f5e'dd5c},
2755                               {0x6362'e160, 0x6766'e564, 0x6b6a'e968, 0x6f6e'ed6c},
2756                               {0x7372'f170, 0x7776'f574, 0x7b7a'f978, 0x7f7e'fd7c}},
2757                              {{0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
2758                               {0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
2759                               {0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
2760                               {0x4016'8000'0000'0000, 0x4016'807a'f4f2'eceb},
2761                               {0x4746'c544'c342'c140, 0x4f4e'cd4c'cb4a'c948},
2762                               {0x5756'd554'd352'd150, 0x5f5e'dd5c'db5a'd958},
2763                               {0x6766'e564'e362'e160, 0x6f6e'ed6c'eb6a'e968},
2764                               {0x7776'f574'f372'f170, 0x7f7e'fd7c'fb7a'f978}},
2765                              kVectorCalculationsSource);
2766 }
2767 
ExecVaddvv()2768 [[gnu::naked]] void ExecVaddvv() {
2769   asm("vadd.vv v8, v16, v24\n\t"
2770       "ret\n\t");
2771 }
2772 
ExecMaskedVaddvv()2773 [[gnu::naked]] void ExecMaskedVaddvv() {
2774   asm("vadd.vv v8, v16, v24, v0.t\n\t"
2775       "ret\n\t");
2776 }
2777 
ExecVaddvx()2778 [[gnu::naked]] void ExecVaddvx() {
2779   asm("vadd.vx v8, v16, t0\n\t"
2780       "ret\n\t");
2781 }
2782 
ExecMaskedVaddvx()2783 [[gnu::naked]] void ExecMaskedVaddvx() {
2784   asm("vadd.vx v8, v16, t0, v0.t\n\t"
2785       "ret\n\t");
2786 }
2787 
ExecVaddvi()2788 [[gnu::naked]] void ExecVaddvi() {
2789   asm("vadd.vi v8, v16, -0xb\n\t"
2790       "ret\n\t");
2791 }
2792 
ExecMaskedVaddvi()2793 [[gnu::naked]] void ExecMaskedVaddvi() {
2794   asm("vadd.vi v8, v16, -0xb, v0.t\n\t"
2795       "ret\n\t");
2796 }
2797 
ExecVsadduvv()2798 [[gnu::naked]] void ExecVsadduvv() {
2799   asm("vsaddu.vv v8, v16, v24\n\t"
2800       "ret\n\t");
2801 }
2802 
ExecMaskedVsadduvv()2803 [[gnu::naked]] void ExecMaskedVsadduvv() {
2804   asm("vsaddu.vv v8, v16, v24, v0.t\n\t"
2805       "ret\n\t");
2806 }
2807 
ExecVsadduvx()2808 [[gnu::naked]] void ExecVsadduvx() {
2809   asm("vsaddu.vx v8, v16, t0\n\t"
2810       "ret\n\t");
2811 }
2812 
ExecMaskedVsadduvx()2813 [[gnu::naked]] void ExecMaskedVsadduvx() {
2814   asm("vsaddu.vx v8, v16, t0, v0.t\n\t"
2815       "ret\n\t");
2816 }
2817 
ExecVsadduvi()2818 [[gnu::naked]] void ExecVsadduvi() {
2819   asm("vsaddu.vi v8, v16, -0xb\n\t"
2820       "ret\n\t");
2821 }
2822 
ExecMaskedVsadduvi()2823 [[gnu::naked]] void ExecMaskedVsadduvi() {
2824   asm("vsaddu.vi v8, v16, -0xb, v0.t\n\t"
2825       "ret\n\t");
2826 }
2827 
ExecVsaddvv()2828 [[gnu::naked]] void ExecVsaddvv() {
2829   asm("vsadd.vv v8, v16, v24\n\t"
2830       "ret\n\t");
2831 }
2832 
ExecMaskedVsaddvv()2833 [[gnu::naked]] void ExecMaskedVsaddvv() {
2834   asm("vsadd.vv v8, v16, v24, v0.t\n\t"
2835       "ret\n\t");
2836 }
2837 
ExecVsaddvx()2838 [[gnu::naked]] void ExecVsaddvx() {
2839   asm("vsadd.vx v8, v16, t0\n\t"
2840       "ret\n\t");
2841 }
2842 
ExecMaskedVsaddvx()2843 [[gnu::naked]] void ExecMaskedVsaddvx() {
2844   asm("vsadd.vx v8, v16, t0, v0.t\n\t"
2845       "ret\n\t");
2846 }
2847 
ExecVsaddvi()2848 [[gnu::naked]] void ExecVsaddvi() {
2849   asm("vsadd.vi v8, v16, -0xb\n\t"
2850       "ret\n\t");
2851 }
2852 
ExecMaskedVsaddvi()2853 [[gnu::naked]] void ExecMaskedVsaddvi() {
2854   asm("vsadd.vi v8, v16, -0xb, v0.t\n\t"
2855       "ret\n\t");
2856 }
2857 
ExecVfaddvv()2858 [[gnu::naked]] void ExecVfaddvv() {
2859   asm("vfadd.vv v8, v16, v24\n\t"
2860       "ret\n\t");
2861 }
2862 
ExecMaskedVfaddvv()2863 [[gnu::naked]] void ExecMaskedVfaddvv() {
2864   asm("vfadd.vv v8, v16, v24, v0.t\n\t"
2865       "ret\n\t");
2866 }
2867 
ExecVfaddvf()2868 [[gnu::naked]] void ExecVfaddvf() {
2869   asm("vfadd.vf v8, v16, ft0\n\t"
2870       "ret\n\t");
2871 }
2872 
ExecMaskedVfaddvf()2873 [[gnu::naked]] void ExecMaskedVfaddvf() {
2874   asm("vfadd.vf v8, v16, ft0, v0.t\n\t"
2875       "ret\n\t");
2876 }
2877 
ExecVfwaddvv()2878 [[gnu::naked]] void ExecVfwaddvv() {
2879   asm("vfwadd.vv v8, v16, v24\n\t"
2880       "ret\n\t");
2881 }
2882 
ExecMaskedVfwaddvv()2883 [[gnu::naked]] void ExecMaskedVfwaddvv() {
2884   asm("vfwadd.vv v8, v16, v24, v0.t\n\t"
2885       "ret\n\t");
2886 }
2887 
ExecVfwaddwv()2888 [[gnu::naked]] void ExecVfwaddwv() {
2889   asm("vfwadd.wv v8, v16, v24\n\t"
2890       "ret\n\t");
2891 }
2892 
ExecMaskedVfwaddwv()2893 [[gnu::naked]] void ExecMaskedVfwaddwv() {
2894   asm("vfwadd.wv v8, v16, v24, v0.t\n\t"
2895       "ret\n\t");
2896 }
2897 
ExecVfwaddwf()2898 [[gnu::naked]] void ExecVfwaddwf() {
2899   asm("vfwadd.wf v8, v16, ft0\n\t"
2900       "ret\n\t");
2901 }
2902 
ExecMaskedVfwaddwf()2903 [[gnu::naked]] void ExecMaskedVfwaddwf() {
2904   asm("vfwadd.wf v8, v16, ft0, v0.t\n\t"
2905       "ret\n\t");
2906 }
2907 
TEST(InlineAsmTestRiscv64,TestVadd)2908 TEST(InlineAsmTestRiscv64, TestVadd) {
2909   TestVectorInstruction(
2910       ExecVaddvv,
2911       ExecMaskedVaddvv,
2912       {{0, 131, 6, 137, 13, 143, 18, 149, 25, 155, 30, 161, 36, 167, 42, 173},
2913        {48, 179, 54, 185, 61, 191, 66, 197, 73, 203, 78, 209, 84, 215, 90, 221},
2914        {96, 227, 102, 233, 109, 239, 114, 245, 121, 251, 126, 1, 132, 7, 138, 13},
2915        {144, 19, 150, 25, 157, 31, 162, 37, 169, 43, 174, 49, 180, 55, 186, 61},
2916        {192, 67, 198, 73, 205, 79, 210, 85, 217, 91, 222, 97, 228, 103, 234, 109},
2917        {240, 115, 246, 121, 253, 127, 2, 133, 9, 139, 14, 145, 20, 151, 26, 157},
2918        {32, 163, 38, 169, 45, 175, 50, 181, 57, 187, 62, 193, 68, 199, 74, 205},
2919        {80, 211, 86, 217, 93, 223, 98, 229, 105, 235, 110, 241, 116, 247, 122, 253}},
2920       {{0x8300, 0x8906, 0x8f0d, 0x9512, 0x9b19, 0xa11e, 0xa724, 0xad2a},
2921        {0xb330, 0xb936, 0xbf3d, 0xc542, 0xcb49, 0xd14e, 0xd754, 0xdd5a},
2922        {0xe360, 0xe966, 0xef6d, 0xf572, 0xfb79, 0x017e, 0x0784, 0x0d8a},
2923        {0x1390, 0x1996, 0x1f9d, 0x25a2, 0x2ba9, 0x31ae, 0x37b4, 0x3dba},
2924        {0x43c0, 0x49c6, 0x4fcd, 0x55d2, 0x5bd9, 0x61de, 0x67e4, 0x6dea},
2925        {0x73f0, 0x79f6, 0x7ffd, 0x8602, 0x8c09, 0x920e, 0x9814, 0x9e1a},
2926        {0xa420, 0xaa26, 0xb02d, 0xb632, 0xbc39, 0xc23e, 0xc844, 0xce4a},
2927        {0xd450, 0xda56, 0xe05d, 0xe662, 0xec69, 0xf26e, 0xf874, 0xfe7a}},
2928       {{0x8906'8300, 0x9512'8f0d, 0xa11e'9b19, 0xad2a'a724},
2929        {0xb936'b330, 0xc542'bf3d, 0xd14e'cb49, 0xdd5a'd754},
2930        {0xe966'e360, 0xf572'ef6d, 0x017e'fb79, 0x0d8b'0784},
2931        {0x1997'1390, 0x25a3'1f9d, 0x31af'2ba9, 0x3dbb'37b4},
2932        {0x49c7'43c0, 0x55d3'4fcd, 0x61df'5bd9, 0x6deb'67e4},
2933        {0x79f7'73f0, 0x8603'7ffd, 0x920f'8c09, 0x9e1b'9814},
2934        {0xaa27'a420, 0xb633'b02d, 0xc23f'bc39, 0xce4b'c844},
2935        {0xda57'd450, 0xe663'e05d, 0xf26f'ec69, 0xfe7b'f874}},
2936       {{0x9512'8f0d'8906'8300, 0xad2a'a724'a11e'9b19},
2937        {0xc542'bf3d'b936'b330, 0xdd5a'd754'd14e'cb49},
2938        {0xf572'ef6d'e966'e360, 0x0d8b'0785'017e'fb79},
2939        {0x25a3'1f9e'1997'1390, 0x3dbb'37b5'31af'2ba9},
2940        {0x55d3'4fce'49c7'43c0, 0x6deb'67e5'61df'5bd9},
2941        {0x8603'7ffe'79f7'73f0, 0x9e1b'9815'920f'8c09},
2942        {0xb633'b02e'aa27'a420, 0xce4b'c845'c23f'bc39},
2943        {0xe663'e05e'da57'd450, 0xfe7b'f875'f26f'ec69}},
2944       kVectorCalculationsSourceLegacy);
2945   TestVectorInstruction(
2946       ExecVaddvx,
2947       ExecMaskedVaddvx,
2948       {{170, 43, 172, 45, 174, 47, 176, 49, 178, 51, 180, 53, 182, 55, 184, 57},
2949        {186, 59, 188, 61, 190, 63, 192, 65, 194, 67, 196, 69, 198, 71, 200, 73},
2950        {202, 75, 204, 77, 206, 79, 208, 81, 210, 83, 212, 85, 214, 87, 216, 89},
2951        {218, 91, 220, 93, 222, 95, 224, 97, 226, 99, 228, 101, 230, 103, 232, 105},
2952        {234, 107, 236, 109, 238, 111, 240, 113, 242, 115, 244, 117, 246, 119, 248, 121},
2953        {250, 123, 252, 125, 254, 127, 0, 129, 2, 131, 4, 133, 6, 135, 8, 137},
2954        {10, 139, 12, 141, 14, 143, 16, 145, 18, 147, 20, 149, 22, 151, 24, 153},
2955        {26, 155, 28, 157, 30, 159, 32, 161, 34, 163, 36, 165, 38, 167, 40, 169}},
2956       {{0x2baa, 0x2dac, 0x2fae, 0x31b0, 0x33b2, 0x35b4, 0x37b6, 0x39b8},
2957        {0x3bba, 0x3dbc, 0x3fbe, 0x41c0, 0x43c2, 0x45c4, 0x47c6, 0x49c8},
2958        {0x4bca, 0x4dcc, 0x4fce, 0x51d0, 0x53d2, 0x55d4, 0x57d6, 0x59d8},
2959        {0x5bda, 0x5ddc, 0x5fde, 0x61e0, 0x63e2, 0x65e4, 0x67e6, 0x69e8},
2960        {0x6bea, 0x6dec, 0x6fee, 0x71f0, 0x73f2, 0x75f4, 0x77f6, 0x79f8},
2961        {0x7bfa, 0x7dfc, 0x7ffe, 0x8200, 0x8402, 0x8604, 0x8806, 0x8a08},
2962        {0x8c0a, 0x8e0c, 0x900e, 0x9210, 0x9412, 0x9614, 0x9816, 0x9a18},
2963        {0x9c1a, 0x9e1c, 0xa01e, 0xa220, 0xa422, 0xa624, 0xa826, 0xaa28}},
2964       {{0x2dad'2baa, 0x31b1'2fae, 0x35b5'33b2, 0x39b9'37b6},
2965        {0x3dbd'3bba, 0x41c1'3fbe, 0x45c5'43c2, 0x49c9'47c6},
2966        {0x4dcd'4bca, 0x51d1'4fce, 0x55d5'53d2, 0x59d9'57d6},
2967        {0x5ddd'5bda, 0x61e1'5fde, 0x65e5'63e2, 0x69e9'67e6},
2968        {0x6ded'6bea, 0x71f1'6fee, 0x75f5'73f2, 0x79f9'77f6},
2969        {0x7dfd'7bfa, 0x8201'7ffe, 0x8605'8402, 0x8a09'8806},
2970        {0x8e0d'8c0a, 0x9211'900e, 0x9615'9412, 0x9a19'9816},
2971        {0x9e1d'9c1a, 0xa221'a01e, 0xa625'a422, 0xaa29'a826}},
2972       {{0x31b1'2faf'2dad'2baa, 0x39b9'37b7'35b5'33b2},
2973        {0x41c1'3fbf'3dbd'3bba, 0x49c9'47c7'45c5'43c2},
2974        {0x51d1'4fcf'4dcd'4bca, 0x59d9'57d7'55d5'53d2},
2975        {0x61e1'5fdf'5ddd'5bda, 0x69e9'67e7'65e5'63e2},
2976        {0x71f1'6fef'6ded'6bea, 0x79f9'77f7'75f5'73f2},
2977        {0x8201'7fff'7dfd'7bfa, 0x8a09'8807'8605'8402},
2978        {0x9211'900f'8e0d'8c0a, 0x9a19'9817'9615'9412},
2979        {0xa221'a01f'9e1d'9c1a, 0xaa29'a827'a625'a422}},
2980       kVectorCalculationsSourceLegacy);
2981   TestVectorInstruction(
2982       ExecVaddvi,
2983       ExecMaskedVaddvi,
2984       {{245, 118, 247, 120, 249, 122, 251, 124, 253, 126, 255, 128, 1, 130, 3, 132},
2985        {5, 134, 7, 136, 9, 138, 11, 140, 13, 142, 15, 144, 17, 146, 19, 148},
2986        {21, 150, 23, 152, 25, 154, 27, 156, 29, 158, 31, 160, 33, 162, 35, 164},
2987        {37, 166, 39, 168, 41, 170, 43, 172, 45, 174, 47, 176, 49, 178, 51, 180},
2988        {53, 182, 55, 184, 57, 186, 59, 188, 61, 190, 63, 192, 65, 194, 67, 196},
2989        {69, 198, 71, 200, 73, 202, 75, 204, 77, 206, 79, 208, 81, 210, 83, 212},
2990        {85, 214, 87, 216, 89, 218, 91, 220, 93, 222, 95, 224, 97, 226, 99, 228},
2991        {101, 230, 103, 232, 105, 234, 107, 236, 109, 238, 111, 240, 113, 242, 115, 244}},
2992       {{0x80f5, 0x82f7, 0x84f9, 0x86fb, 0x88fd, 0x8aff, 0x8d01, 0x8f03},
2993        {0x9105, 0x9307, 0x9509, 0x970b, 0x990d, 0x9b0f, 0x9d11, 0x9f13},
2994        {0xa115, 0xa317, 0xa519, 0xa71b, 0xa91d, 0xab1f, 0xad21, 0xaf23},
2995        {0xb125, 0xb327, 0xb529, 0xb72b, 0xb92d, 0xbb2f, 0xbd31, 0xbf33},
2996        {0xc135, 0xc337, 0xc539, 0xc73b, 0xc93d, 0xcb3f, 0xcd41, 0xcf43},
2997        {0xd145, 0xd347, 0xd549, 0xd74b, 0xd94d, 0xdb4f, 0xdd51, 0xdf53},
2998        {0xe155, 0xe357, 0xe559, 0xe75b, 0xe95d, 0xeb5f, 0xed61, 0xef63},
2999        {0xf165, 0xf367, 0xf569, 0xf76b, 0xf96d, 0xfb6f, 0xfd71, 0xff73}},
3000       {{0x8302'80f5, 0x8706'84f9, 0x8b0a'88fd, 0x8f0e'8d01},
3001        {0x9312'9105, 0x9716'9509, 0x9b1a'990d, 0x9f1e'9d11},
3002        {0xa322'a115, 0xa726'a519, 0xab2a'a91d, 0xaf2e'ad21},
3003        {0xb332'b125, 0xb736'b529, 0xbb3a'b92d, 0xbf3e'bd31},
3004        {0xc342'c135, 0xc746'c539, 0xcb4a'c93d, 0xcf4e'cd41},
3005        {0xd352'd145, 0xd756'd549, 0xdb5a'd94d, 0xdf5e'dd51},
3006        {0xe362'e155, 0xe766'e559, 0xeb6a'e95d, 0xef6e'ed61},
3007        {0xf372'f165, 0xf776'f569, 0xfb7a'f96d, 0xff7e'fd71}},
3008       {{0x8706'8504'8302'80f5, 0x8f0e'8d0c'8b0a'88fd},
3009        {0x9716'9514'9312'9105, 0x9f1e'9d1c'9b1a'990d},
3010        {0xa726'a524'a322'a115, 0xaf2e'ad2c'ab2a'a91d},
3011        {0xb736'b534'b332'b125, 0xbf3e'bd3c'bb3a'b92d},
3012        {0xc746'c544'c342'c135, 0xcf4e'cd4c'cb4a'c93d},
3013        {0xd756'd554'd352'd145, 0xdf5e'dd5c'db5a'd94d},
3014        {0xe766'e564'e362'e155, 0xef6e'ed6c'eb6a'e95d},
3015        {0xf776'f574'f372'f165, 0xff7e'fd7c'fb7a'f96d}},
3016       kVectorCalculationsSourceLegacy);
3017   TestVectorInstruction(
3018       ExecVsadduvv,
3019       ExecMaskedVsadduvv,
3020       {{0, 255, 6, 255, 13, 255, 18, 255, 25, 255, 30, 255, 36, 255, 42, 255},
3021        {48, 255, 54, 255, 61, 255, 66, 255, 73, 255, 78, 255, 84, 255, 90, 255},
3022        {96, 255, 102, 255, 109, 255, 114, 255, 121, 255, 126, 255, 132, 255, 138, 255},
3023        {144, 255, 150, 255, 157, 255, 162, 255, 169, 255, 174, 255, 180, 255, 186, 255},
3024        {192, 211, 198, 217, 205, 223, 210, 229, 217, 203, 222, 209, 228, 215, 234, 221},
3025        {240, 255, 246, 255, 253, 255, 255, 255, 255, 251, 255, 255, 255, 255, 255, 255},
3026        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3027        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}},
3028       {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3029        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3030        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3031        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3032        {0xd3c0, 0xd9c6, 0xdfcd, 0xe5d2, 0xcbd9, 0xd1de, 0xd7e4, 0xddea},
3033        {0xffff, 0xffff, 0xffff, 0xffff, 0xfc09, 0xffff, 0xffff, 0xffff},
3034        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3035        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
3036       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3037        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3038        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3039        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3040        {0xd9c6'd3c0, 0xe5d2'dfcd, 0xd1de'cbd9, 0xddea'd7e4},
3041        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3042        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3043        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
3044       {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3045        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3046        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3047        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3048        {0xe5d2'dfcd'd9c6'd3c0, 0xddea'd7e4'd1de'cbd9},
3049        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3050        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3051        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
3052       kVectorCalculationsSource);
3053   TestVectorInstruction(
3054       ExecVsadduvx,
3055       ExecMaskedVsadduvx,
3056       {{170, 255, 172, 255, 174, 255, 176, 255, 178, 255, 180, 255, 182, 255, 184, 255},
3057        {186, 255, 188, 255, 190, 255, 192, 255, 194, 255, 196, 255, 198, 255, 200, 255},
3058        {202, 255, 204, 255, 206, 255, 208, 255, 210, 255, 212, 255, 214, 255, 216, 255},
3059        {218, 255, 220, 255, 222, 255, 224, 255, 226, 255, 228, 255, 230, 255, 232, 255},
3060        {234, 255, 236, 255, 238, 255, 240, 255, 242, 255, 244, 255, 246, 255, 248, 255},
3061        {250, 255, 252, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3062        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3063        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}},
3064       {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3065        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3066        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3067        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3068        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3069        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3070        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3071        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
3072       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3073        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3074        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3075        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3076        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3077        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3078        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3079        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
3080       {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3081        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3082        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3083        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3084        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3085        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3086        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3087        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
3088       kVectorCalculationsSource);
3089   TestVectorInstruction(
3090       ExecVsadduvi,
3091       ExecMaskedVsadduvi,
3092       {{245, 255, 247, 255, 249, 255, 251, 255, 253, 255, 255, 255, 255, 255, 255, 255},
3093        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3094        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3095        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3096        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3097        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3098        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255},
3099        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}},
3100       {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3101        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3102        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3103        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3104        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3105        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3106        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
3107        {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
3108       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3109        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3110        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3111        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3112        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3113        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3114        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
3115        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
3116       {{0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3117        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3118        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3119        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3120        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3121        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3122        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff},
3123        {0xffff'ffff'ffff'ffff, 0xffff'ffff'ffff'ffff}},
3124       kVectorCalculationsSource);
3125   TestVectorInstruction(
3126       ExecVsaddvv,
3127       ExecMaskedVsaddvv,
3128       {{0, 128, 6, 128, 13, 128, 18, 128, 25, 128, 30, 128, 36, 128, 42, 128},
3129        {48, 128, 54, 128, 61, 128, 66, 128, 73, 128, 78, 128, 84, 128, 90, 128},
3130        {96, 128, 102, 128, 109, 128, 114, 133, 121, 128, 126, 128, 127, 128, 127, 128},
3131        {127, 163, 127, 169, 127, 175, 127, 181, 127, 155, 127, 161, 127, 167, 127, 173},
3132        {192, 211, 198, 217, 205, 223, 210, 229, 217, 203, 222, 209, 228, 215, 234, 221},
3133        {240, 3, 246, 9, 253, 15, 2, 21, 9, 251, 14, 1, 20, 7, 26, 13},
3134        {32, 51, 38, 57, 45, 63, 50, 69, 57, 43, 62, 49, 68, 55, 74, 61},
3135        {80, 99, 86, 105, 93, 111, 98, 117, 105, 91, 110, 97, 116, 103, 122, 109}},
3136       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3137        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3138        {0x8000, 0x8000, 0x8000, 0x8572, 0x8000, 0x8000, 0x8000, 0x8000},
3139        {0xa390, 0xa996, 0xaf9d, 0xb5a2, 0x9ba9, 0xa1ae, 0xa7b4, 0xadba},
3140        {0xd3c0, 0xd9c6, 0xdfcd, 0xe5d2, 0xcbd9, 0xd1de, 0xd7e4, 0xddea},
3141        {0x03f0, 0x09f6, 0x0ffd, 0x1602, 0xfc09, 0x020e, 0x0814, 0x0e1a},
3142        {0x3420, 0x3a26, 0x402d, 0x4632, 0x2c39, 0x323e, 0x3844, 0x3e4a},
3143        {0x6450, 0x6a56, 0x705d, 0x7662, 0x5c69, 0x626e, 0x6874, 0x6e7a}},
3144       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3145        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3146        {0x8000'0000, 0x8573'7f6d, 0x8000'0000, 0x8000'0000},
3147        {0xa997'a390, 0xb5a3'af9d, 0xa1af'9ba9, 0xadbb'a7b4},
3148        {0xd9c6'd3c0, 0xe5d2'dfcd, 0xd1de'cbd9, 0xddea'd7e4},
3149        {0x09f7'03f0, 0x1603'0ffd, 0x020e'fc09, 0x0e1b'0814},
3150        {0x3a27'3420, 0x4633'402d, 0x323f'2c39, 0x3e4b'3844},
3151        {0x6a57'6450, 0x7663'705d, 0x626f'5c69, 0x6e7b'6874}},
3152       {{0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3153        {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3154        {0x8573'7f6e'7967'7360, 0x8000'0000'0000'0000},
3155        {0xb5a3'af9e'a997'a390, 0xadbb'a7b5'a1af'9ba9},
3156        {0xe5d2'dfcd'd9c6'd3c0, 0xddea'd7e4'd1de'cbd9},
3157        {0x1603'0ffe'09f7'03f0, 0x0e1b'0815'020e'fc09},
3158        {0x4633'402e'3a27'3420, 0x3e4b'3845'323f'2c39},
3159        {0x7663'705e'6a57'6450, 0x6e7b'6875'626f'5c69}},
3160       kVectorCalculationsSource);
3161   TestVectorInstruction(
3162       ExecVsaddvx,
3163       ExecMaskedVsaddvx,
3164       {{170, 128, 172, 128, 174, 128, 176, 128, 178, 128, 180, 128, 182, 128, 184, 128},
3165        {186, 128, 188, 128, 190, 128, 192, 128, 194, 128, 196, 128, 198, 128, 200, 128},
3166        {202, 128, 204, 128, 206, 128, 208, 128, 210, 128, 212, 128, 214, 128, 216, 128},
3167        {218, 128, 220, 128, 222, 128, 224, 128, 226, 128, 228, 128, 230, 128, 232, 128},
3168        {234, 128, 236, 128, 238, 128, 240, 128, 242, 128, 244, 128, 246, 128, 248, 128},
3169        {250, 128, 252, 128, 254, 128, 0, 129, 2, 131, 4, 133, 6, 135, 8, 137},
3170        {10, 139, 12, 141, 14, 143, 16, 145, 18, 147, 20, 149, 22, 151, 24, 153},
3171        {26, 155, 28, 157, 30, 159, 32, 161, 34, 163, 36, 165, 38, 167, 40, 169}},
3172       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3173        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3174        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3175        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3176        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
3177        {0x8000, 0x8000, 0x8000, 0x8200, 0x8402, 0x8604, 0x8806, 0x8a08},
3178        {0x8c0a, 0x8e0c, 0x900e, 0x9210, 0x9412, 0x9614, 0x9816, 0x9a18},
3179        {0x9c1a, 0x9e1c, 0xa01e, 0xa220, 0xa422, 0xa624, 0xa826, 0xaa28}},
3180       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3181        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3182        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3183        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3184        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
3185        {0x8000'0000, 0x8201'7ffe, 0x8605'8402, 0x8a09'8806},
3186        {0x8e0d'8c0a, 0x9211'900e, 0x9615'9412, 0x9a19'9816},
3187        {0x9e1d'9c1a, 0xa221'a01e, 0xa625'a422, 0xaa29'a826}},
3188       {{0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3189        {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3190        {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3191        {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3192        {0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
3193        {0x8201'7fff'7dfd'7bfa, 0x8a09'8807'8605'8402},
3194        {0x9211'900f'8e0d'8c0a, 0x9a19'9817'9615'9412},
3195        {0xa221'a01f'9e1d'9c1a, 0xaa29'a827'a625'a422}},
3196       kVectorCalculationsSource);
3197   TestVectorInstruction(
3198       ExecVsaddvi,
3199       ExecMaskedVsaddvi,
3200       {{245, 128, 247, 128, 249, 128, 251, 128, 253, 128, 255, 128, 1, 130, 3, 132},
3201        {5, 134, 7, 136, 9, 138, 11, 140, 13, 142, 15, 144, 17, 146, 19, 148},
3202        {21, 150, 23, 152, 25, 154, 27, 156, 29, 158, 31, 160, 33, 162, 35, 164},
3203        {37, 166, 39, 168, 41, 170, 43, 172, 45, 174, 47, 176, 49, 178, 51, 180},
3204        {53, 182, 55, 184, 57, 186, 59, 188, 61, 190, 63, 192, 65, 194, 67, 196},
3205        {69, 198, 71, 200, 73, 202, 75, 204, 77, 206, 79, 208, 81, 210, 83, 212},
3206        {85, 214, 87, 216, 89, 218, 91, 220, 93, 222, 95, 224, 97, 226, 99, 228},
3207        {101, 230, 103, 232, 105, 234, 107, 236, 109, 238, 111, 240, 113, 242, 115, 244}},
3208       {{0x80f5, 0x82f7, 0x84f9, 0x86fb, 0x88fd, 0x8aff, 0x8d01, 0x8f03},
3209        {0x9105, 0x9307, 0x9509, 0x970b, 0x990d, 0x9b0f, 0x9d11, 0x9f13},
3210        {0xa115, 0xa317, 0xa519, 0xa71b, 0xa91d, 0xab1f, 0xad21, 0xaf23},
3211        {0xb125, 0xb327, 0xb529, 0xb72b, 0xb92d, 0xbb2f, 0xbd31, 0xbf33},
3212        {0xc135, 0xc337, 0xc539, 0xc73b, 0xc93d, 0xcb3f, 0xcd41, 0xcf43},
3213        {0xd145, 0xd347, 0xd549, 0xd74b, 0xd94d, 0xdb4f, 0xdd51, 0xdf53},
3214        {0xe155, 0xe357, 0xe559, 0xe75b, 0xe95d, 0xeb5f, 0xed61, 0xef63},
3215        {0xf165, 0xf367, 0xf569, 0xf76b, 0xf96d, 0xfb6f, 0xfd71, 0xff73}},
3216       {{0x8302'80f5, 0x8706'84f9, 0x8b0a'88fd, 0x8f0e'8d01},
3217        {0x9312'9105, 0x9716'9509, 0x9b1a'990d, 0x9f1e'9d11},
3218        {0xa322'a115, 0xa726'a519, 0xab2a'a91d, 0xaf2e'ad21},
3219        {0xb332'b125, 0xb736'b529, 0xbb3a'b92d, 0xbf3e'bd31},
3220        {0xc342'c135, 0xc746'c539, 0xcb4a'c93d, 0xcf4e'cd41},
3221        {0xd352'd145, 0xd756'd549, 0xdb5a'd94d, 0xdf5e'dd51},
3222        {0xe362'e155, 0xe766'e559, 0xeb6a'e95d, 0xef6e'ed61},
3223        {0xf372'f165, 0xf776'f569, 0xfb7a'f96d, 0xff7e'fd71}},
3224       {{0x8706'8504'8302'80f5, 0x8f0e'8d0c'8b0a'88fd},
3225        {0x9716'9514'9312'9105, 0x9f1e'9d1c'9b1a'990d},
3226        {0xa726'a524'a322'a115, 0xaf2e'ad2c'ab2a'a91d},
3227        {0xb736'b534'b332'b125, 0xbf3e'bd3c'bb3a'b92d},
3228        {0xc746'c544'c342'c135, 0xcf4e'cd4c'cb4a'c93d},
3229        {0xd756'd554'd352'd145, 0xdf5e'dd5c'db5a'd94d},
3230        {0xe766'e564'e362'e155, 0xef6e'ed6c'eb6a'e95d},
3231        {0xf776'f574'f372'f165, 0xff7e'fd7c'fb7a'f96d}},
3232       kVectorCalculationsSource);
3233 
3234   TestVectorFloatInstruction(ExecVfaddvv,
3235                              ExecMaskedVfaddvv,
3236                              {{0x9604'9200, 0x9e0c'9a09, 0x8b0a'ae29, 0x8f35'af92},
3237                               {0xb624'b220, 0xbe2c'ba29, 0xa634'a233, 0xae3c'aa38},
3238                               {0xd644'd240, 0xde4c'da49, 0xc654'c251, 0xce5c'ca58},
3239                               {0xf664'f260, 0xfe6c'fa69, 0xe674'e271, 0xee7c'ea78},
3240                               {0xc342'c140, 0xc746'c544, 0xcb4a'c948, 0xcf4e'cd4c},
3241                               {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
3242                               {0xe362'e160, 0xe766'e4fe, 0xeb6a'e968, 0xef6e'ed6c},
3243                               {0x76e2'8cfd, 0x7eec'78fb, 0xfb7a'f978, 0xff7e'fd7c}},
3244                              {{0x9e0c'9a09'9604'9200, 0x8f0e'8d45'9f3b'9531},
3245                               {0xbe2c'ba29'b624'b220, 0xae3c'aa38'a634'a231},
3246                               {0xde4c'da49'd644'd240, 0xce5c'ca58'c654'c251},
3247                               {0xfe6c'fa69'f664'f260, 0xee7c'ea78'e674'e271},
3248                               {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3249                               {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3250                               {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3251                               {0x7eec'7ae9'76e4'72e0, 0xff7e'fd7c'fb7a'f978}},
3252                              kVectorCalculationsSource);
3253   TestVectorFloatInstruction(ExecVfaddvf,
3254                              ExecMaskedVfaddvf,
3255                              {{0x40b4'0000, 0x40b4'0000, 0x40b4'0000, 0x40b4'0000},
3256                               {0x40b4'0000, 0x40b4'0000, 0x40b4'0000, 0x40b4'0000},
3257                               {0x40b4'0000, 0x40b4'0000, 0x40b4'0000, 0x40b4'0000},
3258                               {0x40b4'0000, 0x40b3'ffe9, 0x40b3'e8a9, 0x409c'2858},
3259                               {0xc33d'2140, 0xc746'bfa4, 0xcb4a'c942, 0xcf4e'cd4c},
3260                               {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
3261                               {0xe362'e160, 0xe766'e564, 0xeb6a'e968, 0xef6e'ed6c},
3262                               {0xf372'f170, 0xf776'f574, 0xfb7a'f978, 0xff7e'fd7c}},
3263                              {{0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
3264                               {0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
3265                               {0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
3266                               {0x4016'8000'0000'0000, 0x4016'7f85'0b0d'1315},
3267                               {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3268                               {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3269                               {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3270                               {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
3271                              kVectorCalculationsSource);
3272 
3273   TestWideningVectorFloatInstruction(ExecVfwaddvv,
3274                                      ExecMaskedVfwaddvv,
3275                                      {{0xbac0'9240'0000'4140, 0xbbc1'9341'2000'0043},
3276                                       {0xb961'55c5'1088'0000, 0xb9e6'b5f2'4000'0000},
3277                                       {0xbec4'9644'0000'0000, 0xbfc5'9745'2000'0000},
3278                                       {0xbcc6'9446'6d4c'8c00, 0xbdc7'9547'004f'4e8e},
3279                                       {0xc2c8'9a48'0000'0000, 0xc3c9'9b49'2000'0000},
3280                                       {0xc0ca'984a'2000'0000, 0xc1cb'994b'0000'0000},
3281                                       {0xc6cc'9e4c'0000'0000, 0xc7cd'9f4d'2000'0000},
3282                                       {0xc4ce'9c4e'2000'0000, 0xc5cf'9d4f'0000'0000}},
3283                                      kVectorCalculationsSource);
3284 
3285   TestWideningVectorFloatInstruction(ExecVfwaddwv,
3286                                      ExecMaskedVfwaddwv,
3287                                      {{0xbac0'9240'0000'0000, 0xbbc1'9341'2000'0000},
3288                                       {0xb8c2'9042'2000'0000, 0xb9c3'9143'0000'0000},
3289                                       {0xbec4'9644'0000'0000, 0xbfc5'9745'2000'0000},
3290                                       {0xbcc6'9446'2000'0000, 0xbf3e'bd3c'ea65'4738},
3291                                       {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3292                                       {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3293                                       {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3294                                       {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
3295                                      kVectorCalculationsSource);
3296 
3297   TestWideningVectorFloatInstruction(ExecVfwaddwf,
3298                                      ExecMaskedVfwaddwf,
3299                                      {{0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
3300                                       {0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
3301                                       {0x4016'8000'0000'0000, 0x4016'8000'0000'0000},
3302                                       {0x4016'8000'0000'0000, 0x4016'7f85'0b0d'1315},
3303                                       {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3304                                       {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3305                                       {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3306                                       {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
3307                                      kVectorCalculationsSource);
3308 }
3309 
ExecVsubvv()3310 [[gnu::naked]] void ExecVsubvv() {
3311   asm("vsub.vv v8, v16, v24\n\t"
3312       "ret\n\t");
3313 }
ExecMaskedVsubvv()3314 [[gnu::naked]] void ExecMaskedVsubvv() {
3315   asm("vsub.vv v8, v16, v24, v0.t\n\t"
3316       "ret\n\t");
3317 }
ExecVsubvx()3318 [[gnu::naked]] void ExecVsubvx() {
3319   asm("vsub.vx v8, v16, t0\n\t"
3320       "ret\n\t");
3321 }
ExecMaskedVsubvx()3322 [[gnu::naked]] void ExecMaskedVsubvx() {
3323   asm("vsub.vx v8, v16, t0, v0.t\n\t"
3324       "ret\n\t");
3325 }
ExecVssubuvv()3326 [[gnu::naked]] void ExecVssubuvv() {
3327   asm("vssubu.vv v8, v16, v24\n\t"
3328       "ret\n\t");
3329 }
ExecMaskedVssubuvv()3330 [[gnu::naked]] void ExecMaskedVssubuvv() {
3331   asm("vssubu.vv v8, v16, v24, v0.t\n\t"
3332       "ret\n\t");
3333 }
ExecVssubuvx()3334 [[gnu::naked]] void ExecVssubuvx() {
3335   asm("vssubu.vx v8, v16, t0\n\t"
3336       "ret\n\t");
3337 }
ExecMaskedVssubuvx()3338 [[gnu::naked]] void ExecMaskedVssubuvx() {
3339   asm("vssubu.vx v8, v16, t0, v0.t\n\t"
3340       "ret\n\t");
3341 }
ExecVssubvv()3342 [[gnu::naked]] void ExecVssubvv() {
3343   asm("vssub.vv v8, v16, v24\n\t"
3344       "ret\n\t");
3345 }
ExecMaskedVssubvv()3346 [[gnu::naked]] void ExecMaskedVssubvv() {
3347   asm("vssub.vv v8, v16, v24, v0.t\n\t"
3348       "ret\n\t");
3349 }
ExecVssubvx()3350 [[gnu::naked]] void ExecVssubvx() {
3351   asm("vssub.vx v8, v16, t0\n\t"
3352       "ret\n\t");
3353 }
ExecMaskedVssubvx()3354 [[gnu::naked]] void ExecMaskedVssubvx() {
3355   asm("vssub.vx v8, v16, t0, v0.t\n\t"
3356       "ret\n\t");
3357 }
3358 
ExecVfsubvv()3359 [[gnu::naked]] void ExecVfsubvv() {
3360   asm("vfsub.vv v8, v16, v24\n\t"
3361       "ret\n\t");
3362 }
3363 
ExecMaskedVfsubvv()3364 [[gnu::naked]] void ExecMaskedVfsubvv() {
3365   asm("vfsub.vv v8, v16, v24, v0.t\n\t"
3366       "ret\n\t");
3367 }
3368 
ExecVfsubvf()3369 [[gnu::naked]] void ExecVfsubvf() {
3370   asm("vfsub.vf v8, v16, ft0\n\t"
3371       "ret\n\t");
3372 }
3373 
ExecMaskedVfsubvf()3374 [[gnu::naked]] void ExecMaskedVfsubvf() {
3375   asm("vfsub.vf v8, v16, ft0, v0.t\n\t"
3376       "ret\n\t");
3377 }
3378 
ExecVfwsubvv()3379 [[gnu::naked]] void ExecVfwsubvv() {
3380   asm("vfwsub.vv v8, v16, v24\n\t"
3381       "ret\n\t");
3382 }
3383 
ExecMaskedVfwsubvv()3384 [[gnu::naked]] void ExecMaskedVfwsubvv() {
3385   asm("vfwsub.vv v8, v16, v24, v0.t\n\t"
3386       "ret\n\t");
3387 }
3388 
ExecVfwsubvf()3389 [[gnu::naked]] void ExecVfwsubvf() {
3390   asm("vfwsub.vf v8, v16, ft0\n\t"
3391       "ret\n\t");
3392 }
3393 
ExecMaskedVfwsubvf()3394 [[gnu::naked]] void ExecMaskedVfwsubvf() {
3395   asm("vfwsub.vf v8, v16, ft0, v0.t\n\t"
3396       "ret\n\t");
3397 }
3398 
ExecVfwsubwv()3399 [[gnu::naked]] void ExecVfwsubwv() {
3400   asm("vfwsub.wv v8, v16, v24\n\t"
3401       "ret\n\t");
3402 }
3403 
ExecMaskedVfwsubwv()3404 [[gnu::naked]] void ExecMaskedVfwsubwv() {
3405   asm("vfwsub.wv v8, v16, v24, v0.t\n\t"
3406       "ret\n\t");
3407 }
3408 
ExecVfwsubwf()3409 [[gnu::naked]] void ExecVfwsubwf() {
3410   asm("vfwsub.wf v8, v16, ft0\n\t"
3411       "ret\n\t");
3412 }
3413 
ExecMaskedVfwsubwf()3414 [[gnu::naked]] void ExecMaskedVfwsubwf() {
3415   asm("vfwsub.wf v8, v16, ft0, v0.t\n\t"
3416       "ret\n\t");
3417 }
3418 
TEST(InlineAsmTestRiscv64,TestVsub)3419 TEST(InlineAsmTestRiscv64, TestVsub) {
3420   TestVectorInstruction(
3421       ExecVsubvv,
3422       ExecMaskedVsubvv,
3423       {{0, 127, 254, 125, 251, 123, 250, 121, 247, 119, 246, 117, 244, 115, 242, 113},
3424        {240, 111, 238, 109, 235, 107, 234, 105, 231, 103, 230, 101, 228, 99, 226, 97},
3425        {224, 95, 222, 93, 219, 91, 218, 89, 215, 87, 214, 85, 212, 83, 210, 81},
3426        {208, 79, 206, 77, 203, 75, 202, 73, 199, 71, 198, 69, 196, 67, 194, 65},
3427        {192, 63, 190, 61, 187, 59, 186, 57, 183, 55, 182, 53, 180, 51, 178, 49},
3428        {176, 47, 174, 45, 171, 43, 170, 41, 167, 39, 166, 37, 164, 35, 162, 33},
3429        {160, 31, 158, 29, 155, 27, 154, 25, 151, 23, 150, 21, 148, 19, 146, 17},
3430        {144, 15, 142, 13, 139, 11, 138, 9, 135, 7, 134, 5, 132, 3, 130, 1}},
3431       {{0x7f00, 0x7cfe, 0x7afb, 0x78fa, 0x76f7, 0x74f6, 0x72f4, 0x70f2},
3432        {0x6ef0, 0x6cee, 0x6aeb, 0x68ea, 0x66e7, 0x64e6, 0x62e4, 0x60e2},
3433        {0x5ee0, 0x5cde, 0x5adb, 0x58da, 0x56d7, 0x54d6, 0x52d4, 0x50d2},
3434        {0x4ed0, 0x4cce, 0x4acb, 0x48ca, 0x46c7, 0x44c6, 0x42c4, 0x40c2},
3435        {0x3ec0, 0x3cbe, 0x3abb, 0x38ba, 0x36b7, 0x34b6, 0x32b4, 0x30b2},
3436        {0x2eb0, 0x2cae, 0x2aab, 0x28aa, 0x26a7, 0x24a6, 0x22a4, 0x20a2},
3437        {0x1ea0, 0x1c9e, 0x1a9b, 0x189a, 0x1697, 0x1496, 0x1294, 0x1092},
3438        {0x0e90, 0x0c8e, 0x0a8b, 0x088a, 0x0687, 0x0486, 0x0284, 0x0082}},
3439       {{0x7cfe'7f00, 0x78fa'7afb, 0x74f6'76f7, 0x70f2'72f4},
3440        {0x6cee'6ef0, 0x68ea'6aeb, 0x64e6'66e7, 0x60e2'62e4},
3441        {0x5cde'5ee0, 0x58da'5adb, 0x54d6'56d7, 0x50d2'52d4},
3442        {0x4cce'4ed0, 0x48ca'4acb, 0x44c6'46c7, 0x40c2'42c4},
3443        {0x3cbe'3ec0, 0x38ba'3abb, 0x34b6'36b7, 0x30b2'32b4},
3444        {0x2cae'2eb0, 0x28aa'2aab, 0x24a6'26a7, 0x20a2'22a4},
3445        {0x1c9e'1ea0, 0x189a'1a9b, 0x1496'1697, 0x1092'1294},
3446        {0x0c8e'0e90, 0x088a'0a8b, 0x0486'0687, 0x0082'0284}},
3447       {{0x78fa'7afb'7cfe'7f00, 0x70f2'72f4'74f6'76f7},
3448        {0x68ea'6aeb'6cee'6ef0, 0x60e2'62e4'64e6'66e7},
3449        {0x58da'5adb'5cde'5ee0, 0x50d2'52d4'54d6'56d7},
3450        {0x48ca'4acb'4cce'4ed0, 0x40c2'42c4'44c6'46c7},
3451        {0x38ba'3abb'3cbe'3ec0, 0x30b2'32b4'34b6'36b7},
3452        {0x28aa'2aab'2cae'2eb0, 0x20a2'22a4'24a6'26a7},
3453        {0x189a'1a9b'1c9e'1ea0, 0x1092'1294'1496'1697},
3454        {0x088a'0a8b'0c8e'0e90, 0x0082'0284'0486'0687}},
3455       kVectorCalculationsSourceLegacy);
3456   TestVectorInstruction(
3457       ExecVsubvx,
3458       ExecMaskedVsubvx,
3459       {{86, 215, 88, 217, 90, 219, 92, 221, 94, 223, 96, 225, 98, 227, 100, 229},
3460        {102, 231, 104, 233, 106, 235, 108, 237, 110, 239, 112, 241, 114, 243, 116, 245},
3461        {118, 247, 120, 249, 122, 251, 124, 253, 126, 255, 128, 1, 130, 3, 132, 5},
3462        {134, 7, 136, 9, 138, 11, 140, 13, 142, 15, 144, 17, 146, 19, 148, 21},
3463        {150, 23, 152, 25, 154, 27, 156, 29, 158, 31, 160, 33, 162, 35, 164, 37},
3464        {166, 39, 168, 41, 170, 43, 172, 45, 174, 47, 176, 49, 178, 51, 180, 53},
3465        {182, 55, 184, 57, 186, 59, 188, 61, 190, 63, 192, 65, 194, 67, 196, 69},
3466        {198, 71, 200, 73, 202, 75, 204, 77, 206, 79, 208, 81, 210, 83, 212, 85}},
3467       {{0xd656, 0xd858, 0xda5a, 0xdc5c, 0xde5e, 0xe060, 0xe262, 0xe464},
3468        {0xe666, 0xe868, 0xea6a, 0xec6c, 0xee6e, 0xf070, 0xf272, 0xf474},
3469        {0xf676, 0xf878, 0xfa7a, 0xfc7c, 0xfe7e, 0x0080, 0x0282, 0x0484},
3470        {0x0686, 0x0888, 0x0a8a, 0x0c8c, 0x0e8e, 0x1090, 0x1292, 0x1494},
3471        {0x1696, 0x1898, 0x1a9a, 0x1c9c, 0x1e9e, 0x20a0, 0x22a2, 0x24a4},
3472        {0x26a6, 0x28a8, 0x2aaa, 0x2cac, 0x2eae, 0x30b0, 0x32b2, 0x34b4},
3473        {0x36b6, 0x38b8, 0x3aba, 0x3cbc, 0x3ebe, 0x40c0, 0x42c2, 0x44c4},
3474        {0x46c6, 0x48c8, 0x4aca, 0x4ccc, 0x4ece, 0x50d0, 0x52d2, 0x54d4}},
3475       {{0xd857'd656, 0xdc5b'da5a, 0xe05f'de5e, 0xe463'e262},
3476        {0xe867'e666, 0xec6b'ea6a, 0xf06f'ee6e, 0xf473'f272},
3477        {0xf877'f676, 0xfc7b'fa7a, 0x007f'fe7e, 0x0484'0282},
3478        {0x0888'0686, 0x0c8c'0a8a, 0x1090'0e8e, 0x1494'1292},
3479        {0x1898'1696, 0x1c9c'1a9a, 0x20a0'1e9e, 0x24a4'22a2},
3480        {0x28a8'26a6, 0x2cac'2aaa, 0x30b0'2eae, 0x34b4'32b2},
3481        {0x38b8'36b6, 0x3cbc'3aba, 0x40c0'3ebe, 0x44c4'42c2},
3482        {0x48c8'46c6, 0x4ccc'4aca, 0x50d0'4ece, 0x54d4'52d2}},
3483       {{0xdc5b'da59'd857'd656, 0xe463'e261'e05f'de5e},
3484        {0xec6b'ea69'e867'e666, 0xf473'f271'f06f'ee6e},
3485        {0xfc7b'fa79'f877'f676, 0x0484'0282'007f'fe7e},
3486        {0x0c8c'0a8a'0888'0686, 0x1494'1292'1090'0e8e},
3487        {0x1c9c'1a9a'1898'1696, 0x24a4'22a2'20a0'1e9e},
3488        {0x2cac'2aaa'28a8'26a6, 0x34b4'32b2'30b0'2eae},
3489        {0x3cbc'3aba'38b8'36b6, 0x44c4'42c2'40c0'3ebe},
3490        {0x4ccc'4aca'48c8'46c6, 0x54d4'52d2'50d0'4ece}},
3491       kVectorCalculationsSourceLegacy);
3492   TestVectorInstruction(ExecVssubuvv,
3493                         ExecMaskedVssubuvv,
3494                         {{0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 5, 0, 3, 0, 1},
3495                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3496                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3497                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3498                          {0, 175, 0, 173, 0, 171, 0, 169, 0, 199, 0, 197, 0, 195, 0, 193},
3499                          {0, 159, 0, 157, 0, 155, 0, 153, 0, 183, 0, 181, 0, 179, 0, 177},
3500                          {0, 143, 0, 141, 0, 139, 0, 137, 0, 167, 0, 165, 0, 163, 0, 161},
3501                          {0, 127, 0, 125, 0, 123, 0, 121, 0, 151, 0, 149, 0, 147, 0, 145}},
3502                         {{0x0000, 0x0000, 0x0000, 0x0000, 0x06f7, 0x04f6, 0x02f4, 0x00f2},
3503                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
3504                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
3505                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
3506                          {0xaec0, 0xacbe, 0xaabb, 0xa8ba, 0xc6b7, 0xc4b6, 0xc2b4, 0xc0b2},
3507                          {0x9eb0, 0x9cae, 0x9aab, 0x98aa, 0xb6a7, 0xb4a6, 0xb2a4, 0xb0a2},
3508                          {0x8ea0, 0x8c9e, 0x8a9b, 0x889a, 0xa697, 0xa496, 0xa294, 0xa092},
3509                          {0x7e90, 0x7c8e, 0x7a8b, 0x788a, 0x9687, 0x9486, 0x9284, 0x9082}},
3510                         {{0x0000'0000, 0x0000'0000, 0x04f6'06f7, 0x00f2'02f4},
3511                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
3512                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
3513                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
3514                          {0xacbe'aec0, 0xa8ba'aabb, 0xc4b6'c6b7, 0xc0b2'c2b4},
3515                          {0x9cae'9eb0, 0x98aa'9aab, 0xb4a6'b6a7, 0xb0a2'b2a4},
3516                          {0x8c9e'8ea0, 0x889a'8a9b, 0xa496'a697, 0xa092'a294},
3517                          {0x7c8e'7e90, 0x788a'7a8b, 0x9486'9687, 0x9082'9284}},
3518                         {{0x0000'0000'0000'0000, 0x00f2'02f4'04f6'06f7},
3519                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
3520                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
3521                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
3522                          {0xa8ba'aabb'acbe'aec0, 0xc0b2'c2b4'c4b6'c6b7},
3523                          {0x98aa'9aab'9cae'9eb0, 0xb0a2'b2a4'b4a6'b6a7},
3524                          {0x889a'8a9b'8c9e'8ea0, 0xa092'a294'a496'a697},
3525                          {0x788a'7a8b'7c8e'7e90, 0x9082'9284'9486'9687}},
3526                         kVectorCalculationsSource);
3527   TestVectorInstruction(ExecVssubuvx,
3528                         ExecMaskedVssubuvx,
3529                         {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3530                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
3531                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 5},
3532                          {0, 7, 0, 9, 0, 11, 0, 13, 0, 15, 0, 17, 0, 19, 0, 21},
3533                          {0, 23, 0, 25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 35, 0, 37},
3534                          {0, 39, 0, 41, 0, 43, 0, 45, 0, 47, 0, 49, 0, 51, 0, 53},
3535                          {0, 55, 0, 57, 0, 59, 0, 61, 0, 63, 0, 65, 0, 67, 0, 69},
3536                          {0, 71, 0, 73, 0, 75, 0, 77, 0, 79, 0, 81, 0, 83, 0, 85}},
3537                         {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
3538                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
3539                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0282, 0x0484},
3540                          {0x0686, 0x0888, 0x0a8a, 0x0c8c, 0x0e8e, 0x1090, 0x1292, 0x1494},
3541                          {0x1696, 0x1898, 0x1a9a, 0x1c9c, 0x1e9e, 0x20a0, 0x22a2, 0x24a4},
3542                          {0x26a6, 0x28a8, 0x2aaa, 0x2cac, 0x2eae, 0x30b0, 0x32b2, 0x34b4},
3543                          {0x36b6, 0x38b8, 0x3aba, 0x3cbc, 0x3ebe, 0x40c0, 0x42c2, 0x44c4},
3544                          {0x46c6, 0x48c8, 0x4aca, 0x4ccc, 0x4ece, 0x50d0, 0x52d2, 0x54d4}},
3545                         {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
3546                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
3547                          {0x0000'0000, 0x0000'0000, 0x007f'fe7e, 0x0484'0282},
3548                          {0x0888'0686, 0x0c8c'0a8a, 0x1090'0e8e, 0x1494'1292},
3549                          {0x1898'1696, 0x1c9c'1a9a, 0x20a0'1e9e, 0x24a4'22a2},
3550                          {0x28a8'26a6, 0x2cac'2aaa, 0x30b0'2eae, 0x34b4'32b2},
3551                          {0x38b8'36b6, 0x3cbc'3aba, 0x40c0'3ebe, 0x44c4'42c2},
3552                          {0x48c8'46c6, 0x4ccc'4aca, 0x50d0'4ece, 0x54d4'52d2}},
3553                         {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
3554                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
3555                          {0x0000'0000'0000'0000, 0x0484'0282'007f'fe7e},
3556                          {0x0c8c'0a8a'0888'0686, 0x1494'1292'1090'0e8e},
3557                          {0x1c9c'1a9a'1898'1696, 0x24a4'22a2'20a0'1e9e},
3558                          {0x2cac'2aaa'28a8'26a6, 0x34b4'32b2'30b0'2eae},
3559                          {0x3cbc'3aba'38b8'36b6, 0x44c4'42c2'40c0'3ebe},
3560                          {0x4ccc'4aca'48c8'46c6, 0x54d4'52d2'50d0'4ece}},
3561                         kVectorCalculationsSource);
3562   TestVectorInstruction(
3563       ExecVssubvv,
3564       ExecMaskedVssubvv,
3565       {{0, 239, 254, 237, 251, 235, 250, 233, 247, 7, 246, 5, 244, 3, 242, 1},
3566        {240, 223, 238, 221, 235, 219, 234, 217, 231, 247, 230, 245, 228, 243, 226, 241},
3567        {224, 207, 222, 205, 219, 203, 218, 201, 215, 231, 214, 229, 212, 227, 210, 225},
3568        {208, 191, 206, 189, 203, 187, 202, 185, 199, 215, 198, 213, 196, 211, 194, 209},
3569        {127, 175, 127, 173, 127, 171, 127, 169, 127, 199, 127, 197, 127, 195, 127, 193},
3570        {127, 159, 127, 157, 127, 155, 127, 153, 127, 183, 127, 181, 127, 179, 127, 177},
3571        {127, 143, 127, 141, 127, 139, 127, 137, 127, 167, 127, 165, 127, 163, 127, 161},
3572        {127, 128, 127, 128, 127, 128, 127, 128, 127, 151, 127, 149, 127, 147, 127, 145}},
3573       {{0xef00, 0xecfe, 0xeafb, 0xe8fa, 0x06f7, 0x04f6, 0x02f4, 0x00f2},
3574        {0xdef0, 0xdcee, 0xdaeb, 0xd8ea, 0xf6e7, 0xf4e6, 0xf2e4, 0xf0e2},
3575        {0xcee0, 0xccde, 0xcadb, 0xc8da, 0xe6d7, 0xe4d6, 0xe2d4, 0xe0d2},
3576        {0xbed0, 0xbcce, 0xbacb, 0xb8ca, 0xd6c7, 0xd4c6, 0xd2c4, 0xd0c2},
3577        {0xaec0, 0xacbe, 0xaabb, 0xa8ba, 0xc6b7, 0xc4b6, 0xc2b4, 0xc0b2},
3578        {0x9eb0, 0x9cae, 0x9aab, 0x98aa, 0xb6a7, 0xb4a6, 0xb2a4, 0xb0a2},
3579        {0x8ea0, 0x8c9e, 0x8a9b, 0x889a, 0xa697, 0xa496, 0xa294, 0xa092},
3580        {0x8000, 0x8000, 0x8000, 0x8000, 0x9687, 0x9486, 0x9284, 0x9082}},
3581       {{0xecfd'ef00, 0xe8f9'eafb, 0x04f6'06f7, 0x00f2'02f4},
3582        {0xdced'def0, 0xd8e9'daeb, 0xf4e5'f6e7, 0xf0e1'f2e4},
3583        {0xccdd'cee0, 0xc8d9'cadb, 0xe4d5'e6d7, 0xe0d1'e2d4},
3584        {0xbccd'bed0, 0xb8c9'bacb, 0xd4c5'd6c7, 0xd0c1'd2c4},
3585        {0xacbe'aec0, 0xa8ba'aabb, 0xc4b6'c6b7, 0xc0b2'c2b4},
3586        {0x9cae'9eb0, 0x98aa'9aab, 0xb4a6'b6a7, 0xb0a2'b2a4},
3587        {0x8c9e'8ea0, 0x889a'8a9b, 0xa496'a697, 0xa092'a294},
3588        {0x8000'0000, 0x8000'0000, 0x9486'9687, 0x9082'9284}},
3589       {{0xe8f9'eafa'ecfd'ef00, 0x00f2'02f4'04f6'06f7},
3590        {0xd8e9'daea'dced'def0, 0xf0e1'f2e3'f4e5'f6e7},
3591        {0xc8d9'cada'ccdd'cee0, 0xe0d1'e2d3'e4d5'e6d7},
3592        {0xb8c9'baca'bccd'bed0, 0xd0c1'd2c3'd4c5'd6c7},
3593        {0xa8ba'aabb'acbe'aec0, 0xc0b2'c2b4'c4b6'c6b7},
3594        {0x98aa'9aab'9cae'9eb0, 0xb0a2'b2a4'b4a6'b6a7},
3595        {0x889a'8a9b'8c9e'8ea0, 0xa092'a294'a496'a697},
3596        {0x8000'0000'0000'0000, 0x9082'9284'9486'9687}},
3597       kVectorCalculationsSource);
3598   TestVectorInstruction(
3599       ExecVssubvx,
3600       ExecMaskedVssubvx,
3601       {{86, 215, 88, 217, 90, 219, 92, 221, 94, 223, 96, 225, 98, 227, 100, 229},
3602        {102, 231, 104, 233, 106, 235, 108, 237, 110, 239, 112, 241, 114, 243, 116, 245},
3603        {118, 247, 120, 249, 122, 251, 124, 253, 126, 255, 127, 1, 127, 3, 127, 5},
3604        {127, 7, 127, 9, 127, 11, 127, 13, 127, 15, 127, 17, 127, 19, 127, 21},
3605        {127, 23, 127, 25, 127, 27, 127, 29, 127, 31, 127, 33, 127, 35, 127, 37},
3606        {127, 39, 127, 41, 127, 43, 127, 45, 127, 47, 127, 49, 127, 51, 127, 53},
3607        {127, 55, 127, 57, 127, 59, 127, 61, 127, 63, 127, 65, 127, 67, 127, 69},
3608        {127, 71, 127, 73, 127, 75, 127, 77, 127, 79, 127, 81, 127, 83, 127, 85}},
3609       {{0xd656, 0xd858, 0xda5a, 0xdc5c, 0xde5e, 0xe060, 0xe262, 0xe464},
3610        {0xe666, 0xe868, 0xea6a, 0xec6c, 0xee6e, 0xf070, 0xf272, 0xf474},
3611        {0xf676, 0xf878, 0xfa7a, 0xfc7c, 0xfe7e, 0x0080, 0x0282, 0x0484},
3612        {0x0686, 0x0888, 0x0a8a, 0x0c8c, 0x0e8e, 0x1090, 0x1292, 0x1494},
3613        {0x1696, 0x1898, 0x1a9a, 0x1c9c, 0x1e9e, 0x20a0, 0x22a2, 0x24a4},
3614        {0x26a6, 0x28a8, 0x2aaa, 0x2cac, 0x2eae, 0x30b0, 0x32b2, 0x34b4},
3615        {0x36b6, 0x38b8, 0x3aba, 0x3cbc, 0x3ebe, 0x40c0, 0x42c2, 0x44c4},
3616        {0x46c6, 0x48c8, 0x4aca, 0x4ccc, 0x4ece, 0x50d0, 0x52d2, 0x54d4}},
3617       {{0xd857'd656, 0xdc5b'da5a, 0xe05f'de5e, 0xe463'e262},
3618        {0xe867'e666, 0xec6b'ea6a, 0xf06f'ee6e, 0xf473'f272},
3619        {0xf877'f676, 0xfc7b'fa7a, 0x007f'fe7e, 0x0484'0282},
3620        {0x0888'0686, 0x0c8c'0a8a, 0x1090'0e8e, 0x1494'1292},
3621        {0x1898'1696, 0x1c9c'1a9a, 0x20a0'1e9e, 0x24a4'22a2},
3622        {0x28a8'26a6, 0x2cac'2aaa, 0x30b0'2eae, 0x34b4'32b2},
3623        {0x38b8'36b6, 0x3cbc'3aba, 0x40c0'3ebe, 0x44c4'42c2},
3624        {0x48c8'46c6, 0x4ccc'4aca, 0x50d0'4ece, 0x54d4'52d2}},
3625       {{0xdc5b'da59'd857'd656, 0xe463'e261'e05f'de5e},
3626        {0xec6b'ea69'e867'e666, 0xf473'f271'f06f'ee6e},
3627        {0xfc7b'fa79'f877'f676, 0x0484'0282'007f'fe7e},
3628        {0x0c8c'0a8a'0888'0686, 0x1494'1292'1090'0e8e},
3629        {0x1c9c'1a9a'1898'1696, 0x24a4'22a2'20a0'1e9e},
3630        {0x2cac'2aaa'28a8'26a6, 0x34b4'32b2'30b0'2eae},
3631        {0x3cbc'3aba'38b8'36b6, 0x44c4'42c2'40c0'3ebe},
3632        {0x4ccc'4aca'48c8'46c6, 0x54d4'52d2'50d0'4ece}},
3633       kVectorCalculationsSource);
3634 
3635   TestVectorFloatInstruction(ExecVfsubvv,
3636                              ExecMaskedVfsubvv,
3637                              {{0x1604'9200, 0x1e0c'9a09, 0x8b0a'63e7, 0x8ece'd50c},
3638                               {0x3624'b220, 0x3e2c'ba29, 0x2634'a22f, 0x2e3c'aa38},
3639                               {0x5644'd240, 0x5e4c'da49, 0x4654'c251, 0x4e5c'ca58},
3640                               {0x7664'f260, 0x7e6c'fa69, 0x6674'e271, 0x6e7c'ea78},
3641                               {0xc342'c140, 0xc746'c544, 0xcb4a'c948, 0xcf4e'cd4c},
3642                               {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
3643                               {0xe362'e160, 0xe766'e5ca, 0xeb6a'e968, 0xef6e'ed6c},
3644                               {0xf6e6'58c3, 0xfeec'7cd7, 0xfb7a'f978, 0xff7e'fd7c}},
3645                              {{0x1e0c'9a09'9604'9200, 0x8f0e'8cd3'76d9'7cdf},
3646                               {0x3e2c'ba29'b624'b220, 0x2e3c'aa38'a634'a231},
3647                               {0x5e4c'da49'd644'd240, 0x4e5c'ca58'c654'c251},
3648                               {0x7e6c'fa69'f664'f260, 0x6e7c'ea78'e674'e271},
3649                               {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3650                               {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3651                               {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3652                               {0xfeec'7ae9'76e4'72e0, 0xff7e'fd7c'fb7a'f978}},
3653                              kVectorCalculationsSource);
3654   TestVectorFloatInstruction(ExecVfsubvf,
3655                              ExecMaskedVfsubvf,
3656                              {{0xc0b4'0000, 0xc0b4'0000, 0xc0b4'0000, 0xc0b4'0000},
3657                               {0xc0b4'0000, 0xc0b4'0000, 0xc0b4'0000, 0xc0b4'0000},
3658                               {0xc0b4'0000, 0xc0b4'0000, 0xc0b4'0000, 0xc0b4'0000},
3659                               {0xc0b4'0000, 0xc0b4'0017, 0xc0b4'1757, 0xc0cb'd7a8},
3660                               {0xc348'6140, 0xc746'cae4, 0xcb4a'c94e, 0xcf4e'cd4c},
3661                               {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
3662                               {0xe362'e160, 0xe766'e564, 0xeb6a'e968, 0xef6e'ed6c},
3663                               {0xf372'f170, 0xf776'f574, 0xfb7a'f978, 0xff7e'fd7c}},
3664                              {{0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3665                               {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3666                               {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3667                               {0xc016'8000'0000'0000, 0xc016'807a'f4f2'eceb},
3668                               {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3669                               {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3670                               {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3671                               {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
3672                              kVectorCalculationsSource);
3673 
3674   TestWideningVectorFloatInstruction(ExecVfwsubvv,
3675                                      ExecMaskedVfwsubvv,
3676                                      {{0x3ac0'923f'ffff'bec0, 0x3bc1'9341'1fff'ffbd},
3677                                       {0xb961'4c7c'ef78'0000, 0xb9d9'daa1'8000'0000},
3678                                       {0x3ec4'9644'0000'0000, 0x3fc5'9745'2000'0000},
3679                                       {0x3cc6'9445'd2b3'7400, 0x3dc7'9546'ffb0'b172},
3680                                       {0x42c8'9a48'0000'0000, 0x43c9'9b49'2000'0000},
3681                                       {0x40ca'984a'2000'0000, 0x41cb'994b'0000'0000},
3682                                       {0x46cc'9e4c'0000'0000, 0x47cd'9f4d'2000'0000},
3683                                       {0x44ce'9c4e'2000'0000, 0x45cf'9d4f'0000'0000}},
3684                                      kVectorCalculationsSource);
3685   TestWideningVectorFloatInstruction(ExecVfwsubvf,
3686                                      ExecMaskedVfwsubvf,
3687                                      {{0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3688                                       {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3689                                       {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3690                                       {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3691                                       {0xc016'8000'0000'0000, 0xc016'8000'0000'0003},
3692                                       {0xc016'8000'0000'02ab, 0xc016'8000'0002'bab5},
3693                                       {0xc016'8000'02ca'c4c0, 0xc016'8002'dad4'd000},
3694                                       {0xc016'82ea'e4e0'0000, 0xc019'7af4'f000'0000}},
3695                                      kVectorCalculationsSource);
3696 
3697   TestWideningVectorFloatInstruction(ExecVfwsubwv,
3698                                      ExecMaskedVfwsubwv,
3699                                      {{0x3ac0'9240'0000'0000, 0x3bc1'9341'2000'0000},
3700                                       {0x38c2'9042'2000'0000, 0x39c3'9143'0000'0000},
3701                                       {0x3ec4'9644'0000'0000, 0x3fc5'9745'2000'0000},
3702                                       {0x3cc6'9446'2000'0000, 0xbf3e'bd3c'8c10'2b38},
3703                                       {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3704                                       {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3705                                       {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3706                                       {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
3707                                      kVectorCalculationsSource);
3708   TestWideningVectorFloatInstruction(ExecVfwsubwf,
3709                                      ExecMaskedVfwsubwf,
3710                                      {{0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3711                                       {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3712                                       {0xc016'8000'0000'0000, 0xc016'8000'0000'0000},
3713                                       {0xc016'8000'0000'0000, 0xc016'807a'f4f2'eceb},
3714                                       {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
3715                                       {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
3716                                       {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
3717                                       {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
3718                                      kVectorCalculationsSource);
3719 }
3720 
ExecVandvv()3721 [[gnu::naked]] void ExecVandvv() {
3722   asm("vand.vv v8, v16, v24\n\t"
3723       "ret\n\t");
3724 }
3725 
ExecMaskedVandvv()3726 [[gnu::naked]] void ExecMaskedVandvv() {
3727   asm("vand.vv v8, v16, v24, v0.t\n\t"
3728       "ret\n\t");
3729 }
3730 
ExecVandvx()3731 [[gnu::naked]] void ExecVandvx() {
3732   asm("vand.vx v8, v16, t0\n\t"
3733       "ret\n\t");
3734 }
3735 
ExecMaskedVandvx()3736 [[gnu::naked]] void ExecMaskedVandvx() {
3737   asm("vand.vx v8, v16, t0, v0.t\n\t"
3738       "ret\n\t");
3739 }
3740 
ExecVandvi()3741 [[gnu::naked]] void ExecVandvi() {
3742   asm("vand.vi v8, v16, -0xb\n\t"
3743       "ret\n\t");
3744 }
3745 
ExecMaskedVandvi()3746 [[gnu::naked]] void ExecMaskedVandvi() {
3747   asm("vand.vi v8, v16, -0xb, v0.t\n\t"
3748       "ret\n\t");
3749 }
3750 
TEST(InlineAsmTestRiscv64,TestVand)3751 TEST(InlineAsmTestRiscv64, TestVand) {
3752   TestVectorInstruction(
3753       ExecVandvv,
3754       ExecMaskedVandvv,
3755       {{0, 0, 0, 2, 0, 0, 4, 6, 0, 0, 0, 2, 8, 8, 12, 14},
3756        {0, 0, 0, 2, 0, 0, 4, 6, 16, 16, 16, 18, 24, 24, 28, 30},
3757        {0, 0, 0, 2, 0, 0, 4, 6, 0, 0, 0, 2, 8, 8, 12, 14},
3758        {32, 32, 32, 34, 32, 32, 36, 38, 48, 48, 48, 50, 56, 56, 60, 62},
3759        {0, 128, 0, 130, 0, 128, 4, 134, 0, 128, 0, 130, 8, 136, 12, 142},
3760        {0, 128, 0, 130, 0, 128, 4, 134, 16, 144, 16, 146, 24, 152, 28, 158},
3761        {64, 192, 64, 194, 64, 192, 68, 198, 64, 192, 64, 194, 72, 200, 76, 206},
3762        {96, 224, 96, 226, 96, 224, 100, 230, 112, 240, 112, 242, 120, 248, 124, 254}},
3763       {{0x0000, 0x0200, 0x0000, 0x0604, 0x0000, 0x0200, 0x0808, 0x0e0c},
3764        {0x0000, 0x0200, 0x0000, 0x0604, 0x1010, 0x1210, 0x1818, 0x1e1c},
3765        {0x0000, 0x0200, 0x0000, 0x0604, 0x0000, 0x0200, 0x0808, 0x0e0c},
3766        {0x2020, 0x2220, 0x2020, 0x2624, 0x3030, 0x3230, 0x3838, 0x3e3c},
3767        {0x8000, 0x8200, 0x8000, 0x8604, 0x8000, 0x8200, 0x8808, 0x8e0c},
3768        {0x8000, 0x8200, 0x8000, 0x8604, 0x9010, 0x9210, 0x9818, 0x9e1c},
3769        {0xc040, 0xc240, 0xc040, 0xc644, 0xc040, 0xc240, 0xc848, 0xce4c},
3770        {0xe060, 0xe260, 0xe060, 0xe664, 0xf070, 0xf270, 0xf878, 0xfe7c}},
3771       {{0x0200'0000, 0x0604'0000, 0x0200'0000, 0x0e0c'0808},
3772        {0x0200'0000, 0x0604'0000, 0x1210'1010, 0x1e1c'1818},
3773        {0x0200'0000, 0x0604'0000, 0x0200'0000, 0x0e0c'0808},
3774        {0x2220'2020, 0x2624'2020, 0x3230'3030, 0x3e3c'3838},
3775        {0x8200'8000, 0x8604'8000, 0x8200'8000, 0x8e0c'8808},
3776        {0x8200'8000, 0x8604'8000, 0x9210'9010, 0x9e1c'9818},
3777        {0xc240'c040, 0xc644'c040, 0xc240'c040, 0xce4c'c848},
3778        {0xe260'e060, 0xe664'e060, 0xf270'f070, 0xfe7c'f878}},
3779       {{0x0604'0000'0200'0000, 0x0e0c'0808'0200'0000},
3780        {0x0604'0000'0200'0000, 0x1e1c'1818'1210'1010},
3781        {0x0604'0000'0200'0000, 0x0e0c'0808'0200'0000},
3782        {0x2624'2020'2220'2020, 0x3e3c'3838'3230'3030},
3783        {0x8604'8000'8200'8000, 0x8e0c'8808'8200'8000},
3784        {0x8604'8000'8200'8000, 0x9e1c'9818'9210'9010},
3785        {0xc644'c040'c240'c040, 0xce4c'c848'c240'c040},
3786        {0xe664'e060'e260'e060, 0xfe7c'f878'f270'f070}},
3787       kVectorCalculationsSourceLegacy);
3788   TestVectorInstruction(ExecVandvx,
3789                         ExecMaskedVandvx,
3790                         {{0, 128, 2, 130, 0, 128, 2, 130, 8, 136, 10, 138, 8, 136, 10, 138},
3791                          {0, 128, 2, 130, 0, 128, 2, 130, 8, 136, 10, 138, 8, 136, 10, 138},
3792                          {32, 160, 34, 162, 32, 160, 34, 162, 40, 168, 42, 170, 40, 168, 42, 170},
3793                          {32, 160, 34, 162, 32, 160, 34, 162, 40, 168, 42, 170, 40, 168, 42, 170},
3794                          {0, 128, 2, 130, 0, 128, 2, 130, 8, 136, 10, 138, 8, 136, 10, 138},
3795                          {0, 128, 2, 130, 0, 128, 2, 130, 8, 136, 10, 138, 8, 136, 10, 138},
3796                          {32, 160, 34, 162, 32, 160, 34, 162, 40, 168, 42, 170, 40, 168, 42, 170},
3797                          {32, 160, 34, 162, 32, 160, 34, 162, 40, 168, 42, 170, 40, 168, 42, 170}},
3798                         {{0x8000, 0x8202, 0x8000, 0x8202, 0x8808, 0x8a0a, 0x8808, 0x8a0a},
3799                          {0x8000, 0x8202, 0x8000, 0x8202, 0x8808, 0x8a0a, 0x8808, 0x8a0a},
3800                          {0xa020, 0xa222, 0xa020, 0xa222, 0xa828, 0xaa2a, 0xa828, 0xaa2a},
3801                          {0xa020, 0xa222, 0xa020, 0xa222, 0xa828, 0xaa2a, 0xa828, 0xaa2a},
3802                          {0x8000, 0x8202, 0x8000, 0x8202, 0x8808, 0x8a0a, 0x8808, 0x8a0a},
3803                          {0x8000, 0x8202, 0x8000, 0x8202, 0x8808, 0x8a0a, 0x8808, 0x8a0a},
3804                          {0xa020, 0xa222, 0xa020, 0xa222, 0xa828, 0xaa2a, 0xa828, 0xaa2a},
3805                          {0xa020, 0xa222, 0xa020, 0xa222, 0xa828, 0xaa2a, 0xa828, 0xaa2a}},
3806                         {{0x8202'8000, 0x8202'8000, 0x8a0a'8808, 0x8a0a'8808},
3807                          {0x8202'8000, 0x8202'8000, 0x8a0a'8808, 0x8a0a'8808},
3808                          {0xa222'a020, 0xa222'a020, 0xaa2a'a828, 0xaa2a'a828},
3809                          {0xa222'a020, 0xa222'a020, 0xaa2a'a828, 0xaa2a'a828},
3810                          {0x8202'8000, 0x8202'8000, 0x8a0a'8808, 0x8a0a'8808},
3811                          {0x8202'8000, 0x8202'8000, 0x8a0a'8808, 0x8a0a'8808},
3812                          {0xa222'a020, 0xa222'a020, 0xaa2a'a828, 0xaa2a'a828},
3813                          {0xa222'a020, 0xa222'a020, 0xaa2a'a828, 0xaa2a'a828}},
3814                         {{0x8202'8000'8202'8000, 0x8a0a'8808'8a0a'8808},
3815                          {0x8202'8000'8202'8000, 0x8a0a'8808'8a0a'8808},
3816                          {0xa222'a020'a222'a020, 0xaa2a'a828'aa2a'a828},
3817                          {0xa222'a020'a222'a020, 0xaa2a'a828'aa2a'a828},
3818                          {0x8202'8000'8202'8000, 0x8a0a'8808'8a0a'8808},
3819                          {0x8202'8000'8202'8000, 0x8a0a'8808'8a0a'8808},
3820                          {0xa222'a020'a222'a020, 0xaa2a'a828'aa2a'a828},
3821                          {0xa222'a020'a222'a020, 0xaa2a'a828'aa2a'a828}},
3822                         kVectorCalculationsSourceLegacy);
3823   TestVectorInstruction(
3824       ExecVandvi,
3825       ExecMaskedVandvi,
3826       {{0, 129, 0, 129, 4, 133, 4, 133, 0, 129, 0, 129, 4, 133, 4, 133},
3827        {16, 145, 16, 145, 20, 149, 20, 149, 16, 145, 16, 145, 20, 149, 20, 149},
3828        {32, 161, 32, 161, 36, 165, 36, 165, 32, 161, 32, 161, 36, 165, 36, 165},
3829        {48, 177, 48, 177, 52, 181, 52, 181, 48, 177, 48, 177, 52, 181, 52, 181},
3830        {64, 193, 64, 193, 68, 197, 68, 197, 64, 193, 64, 193, 68, 197, 68, 197},
3831        {80, 209, 80, 209, 84, 213, 84, 213, 80, 209, 80, 209, 84, 213, 84, 213},
3832        {96, 225, 96, 225, 100, 229, 100, 229, 96, 225, 96, 225, 100, 229, 100, 229},
3833        {112, 241, 112, 241, 116, 245, 116, 245, 112, 241, 112, 241, 116, 245, 116, 245}},
3834       {{0x8100, 0x8300, 0x8504, 0x8704, 0x8900, 0x8b00, 0x8d04, 0x8f04},
3835        {0x9110, 0x9310, 0x9514, 0x9714, 0x9910, 0x9b10, 0x9d14, 0x9f14},
3836        {0xa120, 0xa320, 0xa524, 0xa724, 0xa920, 0xab20, 0xad24, 0xaf24},
3837        {0xb130, 0xb330, 0xb534, 0xb734, 0xb930, 0xbb30, 0xbd34, 0xbf34},
3838        {0xc140, 0xc340, 0xc544, 0xc744, 0xc940, 0xcb40, 0xcd44, 0xcf44},
3839        {0xd150, 0xd350, 0xd554, 0xd754, 0xd950, 0xdb50, 0xdd54, 0xdf54},
3840        {0xe160, 0xe360, 0xe564, 0xe764, 0xe960, 0xeb60, 0xed64, 0xef64},
3841        {0xf170, 0xf370, 0xf574, 0xf774, 0xf970, 0xfb70, 0xfd74, 0xff74}},
3842       {{0x8302'8100, 0x8706'8504, 0x8b0a'8900, 0x8f0e'8d04},
3843        {0x9312'9110, 0x9716'9514, 0x9b1a'9910, 0x9f1e'9d14},
3844        {0xa322'a120, 0xa726'a524, 0xab2a'a920, 0xaf2e'ad24},
3845        {0xb332'b130, 0xb736'b534, 0xbb3a'b930, 0xbf3e'bd34},
3846        {0xc342'c140, 0xc746'c544, 0xcb4a'c940, 0xcf4e'cd44},
3847        {0xd352'd150, 0xd756'd554, 0xdb5a'd950, 0xdf5e'dd54},
3848        {0xe362'e160, 0xe766'e564, 0xeb6a'e960, 0xef6e'ed64},
3849        {0xf372'f170, 0xf776'f574, 0xfb7a'f970, 0xff7e'fd74}},
3850       {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8900},
3851        {0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9910},
3852        {0xa726'a524'a322'a120, 0xaf2e'ad2c'ab2a'a920},
3853        {0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b930},
3854        {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c940},
3855        {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd950},
3856        {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e960},
3857        {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f970}},
3858       kVectorCalculationsSourceLegacy);
3859 }
3860 
ExecVorvv()3861 [[gnu::naked]] void ExecVorvv() {
3862   asm("vor.vv v8, v16, v24\n\t"
3863       "ret\n\t");
3864 }
3865 
ExecMaskedVorvv()3866 [[gnu::naked]] void ExecMaskedVorvv() {
3867   asm("vor.vv v8, v16, v24, v0.t\n\t"
3868       "ret\n\t");
3869 }
ExecVorvx()3870 [[gnu::naked]] void ExecVorvx() {
3871   asm("vor.vx v8, v16, t0\n\t"
3872       "ret\n\t");
3873 }
3874 
ExecMaskedVorvx()3875 [[gnu::naked]] void ExecMaskedVorvx() {
3876   asm("vor.vx v8, v16, t0, v0.t\n\t"
3877       "ret\n\t");
3878 }
ExecVorvi()3879 [[gnu::naked]] void ExecVorvi() {
3880   asm("vor.vi v8, v16, -0xb\n\t"
3881       "ret\n\t");
3882 }
3883 
ExecMaskedVorvi()3884 [[gnu::naked]] void ExecMaskedVorvi() {
3885   asm("vor.vi v8, v16, -0xb, v0.t\n\t"
3886       "ret\n\t");
3887 }
3888 
TEST(InlineAsmTestRiscv64,TestVor)3889 TEST(InlineAsmTestRiscv64, TestVor) {
3890   TestVectorInstruction(
3891       ExecVorvv,
3892       ExecMaskedVorvv,
3893       {{0, 131, 6, 135, 13, 143, 14, 143, 25, 155, 30, 159, 28, 159, 30, 159},
3894        {48, 179, 54, 183, 61, 191, 62, 191, 57, 187, 62, 191, 60, 191, 62, 191},
3895        {96, 227, 102, 231, 109, 239, 110, 239, 121, 251, 126, 255, 124, 255, 126, 255},
3896        {112, 243, 118, 247, 125, 255, 126, 255, 121, 251, 126, 255, 124, 255, 126, 255},
3897        {192, 195, 198, 199, 205, 207, 206, 207, 217, 219, 222, 223, 220, 223, 222, 223},
3898        {240, 243, 246, 247, 253, 255, 254, 255, 249, 251, 254, 255, 252, 255, 254, 255},
3899        {224, 227, 230, 231, 237, 239, 238, 239, 249, 251, 254, 255, 252, 255, 254, 255},
3900        {240, 243, 246, 247, 253, 255, 254, 255, 249, 251, 254, 255, 252, 255, 254, 255}},
3901       {{0x8300, 0x8706, 0x8f0d, 0x8f0e, 0x9b19, 0x9f1e, 0x9f1c, 0x9f1e},
3902        {0xb330, 0xb736, 0xbf3d, 0xbf3e, 0xbb39, 0xbf3e, 0xbf3c, 0xbf3e},
3903        {0xe360, 0xe766, 0xef6d, 0xef6e, 0xfb79, 0xff7e, 0xff7c, 0xff7e},
3904        {0xf370, 0xf776, 0xff7d, 0xff7e, 0xfb79, 0xff7e, 0xff7c, 0xff7e},
3905        {0xc3c0, 0xc7c6, 0xcfcd, 0xcfce, 0xdbd9, 0xdfde, 0xdfdc, 0xdfde},
3906        {0xf3f0, 0xf7f6, 0xfffd, 0xfffe, 0xfbf9, 0xfffe, 0xfffc, 0xfffe},
3907        {0xe3e0, 0xe7e6, 0xefed, 0xefee, 0xfbf9, 0xfffe, 0xfffc, 0xfffe},
3908        {0xf3f0, 0xf7f6, 0xfffd, 0xfffe, 0xfbf9, 0xfffe, 0xfffc, 0xfffe}},
3909       {{0x8706'8300, 0x8f0e'8f0d, 0x9f1e'9b19, 0x9f1e'9f1c},
3910        {0xb736'b330, 0xbf3e'bf3d, 0xbf3e'bb39, 0xbf3e'bf3c},
3911        {0xe766'e360, 0xef6e'ef6d, 0xff7e'fb79, 0xff7e'ff7c},
3912        {0xf776'f370, 0xff7e'ff7d, 0xff7e'fb79, 0xff7e'ff7c},
3913        {0xc7c6'c3c0, 0xcfce'cfcd, 0xdfde'dbd9, 0xdfde'dfdc},
3914        {0xf7f6'f3f0, 0xfffe'fffd, 0xfffe'fbf9, 0xfffe'fffc},
3915        {0xe7e6'e3e0, 0xefee'efed, 0xfffe'fbf9, 0xfffe'fffc},
3916        {0xf7f6'f3f0, 0xfffe'fffd, 0xfffe'fbf9, 0xfffe'fffc}},
3917       {{0x8f0e'8f0d'8706'8300, 0x9f1e'9f1c'9f1e'9b19},
3918        {0xbf3e'bf3d'b736'b330, 0xbf3e'bf3c'bf3e'bb39},
3919        {0xef6e'ef6d'e766'e360, 0xff7e'ff7c'ff7e'fb79},
3920        {0xff7e'ff7d'f776'f370, 0xff7e'ff7c'ff7e'fb79},
3921        {0xcfce'cfcd'c7c6'c3c0, 0xdfde'dfdc'dfde'dbd9},
3922        {0xfffe'fffd'f7f6'f3f0, 0xfffe'fffc'fffe'fbf9},
3923        {0xefee'efed'e7e6'e3e0, 0xfffe'fffc'fffe'fbf9},
3924        {0xfffe'fffd'f7f6'f3f0, 0xfffe'fffc'fffe'fbf9}},
3925       kVectorCalculationsSourceLegacy);
3926   TestVectorInstruction(
3927       ExecVorvx,
3928       ExecMaskedVorvx,
3929       {{170, 171, 170, 171, 174, 175, 174, 175, 170, 171, 170, 171, 174, 175, 174, 175},
3930        {186, 187, 186, 187, 190, 191, 190, 191, 186, 187, 186, 187, 190, 191, 190, 191},
3931        {170, 171, 170, 171, 174, 175, 174, 175, 170, 171, 170, 171, 174, 175, 174, 175},
3932        {186, 187, 186, 187, 190, 191, 190, 191, 186, 187, 186, 187, 190, 191, 190, 191},
3933        {234, 235, 234, 235, 238, 239, 238, 239, 234, 235, 234, 235, 238, 239, 238, 239},
3934        {250, 251, 250, 251, 254, 255, 254, 255, 250, 251, 250, 251, 254, 255, 254, 255},
3935        {234, 235, 234, 235, 238, 239, 238, 239, 234, 235, 234, 235, 238, 239, 238, 239},
3936        {250, 251, 250, 251, 254, 255, 254, 255, 250, 251, 250, 251, 254, 255, 254, 255}},
3937       {{0xabaa, 0xabaa, 0xafae, 0xafae, 0xabaa, 0xabaa, 0xafae, 0xafae},
3938        {0xbbba, 0xbbba, 0xbfbe, 0xbfbe, 0xbbba, 0xbbba, 0xbfbe, 0xbfbe},
3939        {0xabaa, 0xabaa, 0xafae, 0xafae, 0xabaa, 0xabaa, 0xafae, 0xafae},
3940        {0xbbba, 0xbbba, 0xbfbe, 0xbfbe, 0xbbba, 0xbbba, 0xbfbe, 0xbfbe},
3941        {0xebea, 0xebea, 0xefee, 0xefee, 0xebea, 0xebea, 0xefee, 0xefee},
3942        {0xfbfa, 0xfbfa, 0xfffe, 0xfffe, 0xfbfa, 0xfbfa, 0xfffe, 0xfffe},
3943        {0xebea, 0xebea, 0xefee, 0xefee, 0xebea, 0xebea, 0xefee, 0xefee},
3944        {0xfbfa, 0xfbfa, 0xfffe, 0xfffe, 0xfbfa, 0xfbfa, 0xfffe, 0xfffe}},
3945       {{0xabaa'abaa, 0xafae'afae, 0xabaa'abaa, 0xafae'afae},
3946        {0xbbba'bbba, 0xbfbe'bfbe, 0xbbba'bbba, 0xbfbe'bfbe},
3947        {0xabaa'abaa, 0xafae'afae, 0xabaa'abaa, 0xafae'afae},
3948        {0xbbba'bbba, 0xbfbe'bfbe, 0xbbba'bbba, 0xbfbe'bfbe},
3949        {0xebea'ebea, 0xefee'efee, 0xebea'ebea, 0xefee'efee},
3950        {0xfbfa'fbfa, 0xfffe'fffe, 0xfbfa'fbfa, 0xfffe'fffe},
3951        {0xebea'ebea, 0xefee'efee, 0xebea'ebea, 0xefee'efee},
3952        {0xfbfa'fbfa, 0xfffe'fffe, 0xfbfa'fbfa, 0xfffe'fffe}},
3953       {{0xafae'afae'abaa'abaa, 0xafae'afae'abaa'abaa},
3954        {0xbfbe'bfbe'bbba'bbba, 0xbfbe'bfbe'bbba'bbba},
3955        {0xafae'afae'abaa'abaa, 0xafae'afae'abaa'abaa},
3956        {0xbfbe'bfbe'bbba'bbba, 0xbfbe'bfbe'bbba'bbba},
3957        {0xefee'efee'ebea'ebea, 0xefee'efee'ebea'ebea},
3958        {0xfffe'fffe'fbfa'fbfa, 0xfffe'fffe'fbfa'fbfa},
3959        {0xefee'efee'ebea'ebea, 0xefee'efee'ebea'ebea},
3960        {0xfffe'fffe'fbfa'fbfa, 0xfffe'fffe'fbfa'fbfa}},
3961       kVectorCalculationsSourceLegacy);
3962   TestVectorInstruction(
3963       ExecVorvi,
3964       ExecMaskedVorvi,
3965       {{245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3966        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3967        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3968        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3969        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3970        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3971        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255},
3972        {245, 245, 247, 247, 245, 245, 247, 247, 253, 253, 255, 255, 253, 253, 255, 255}},
3973       {{0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3974        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3975        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3976        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3977        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3978        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3979        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff},
3980        {0xfff5, 0xfff7, 0xfff5, 0xfff7, 0xfffd, 0xffff, 0xfffd, 0xffff}},
3981       {{0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3982        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3983        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3984        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3985        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3986        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3987        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd},
3988        {0xffff'fff5, 0xffff'fff5, 0xffff'fffd, 0xffff'fffd}},
3989       {{0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3990        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3991        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3992        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3993        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3994        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3995        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd},
3996        {0xffff'ffff'ffff'fff5, 0xffff'ffff'ffff'fffd}},
3997       kVectorCalculationsSourceLegacy);
3998 }
3999 
ExecVxorvv()4000 [[gnu::naked]] void ExecVxorvv() {
4001   asm("vxor.vv v8, v16, v24\n\t"
4002       "ret\n\t");
4003 }
4004 
ExecMaskedVxorvv()4005 [[gnu::naked]] void ExecMaskedVxorvv() {
4006   asm("vxor.vv v8, v16, v24, v0.t\n\t"
4007       "ret\n\t");
4008 }
ExecVxorvx()4009 [[gnu::naked]] void ExecVxorvx() {
4010   asm("vxor.vx v8, v16, t0\n\t"
4011       "ret\n\t");
4012 }
4013 
ExecMaskedVxorvx()4014 [[gnu::naked]] void ExecMaskedVxorvx() {
4015   asm("vxor.vx v8, v16, t0, v0.t\n\t"
4016       "ret\n\t");
4017 }
ExecVxorvi()4018 [[gnu::naked]] void ExecVxorvi() {
4019   asm("vxor.vi v8, v16, -0xb\n\t"
4020       "ret\n\t");
4021 }
4022 
ExecMaskedVxorvi()4023 [[gnu::naked]] void ExecMaskedVxorvi() {
4024   asm("vxor.vi v8, v16, -0xb, v0.t\n\t"
4025       "ret\n\t");
4026 }
4027 
TEST(InlineAsmTestRiscv64,TestVxor)4028 TEST(InlineAsmTestRiscv64, TestVxor) {
4029   TestVectorInstruction(
4030       ExecVxorvv,
4031       ExecMaskedVxorvv,
4032       {{0, 131, 6, 133, 13, 143, 10, 137, 25, 155, 30, 157, 20, 151, 18, 145},
4033        {48, 179, 54, 181, 61, 191, 58, 185, 41, 171, 46, 173, 36, 167, 34, 161},
4034        {96, 227, 102, 229, 109, 239, 106, 233, 121, 251, 126, 253, 116, 247, 114, 241},
4035        {80, 211, 86, 213, 93, 223, 90, 217, 73, 203, 78, 205, 68, 199, 66, 193},
4036        {192, 67, 198, 69, 205, 79, 202, 73, 217, 91, 222, 93, 212, 87, 210, 81},
4037        {240, 115, 246, 117, 253, 127, 250, 121, 233, 107, 238, 109, 228, 103, 226, 97},
4038        {160, 35, 166, 37, 173, 47, 170, 41, 185, 59, 190, 61, 180, 55, 178, 49},
4039        {144, 19, 150, 21, 157, 31, 154, 25, 137, 11, 142, 13, 132, 7, 130, 1}},
4040       {{0x8300, 0x8506, 0x8f0d, 0x890a, 0x9b19, 0x9d1e, 0x9714, 0x9112},
4041        {0xb330, 0xb536, 0xbf3d, 0xb93a, 0xab29, 0xad2e, 0xa724, 0xa122},
4042        {0xe360, 0xe566, 0xef6d, 0xe96a, 0xfb79, 0xfd7e, 0xf774, 0xf172},
4043        {0xd350, 0xd556, 0xdf5d, 0xd95a, 0xcb49, 0xcd4e, 0xc744, 0xc142},
4044        {0x43c0, 0x45c6, 0x4fcd, 0x49ca, 0x5bd9, 0x5dde, 0x57d4, 0x51d2},
4045        {0x73f0, 0x75f6, 0x7ffd, 0x79fa, 0x6be9, 0x6dee, 0x67e4, 0x61e2},
4046        {0x23a0, 0x25a6, 0x2fad, 0x29aa, 0x3bb9, 0x3dbe, 0x37b4, 0x31b2},
4047        {0x1390, 0x1596, 0x1f9d, 0x199a, 0x0b89, 0x0d8e, 0x0784, 0x0182}},
4048       {{0x8506'8300, 0x890a'8f0d, 0x9d1e'9b19, 0x9112'9714},
4049        {0xb536'b330, 0xb93a'bf3d, 0xad2e'ab29, 0xa122'a724},
4050        {0xe566'e360, 0xe96a'ef6d, 0xfd7e'fb79, 0xf172'f774},
4051        {0xd556'd350, 0xd95a'df5d, 0xcd4e'cb49, 0xc142'c744},
4052        {0x45c6'43c0, 0x49ca'4fcd, 0x5dde'5bd9, 0x51d2'57d4},
4053        {0x75f6'73f0, 0x79fa'7ffd, 0x6dee'6be9, 0x61e2'67e4},
4054        {0x25a6'23a0, 0x29aa'2fad, 0x3dbe'3bb9, 0x31b2'37b4},
4055        {0x1596'1390, 0x199a'1f9d, 0x0d8e'0b89, 0x0182'0784}},
4056       {{0x890a'8f0d'8506'8300, 0x9112'9714'9d1e'9b19},
4057        {0xb93a'bf3d'b536'b330, 0xa122'a724'ad2e'ab29},
4058        {0xe96a'ef6d'e566'e360, 0xf172'f774'fd7e'fb79},
4059        {0xd95a'df5d'd556'd350, 0xc142'c744'cd4e'cb49},
4060        {0x49ca'4fcd'45c6'43c0, 0x51d2'57d4'5dde'5bd9},
4061        {0x79fa'7ffd'75f6'73f0, 0x61e2'67e4'6dee'6be9},
4062        {0x29aa'2fad'25a6'23a0, 0x31b2'37b4'3dbe'3bb9},
4063        {0x199a'1f9d'1596'1390, 0x0182'0784'0d8e'0b89}},
4064       kVectorCalculationsSourceLegacy);
4065   TestVectorInstruction(
4066       ExecVxorvx,
4067       ExecMaskedVxorvx,
4068       {{170, 43, 168, 41, 174, 47, 172, 45, 162, 35, 160, 33, 166, 39, 164, 37},
4069        {186, 59, 184, 57, 190, 63, 188, 61, 178, 51, 176, 49, 182, 55, 180, 53},
4070        {138, 11, 136, 9, 142, 15, 140, 13, 130, 3, 128, 1, 134, 7, 132, 5},
4071        {154, 27, 152, 25, 158, 31, 156, 29, 146, 19, 144, 17, 150, 23, 148, 21},
4072        {234, 107, 232, 105, 238, 111, 236, 109, 226, 99, 224, 97, 230, 103, 228, 101},
4073        {250, 123, 248, 121, 254, 127, 252, 125, 242, 115, 240, 113, 246, 119, 244, 117},
4074        {202, 75, 200, 73, 206, 79, 204, 77, 194, 67, 192, 65, 198, 71, 196, 69},
4075        {218, 91, 216, 89, 222, 95, 220, 93, 210, 83, 208, 81, 214, 87, 212, 85}},
4076       {{0x2baa, 0x29a8, 0x2fae, 0x2dac, 0x23a2, 0x21a0, 0x27a6, 0x25a4},
4077        {0x3bba, 0x39b8, 0x3fbe, 0x3dbc, 0x33b2, 0x31b0, 0x37b6, 0x35b4},
4078        {0x0b8a, 0x0988, 0x0f8e, 0x0d8c, 0x0382, 0x0180, 0x0786, 0x0584},
4079        {0x1b9a, 0x1998, 0x1f9e, 0x1d9c, 0x1392, 0x1190, 0x1796, 0x1594},
4080        {0x6bea, 0x69e8, 0x6fee, 0x6dec, 0x63e2, 0x61e0, 0x67e6, 0x65e4},
4081        {0x7bfa, 0x79f8, 0x7ffe, 0x7dfc, 0x73f2, 0x71f0, 0x77f6, 0x75f4},
4082        {0x4bca, 0x49c8, 0x4fce, 0x4dcc, 0x43c2, 0x41c0, 0x47c6, 0x45c4},
4083        {0x5bda, 0x59d8, 0x5fde, 0x5ddc, 0x53d2, 0x51d0, 0x57d6, 0x55d4}},
4084       {{0x29a8'2baa, 0x2dac'2fae, 0x21a0'23a2, 0x25a4'27a6},
4085        {0x39b8'3bba, 0x3dbc'3fbe, 0x31b0'33b2, 0x35b4'37b6},
4086        {0x0988'0b8a, 0x0d8c'0f8e, 0x0180'0382, 0x0584'0786},
4087        {0x1998'1b9a, 0x1d9c'1f9e, 0x1190'1392, 0x1594'1796},
4088        {0x69e8'6bea, 0x6dec'6fee, 0x61e0'63e2, 0x65e4'67e6},
4089        {0x79f8'7bfa, 0x7dfc'7ffe, 0x71f0'73f2, 0x75f4'77f6},
4090        {0x49c8'4bca, 0x4dcc'4fce, 0x41c0'43c2, 0x45c4'47c6},
4091        {0x59d8'5bda, 0x5ddc'5fde, 0x51d0'53d2, 0x55d4'57d6}},
4092       {{0x2dac'2fae'29a8'2baa, 0x25a4'27a6'21a0'23a2},
4093        {0x3dbc'3fbe'39b8'3bba, 0x35b4'37b6'31b0'33b2},
4094        {0x0d8c'0f8e'0988'0b8a, 0x0584'0786'0180'0382},
4095        {0x1d9c'1f9e'1998'1b9a, 0x1594'1796'1190'1392},
4096        {0x6dec'6fee'69e8'6bea, 0x65e4'67e6'61e0'63e2},
4097        {0x7dfc'7ffe'79f8'7bfa, 0x75f4'77f6'71f0'73f2},
4098        {0x4dcc'4fce'49c8'4bca, 0x45c4'47c6'41c0'43c2},
4099        {0x5ddc'5fde'59d8'5bda, 0x55d4'57d6'51d0'53d2}},
4100       kVectorCalculationsSourceLegacy);
4101   TestVectorInstruction(
4102       ExecVxorvi,
4103       ExecMaskedVxorvi,
4104       {{245, 116, 247, 118, 241, 112, 243, 114, 253, 124, 255, 126, 249, 120, 251, 122},
4105        {229, 100, 231, 102, 225, 96, 227, 98, 237, 108, 239, 110, 233, 104, 235, 106},
4106        {213, 84, 215, 86, 209, 80, 211, 82, 221, 92, 223, 94, 217, 88, 219, 90},
4107        {197, 68, 199, 70, 193, 64, 195, 66, 205, 76, 207, 78, 201, 72, 203, 74},
4108        {181, 52, 183, 54, 177, 48, 179, 50, 189, 60, 191, 62, 185, 56, 187, 58},
4109        {165, 36, 167, 38, 161, 32, 163, 34, 173, 44, 175, 46, 169, 40, 171, 42},
4110        {149, 20, 151, 22, 145, 16, 147, 18, 157, 28, 159, 30, 153, 24, 155, 26},
4111        {133, 4, 135, 6, 129, 0, 131, 2, 141, 12, 143, 14, 137, 8, 139, 10}},
4112       {{0x7ef5, 0x7cf7, 0x7af1, 0x78f3, 0x76fd, 0x74ff, 0x72f9, 0x70fb},
4113        {0x6ee5, 0x6ce7, 0x6ae1, 0x68e3, 0x66ed, 0x64ef, 0x62e9, 0x60eb},
4114        {0x5ed5, 0x5cd7, 0x5ad1, 0x58d3, 0x56dd, 0x54df, 0x52d9, 0x50db},
4115        {0x4ec5, 0x4cc7, 0x4ac1, 0x48c3, 0x46cd, 0x44cf, 0x42c9, 0x40cb},
4116        {0x3eb5, 0x3cb7, 0x3ab1, 0x38b3, 0x36bd, 0x34bf, 0x32b9, 0x30bb},
4117        {0x2ea5, 0x2ca7, 0x2aa1, 0x28a3, 0x26ad, 0x24af, 0x22a9, 0x20ab},
4118        {0x1e95, 0x1c97, 0x1a91, 0x1893, 0x169d, 0x149f, 0x1299, 0x109b},
4119        {0x0e85, 0x0c87, 0x0a81, 0x0883, 0x068d, 0x048f, 0x0289, 0x008b}},
4120       {{0x7cfd'7ef5, 0x78f9'7af1, 0x74f5'76fd, 0x70f1'72f9},
4121        {0x6ced'6ee5, 0x68e9'6ae1, 0x64e5'66ed, 0x60e1'62e9},
4122        {0x5cdd'5ed5, 0x58d9'5ad1, 0x54d5'56dd, 0x50d1'52d9},
4123        {0x4ccd'4ec5, 0x48c9'4ac1, 0x44c5'46cd, 0x40c1'42c9},
4124        {0x3cbd'3eb5, 0x38b9'3ab1, 0x34b5'36bd, 0x30b1'32b9},
4125        {0x2cad'2ea5, 0x28a9'2aa1, 0x24a5'26ad, 0x20a1'22a9},
4126        {0x1c9d'1e95, 0x1899'1a91, 0x1495'169d, 0x1091'1299},
4127        {0x0c8d'0e85, 0x0889'0a81, 0x0485'068d, 0x0081'0289}},
4128       {{0x78f9'7afb'7cfd'7ef5, 0x70f1'72f3'74f5'76fd},
4129        {0x68e9'6aeb'6ced'6ee5, 0x60e1'62e3'64e5'66ed},
4130        {0x58d9'5adb'5cdd'5ed5, 0x50d1'52d3'54d5'56dd},
4131        {0x48c9'4acb'4ccd'4ec5, 0x40c1'42c3'44c5'46cd},
4132        {0x38b9'3abb'3cbd'3eb5, 0x30b1'32b3'34b5'36bd},
4133        {0x28a9'2aab'2cad'2ea5, 0x20a1'22a3'24a5'26ad},
4134        {0x1899'1a9b'1c9d'1e95, 0x1091'1293'1495'169d},
4135        {0x0889'0a8b'0c8d'0e85, 0x0081'0283'0485'068d}},
4136       kVectorCalculationsSourceLegacy);
4137 }
4138 
ExecVmfeqvv()4139 [[gnu::naked]] void ExecVmfeqvv() {
4140   asm("vmfeq.vv v8, v16, v24\n\t"
4141       "ret\n\t");
4142 }
4143 
ExecMaskedVmfeqvv()4144 [[gnu::naked]] void ExecMaskedVmfeqvv() {
4145   asm("vmfeq.vv v8, v16, v24, v0.t\n\t"
4146       "ret\n\t");
4147 }
ExecVmfeqvf()4148 [[gnu::naked]] void ExecVmfeqvf() {
4149   asm("vmfeq.vf v8, v16, ft0\n\t"
4150       "ret\n\t");
4151 }
4152 
ExecMaskedVmfeqvf()4153 [[gnu::naked]] void ExecMaskedVmfeqvf() {
4154   asm("vmfeq.vf v8, v16, ft0, v0.t\n\t"
4155       "ret\n\t");
4156 }
4157 
TEST(InlineAsmTestRiscv64,TestVmfeq)4158 TEST(InlineAsmTestRiscv64, TestVmfeq) {
4159   TestVectorMaskTargetInstruction(
4160       ExecVmfeqvv, ExecMaskedVmfeqvv, 0x0000'0007, 0x0001, kVectorComparisonSource);
4161   TestVectorMaskTargetInstruction(
4162       ExecVmfeqvf, ExecMaskedVmfeqvf, 0x0000'0040, 0x0020, kVectorComparisonSource);
4163 }
4164 
4165 }  // namespace
4166 
ExecVaadduvv()4167 [[gnu::naked]] void ExecVaadduvv() {
4168   asm("vaaddu.vv  v8, v16, v24\n\t"
4169       "ret\n\t");
4170 }
4171 
ExecMaskedVaadduvv()4172 [[gnu::naked]] void ExecMaskedVaadduvv() {
4173   asm("vaaddu.vv  v8, v16, v24, v0.t\n\t"
4174       "ret\n\t");
4175 }
4176 
ExecVaadduvx()4177 [[gnu::naked]] void ExecVaadduvx() {
4178   asm("vaaddu.vx  v8, v16, t0\n\t"
4179       "ret\n\t");
4180 }
4181 
ExecMaskedVaadduvx()4182 [[gnu::naked]] void ExecMaskedVaadduvx() {
4183   asm("vaaddu.vx  v8, v16, t0, v0.t\n\t"
4184       "ret\n\t");
4185 }
4186 
ExecVaaddvv()4187 [[gnu::naked]] void ExecVaaddvv() {
4188   asm("vaadd.vv  v8, v16, v24\n\t"
4189       "ret\n\t");
4190 }
4191 
ExecMaskedVaaddvv()4192 [[gnu::naked]] void ExecMaskedVaaddvv() {
4193   asm("vaadd.vv  v8, v16, v24, v0.t\n\t"
4194       "ret\n\t");
4195 }
4196 
ExecVaaddvx()4197 [[gnu::naked]] void ExecVaaddvx() {
4198   asm("vaadd.vx  v8, v16, t0\n\t"
4199       "ret\n\t");
4200 }
4201 
ExecMaskedVaaddvx()4202 [[gnu::naked]] void ExecMaskedVaaddvx() {
4203   asm("vaadd.vx  v8, v16, t0, v0.t\n\t"
4204       "ret\n\t");
4205 }
4206 
ExecVasubuvv()4207 [[gnu::naked]] void ExecVasubuvv() {
4208   asm("vasubu.vv  v8, v16, v24\n\t"
4209       "ret\n\t");
4210 }
4211 
ExecMaskedVasubuvv()4212 [[gnu::naked]] void ExecMaskedVasubuvv() {
4213   asm("vasubu.vv  v8, v16, v24, v0.t\n\t"
4214       "ret\n\t");
4215 }
4216 
ExecVasubuvx()4217 [[gnu::naked]] void ExecVasubuvx() {
4218   asm("vasubu.vx  v8, v16, t0\n\t"
4219       "ret\n\t");
4220 }
4221 
ExecMaskedVasubuvx()4222 [[gnu::naked]] void ExecMaskedVasubuvx() {
4223   asm("vasubu.vx  v8, v16, t0, v0.t\n\t"
4224       "ret\n\t");
4225 }
4226 
ExecVasubvv()4227 [[gnu::naked]] void ExecVasubvv() {
4228   asm("vasub.vv  v8, v16, v24\n\t"
4229       "ret\n\t");
4230 }
4231 
ExecMaskedVasubvv()4232 [[gnu::naked]] void ExecMaskedVasubvv() {
4233   asm("vasub.vv  v8, v16, v24, v0.t\n\t"
4234       "ret\n\t");
4235 }
4236 
ExecVasubvx()4237 [[gnu::naked]] void ExecVasubvx() {
4238   asm("vasub.vx  v8, v16, t0\n\t"
4239       "ret\n\t");
4240 }
4241 
ExecMaskedVasubvx()4242 [[gnu::naked]] void ExecMaskedVasubvx() {
4243   asm("vasub.vx  v8, v16, t0, v0.t\n\t"
4244       "ret\n\t");
4245 }
4246 
ExecVnclipuwi()4247 [[gnu::naked]] void ExecVnclipuwi() {
4248   asm("vnclipu.wi  v8, v16, 0xa\n\t"
4249       "ret\n\t");
4250 }
4251 
ExecMaskedVnclipuwi()4252 [[gnu::naked]] void ExecMaskedVnclipuwi() {
4253   asm("vnclipu.wi  v8, v16, 0xa, v0.t\n\t"
4254       "ret\n\t");
4255 }
4256 
ExecVnclipwi()4257 [[gnu::naked]] void ExecVnclipwi() {
4258   asm("vnclip.wi  v8, v16, 0xa\n\t"
4259       "ret\n\t");
4260 }
4261 
ExecMaskedVnclipwi()4262 [[gnu::naked]] void ExecMaskedVnclipwi() {
4263   asm("vnclip.wi  v8, v16, 0xa, v0.t\n\t"
4264       "ret\n\t");
4265 }
4266 
ExecVnclipuwx()4267 [[gnu::naked]] void ExecVnclipuwx() {
4268   asm("vnclipu.wx  v8, v16, t0\n\t"
4269       "ret\n\t");
4270 }
4271 
ExecMaskedVnclipuwx()4272 [[gnu::naked]] void ExecMaskedVnclipuwx() {
4273   asm("vnclipu.wx  v8, v16, t0, v0.t\n\t"
4274       "ret\n\t");
4275 }
4276 
ExecVnclipwx()4277 [[gnu::naked]] void ExecVnclipwx() {
4278   asm("vnclip.wx  v8, v16, t0\n\t"
4279       "ret\n\t");
4280 }
4281 
ExecMaskedVnclipwx()4282 [[gnu::naked]] void ExecMaskedVnclipwx() {
4283   asm("vnclip.wx  v8, v16, t0, v0.t\n\t"
4284       "ret\n\t");
4285 }
4286 
ExecVnclipuwv()4287 [[gnu::naked]] void ExecVnclipuwv() {
4288   asm("vnclipu.wv  v8, v16, v24\n\t"
4289       "ret\n\t");
4290 }
4291 
ExecMaskedVnclipuwv()4292 [[gnu::naked]] void ExecMaskedVnclipuwv() {
4293   asm("vnclipu.wv  v8, v16, v24, v0.t\n\t"
4294       "ret\n\t");
4295 }
4296 
ExecVnclipwv()4297 [[gnu::naked]] void ExecVnclipwv() {
4298   asm("vnclip.wv  v8, v16, v24\n\t"
4299       "ret\n\t");
4300 }
4301 
ExecMaskedVnclipwv()4302 [[gnu::naked]] void ExecMaskedVnclipwv() {
4303   asm("vnclip.wv  v8, v16, v24, v0.t\n\t"
4304       "ret\n\t");
4305 }
4306 
ExecVsmulvv()4307 [[gnu::naked]] void ExecVsmulvv() {
4308   asm("vsmul.vv  v8, v16, v24\n\t"
4309       "ret\n\t");
4310 }
4311 
ExecMaskedVsmulvv()4312 [[gnu::naked]] void ExecMaskedVsmulvv() {
4313   asm("vsmul.vv  v8, v16, v24, v0.t\n\t"
4314       "ret\n\t");
4315 }
4316 
ExecVsmulvx()4317 [[gnu::naked]] void ExecVsmulvx() {
4318   asm("vsmul.vx  v8, v16, t0\n\t"
4319       "ret\n\t");
4320 }
4321 
ExecMaskedVsmulvx()4322 [[gnu::naked]] void ExecMaskedVsmulvx() {
4323   asm("vsmul.vx  v8, v16, t0, v0.t\n\t"
4324       "ret\n\t");
4325 }
4326 
ExecVssrlvv()4327 [[gnu::naked]] void ExecVssrlvv() {
4328   asm("vssrl.vv  v8, v16, v24\n\t"
4329       "ret\n\t");
4330 }
4331 
ExecMaskedVssrlvv()4332 [[gnu::naked]] void ExecMaskedVssrlvv() {
4333   asm("vssrl.vv  v8, v16, v24, v0.t\n\t"
4334       "ret\n\t");
4335 }
4336 
ExecVssrlvx()4337 [[gnu::naked]] void ExecVssrlvx() {
4338   asm("vssrl.vx  v8, v16, t0\n\t"
4339       "ret\n\t");
4340 }
4341 
ExecMaskedVssrlvx()4342 [[gnu::naked]] void ExecMaskedVssrlvx() {
4343   asm("vssrl.vx  v8, v16, t0, v0.t\n\t"
4344       "ret\n\t");
4345 }
4346 
ExecVssrlvi()4347 [[gnu::naked]] void ExecVssrlvi() {
4348   asm("vssrl.vi  v8, v16, 0xa\n\t"
4349       "ret\n\t");
4350 }
4351 
ExecMaskedVssrlvi()4352 [[gnu::naked]] void ExecMaskedVssrlvi() {
4353   asm("vssrl.vi  v8, v16, 0xa, v0.t\n\t"
4354       "ret\n\t");
4355 }
4356 
ExecVssravv()4357 [[gnu::naked]] void ExecVssravv() {
4358   asm("vssra.vv  v8, v16, v24\n\t"
4359       "ret\n\t");
4360 }
4361 
ExecMaskedVssravv()4362 [[gnu::naked]] void ExecMaskedVssravv() {
4363   asm("vssra.vv  v8, v16, v24, v0.t\n\t"
4364       "ret\n\t");
4365 }
4366 
ExecVssravx()4367 [[gnu::naked]] void ExecVssravx() {
4368   asm("vssra.vx  v8, v16, t0\n\t"
4369       "ret\n\t");
4370 }
4371 
ExecMaskedVssravx()4372 [[gnu::naked]] void ExecMaskedVssravx() {
4373   asm("vssra.vx  v8, v16, t0, v0.t\n\t"
4374       "ret\n\t");
4375 }
4376 
ExecVssravi()4377 [[gnu::naked]] void ExecVssravi() {
4378   asm("vssra.vi  v8, v16, 0xa\n\t"
4379       "ret\n\t");
4380 }
4381 
ExecMaskedVssravi()4382 [[gnu::naked]] void ExecMaskedVssravi() {
4383   asm("vssra.vi  v8, v16, 0xa, v0.t\n\t"
4384       "ret\n\t");
4385 }
4386 
TEST(InlineAsmTestRiscv64,TestRDN)4387 TEST(InlineAsmTestRiscv64, TestRDN) {
4388   uint64_t vxrm;
4389   asm volatile(
4390       "csrr %0, vxrm\n\t"
4391       "csrwi vxrm, %c1\n\t"
4392       : "=r"(vxrm)
4393       : "i"(VXRMFlags::RDN));
4394   TestVectorInstruction(
4395       ExecVaadduvv,
4396       ExecMaskedVaadduvv,
4397       {{0, 137, 3, 140, 6, 143, 9, 146, 12, 133, 15, 136, 18, 139, 21, 142},
4398        {24, 161, 27, 164, 30, 167, 33, 170, 36, 157, 39, 160, 42, 163, 45, 166},
4399        {48, 185, 51, 188, 54, 191, 57, 194, 60, 181, 63, 184, 66, 187, 69, 190},
4400        {72, 209, 75, 212, 78, 215, 81, 218, 84, 205, 87, 208, 90, 211, 93, 214},
4401        {96, 105, 99, 108, 102, 111, 105, 114, 108, 101, 111, 104, 114, 107, 117, 110},
4402        {120, 129, 123, 132, 126, 135, 129, 138, 132, 125, 135, 128, 138, 131, 141, 134},
4403        {144, 153, 147, 156, 150, 159, 153, 162, 156, 149, 159, 152, 162, 155, 165, 158},
4404        {168, 177, 171, 180, 174, 183, 177, 186, 180, 173, 183, 176, 186, 179, 189, 182}},
4405       {{0x8980, 0x8c83, 0x8f86, 0x9289, 0x858c, 0x888f, 0x8b92, 0x8e95},
4406        {0xa198, 0xa49b, 0xa79e, 0xaaa1, 0x9da4, 0xa0a7, 0xa3aa, 0xa6ad},
4407        {0xb9b0, 0xbcb3, 0xbfb6, 0xc2b9, 0xb5bc, 0xb8bf, 0xbbc2, 0xbec5},
4408        {0xd1c8, 0xd4cb, 0xd7ce, 0xdad1, 0xcdd4, 0xd0d7, 0xd3da, 0xd6dd},
4409        {0x69e0, 0x6ce3, 0x6fe6, 0x72e9, 0x65ec, 0x68ef, 0x6bf2, 0x6ef5},
4410        {0x81f8, 0x84fb, 0x87fe, 0x8b01, 0x7e04, 0x8107, 0x840a, 0x870d},
4411        {0x9a10, 0x9d13, 0xa016, 0xa319, 0x961c, 0x991f, 0x9c22, 0x9f25},
4412        {0xb228, 0xb52b, 0xb82e, 0xbb31, 0xae34, 0xb137, 0xb43a, 0xb73d}},
4413       {{0x8c83'8980, 0x9289'8f86, 0x888f'858c, 0x8e95'8b92},
4414        {0xa49b'a198, 0xaaa1'a79e, 0xa0a7'9da4, 0xa6ad'a3aa},
4415        {0xbcb3'b9b0, 0xc2b9'bfb6, 0xb8bf'b5bc, 0xbec5'bbc2},
4416        {0xd4cb'd1c8, 0xdad1'd7ce, 0xd0d7'cdd4, 0xd6dd'd3da},
4417        {0x6ce3'69e0, 0x72e9'6fe6, 0x68ef'65ec, 0x6ef5'6bf2},
4418        {0x84fb'81f8, 0x8b01'87fe, 0x8107'7e04, 0x870d'840a},
4419        {0x9d13'9a10, 0xa319'a016, 0x991f'961c, 0x9f25'9c22},
4420        {0xb52b'b228, 0xbb31'b82e, 0xb137'ae34, 0xb73d'b43a}},
4421       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858c},
4422        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da4},
4423        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bc},
4424        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd4},
4425        {0x72e9'6fe6'ece3'69e0, 0x6ef5'6bf2'68ef'65ec},
4426        {0x8b01'87ff'04fb'81f8, 0x870d'840a'8107'7e04},
4427        {0xa319'a017'1d13'9a10, 0x9f25'9c22'991f'961c},
4428        {0xbb31'b82f'352b'b228, 0xb73d'b43a'b137'ae34}},
4429       kVectorCalculationsSource);
4430   TestVectorInstruction(
4431       ExecVaadduvx,
4432       ExecMaskedVaadduvx,
4433       {{85, 149, 86, 150, 87, 151, 88, 152, 89, 153, 90, 154, 91, 155, 92, 156},
4434        {93, 157, 94, 158, 95, 159, 96, 160, 97, 161, 98, 162, 99, 163, 100, 164},
4435        {101, 165, 102, 166, 103, 167, 104, 168, 105, 169, 106, 170, 107, 171, 108, 172},
4436        {109, 173, 110, 174, 111, 175, 112, 176, 113, 177, 114, 178, 115, 179, 116, 180},
4437        {117, 181, 118, 182, 119, 183, 120, 184, 121, 185, 122, 186, 123, 187, 124, 188},
4438        {125, 189, 126, 190, 127, 191, 128, 192, 129, 193, 130, 194, 131, 195, 132, 196},
4439        {133, 197, 134, 198, 135, 199, 136, 200, 137, 201, 138, 202, 139, 203, 140, 204},
4440        {141, 205, 142, 206, 143, 207, 144, 208, 145, 209, 146, 210, 147, 211, 148, 212}},
4441       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
4442        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
4443        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
4444        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
4445        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
4446        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
4447        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
4448        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
4449       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
4450        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
4451        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
4452        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
4453        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
4454        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
4455        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
4456        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
4457       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
4458        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
4459        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
4460        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
4461        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
4462        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
4463        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
4464        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
4465       kVectorCalculationsSource);
4466   TestVectorInstruction(
4467       ExecVaaddvv,
4468       ExecMaskedVaaddvv,
4469       {{0, 137, 3, 140, 6, 143, 9, 146, 12, 133, 15, 136, 18, 139, 21, 142},
4470        {24, 161, 27, 164, 30, 167, 33, 170, 36, 157, 39, 160, 42, 163, 45, 166},
4471        {48, 185, 51, 188, 54, 191, 57, 194, 60, 181, 63, 184, 66, 187, 69, 190},
4472        {72, 209, 75, 212, 78, 215, 81, 218, 84, 205, 87, 208, 90, 211, 93, 214},
4473        {224, 233, 227, 236, 230, 239, 233, 242, 236, 229, 239, 232, 242, 235, 245, 238},
4474        {248, 1, 251, 4, 254, 7, 1, 10, 4, 253, 7, 0, 10, 3, 13, 6},
4475        {16, 25, 19, 28, 22, 31, 25, 34, 28, 21, 31, 24, 34, 27, 37, 30},
4476        {40, 49, 43, 52, 46, 55, 49, 58, 52, 45, 55, 48, 58, 51, 61, 54}},
4477       {{0x8980, 0x8c83, 0x8f86, 0x9289, 0x858c, 0x888f, 0x8b92, 0x8e95},
4478        {0xa198, 0xa49b, 0xa79e, 0xaaa1, 0x9da4, 0xa0a7, 0xa3aa, 0xa6ad},
4479        {0xb9b0, 0xbcb3, 0xbfb6, 0xc2b9, 0xb5bc, 0xb8bf, 0xbbc2, 0xbec5},
4480        {0xd1c8, 0xd4cb, 0xd7ce, 0xdad1, 0xcdd4, 0xd0d7, 0xd3da, 0xd6dd},
4481        {0xe9e0, 0xece3, 0xefe6, 0xf2e9, 0xe5ec, 0xe8ef, 0xebf2, 0xeef5},
4482        {0x01f8, 0x04fb, 0x07fe, 0x0b01, 0xfe04, 0x0107, 0x040a, 0x070d},
4483        {0x1a10, 0x1d13, 0x2016, 0x2319, 0x161c, 0x191f, 0x1c22, 0x1f25},
4484        {0x3228, 0x352b, 0x382e, 0x3b31, 0x2e34, 0x3137, 0x343a, 0x373d}},
4485       {{0x8c83'8980, 0x9289'8f86, 0x888f'858c, 0x8e95'8b92},
4486        {0xa49b'a198, 0xaaa1'a79e, 0xa0a7'9da4, 0xa6ad'a3aa},
4487        {0xbcb3'b9b0, 0xc2b9'bfb6, 0xb8bf'b5bc, 0xbec5'bbc2},
4488        {0xd4cb'd1c8, 0xdad1'd7ce, 0xd0d7'cdd4, 0xd6dd'd3da},
4489        {0xece3'69e0, 0xf2e9'6fe6, 0xe8ef'65ec, 0xeef5'6bf2},
4490        {0x04fb'81f8, 0x0b01'87fe, 0x0107'7e04, 0x070d'840a},
4491        {0x1d13'9a10, 0x2319'a016, 0x191f'961c, 0x1f25'9c22},
4492        {0x352b'b228, 0x3b31'b82e, 0x3137'ae34, 0x373d'b43a}},
4493       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858c},
4494        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da4},
4495        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bc},
4496        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd4},
4497        {0xf2e9'6fe6'ece3'69e0, 0xeef5'6bf2'68ef'65ec},
4498        {0x0b01'87ff'04fb'81f8, 0x070d'840a'8107'7e04},
4499        {0x2319'a017'1d13'9a10, 0x1f25'9c22'991f'961c},
4500        {0x3b31'b82f'352b'b228, 0x373d'b43a'b137'ae34}},
4501       kVectorCalculationsSource);
4502   TestVectorInstruction(
4503       ExecVaaddvx,
4504       ExecMaskedVaaddvx,
4505       {{213, 149, 214, 150, 215, 151, 216, 152, 217, 153, 218, 154, 219, 155, 220, 156},
4506        {221, 157, 222, 158, 223, 159, 224, 160, 225, 161, 226, 162, 227, 163, 228, 164},
4507        {229, 165, 230, 166, 231, 167, 232, 168, 233, 169, 234, 170, 235, 171, 236, 172},
4508        {237, 173, 238, 174, 239, 175, 240, 176, 241, 177, 242, 178, 243, 179, 244, 180},
4509        {245, 181, 246, 182, 247, 183, 248, 184, 249, 185, 250, 186, 251, 187, 252, 188},
4510        {253, 189, 254, 190, 255, 191, 0, 192, 1, 193, 2, 194, 3, 195, 4, 196},
4511        {5, 197, 6, 198, 7, 199, 8, 200, 9, 201, 10, 202, 11, 203, 12, 204},
4512        {13, 205, 14, 206, 15, 207, 16, 208, 17, 209, 18, 210, 19, 211, 20, 212}},
4513       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
4514        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
4515        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
4516        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
4517        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
4518        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
4519        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
4520        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
4521       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
4522        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
4523        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
4524        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
4525        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
4526        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
4527        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
4528        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
4529       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
4530        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
4531        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
4532        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
4533        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
4534        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
4535        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
4536        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
4537       kVectorCalculationsSource);
4538   TestVectorInstruction(
4539       ExecVasubuvv,
4540       ExecMaskedVasubuvv,
4541       {{0, 247, 255, 246, 253, 245, 253, 244, 251, 3, 251, 2, 250, 1, 249, 0},
4542        {248, 239, 247, 238, 245, 237, 245, 236, 243, 251, 243, 250, 242, 249, 241, 248},
4543        {240, 231, 239, 230, 237, 229, 237, 228, 235, 243, 235, 242, 234, 241, 233, 240},
4544        {232, 223, 231, 222, 229, 221, 229, 220, 227, 235, 227, 234, 226, 233, 225, 232},
4545        {224, 87, 223, 86, 221, 85, 221, 84, 219, 99, 219, 98, 218, 97, 217, 96},
4546        {216, 79, 215, 78, 213, 77, 213, 76, 211, 91, 211, 90, 210, 89, 209, 88},
4547        {208, 71, 207, 70, 205, 69, 205, 68, 203, 83, 203, 82, 202, 81, 201, 80},
4548        {200, 63, 199, 62, 197, 61, 197, 60, 195, 75, 195, 74, 194, 73, 193, 72}},
4549       {{0xf780, 0xf67f, 0xf57d, 0xf47d, 0x037b, 0x027b, 0x017a, 0x0079},
4550        {0xef78, 0xee77, 0xed75, 0xec75, 0xfb73, 0xfa73, 0xf972, 0xf871},
4551        {0xe770, 0xe66f, 0xe56d, 0xe46d, 0xf36b, 0xf26b, 0xf16a, 0xf069},
4552        {0xdf68, 0xde67, 0xdd65, 0xdc65, 0xeb63, 0xea63, 0xe962, 0xe861},
4553        {0x5760, 0x565f, 0x555d, 0x545d, 0x635b, 0x625b, 0x615a, 0x6059},
4554        {0x4f58, 0x4e57, 0x4d55, 0x4c55, 0x5b53, 0x5a53, 0x5952, 0x5851},
4555        {0x4750, 0x464f, 0x454d, 0x444d, 0x534b, 0x524b, 0x514a, 0x5049},
4556        {0x3f48, 0x3e47, 0x3d45, 0x3c45, 0x4b43, 0x4a43, 0x4942, 0x4841}},
4557       {{0xf67e'f780, 0xf47c'f57d, 0x027b'037b, 0x0079'017a},
4558        {0xee76'ef78, 0xec74'ed75, 0xfa72'fb73, 0xf870'f972},
4559        {0xe66e'e770, 0xe46c'e56d, 0xf26a'f36b, 0xf068'f16a},
4560        {0xde66'df68, 0xdc64'dd65, 0xea62'eb63, 0xe860'e962},
4561        {0x565f'5760, 0x545d'555d, 0x625b'635b, 0x6059'615a},
4562        {0x4e57'4f58, 0x4c55'4d55, 0x5a53'5b53, 0x5851'5952},
4563        {0x464f'4750, 0x444d'454d, 0x524b'534b, 0x5049'514a},
4564        {0x3e47'3f48, 0x3c45'3d45, 0x4a43'4b43, 0x4841'4942}},
4565       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037b},
4566        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb73},
4567        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36b},
4568        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb63},
4569        {0x545d'555d'd65f'5760, 0x6059'615a'625b'635b},
4570        {0x4c55'4d55'ce57'4f58, 0x5851'5952'5a53'5b53},
4571        {0x444d'454d'c64f'4750, 0x5049'514a'524b'534b},
4572        {0x3c45'3d45'be47'3f48, 0x4841'4942'4a43'4b43}},
4573       kVectorCalculationsSource);
4574   TestVectorInstruction(
4575       ExecVasubuvx,
4576       ExecMaskedVasubuvx,
4577       {{171, 235, 172, 236, 173, 237, 174, 238, 175, 239, 176, 240, 177, 241, 178, 242},
4578        {179, 243, 180, 244, 181, 245, 182, 246, 183, 247, 184, 248, 185, 249, 186, 250},
4579        {187, 251, 188, 252, 189, 253, 190, 254, 191, 255, 192, 0, 193, 1, 194, 2},
4580        {195, 3, 196, 4, 197, 5, 198, 6, 199, 7, 200, 8, 201, 9, 202, 10},
4581        {203, 11, 204, 12, 205, 13, 206, 14, 207, 15, 208, 16, 209, 17, 210, 18},
4582        {211, 19, 212, 20, 213, 21, 214, 22, 215, 23, 216, 24, 217, 25, 218, 26},
4583        {219, 27, 220, 28, 221, 29, 222, 30, 223, 31, 224, 32, 225, 33, 226, 34},
4584        {227, 35, 228, 36, 229, 37, 230, 38, 231, 39, 232, 40, 233, 41, 234, 42}},
4585       {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
4586        {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
4587        {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
4588        {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
4589        {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
4590        {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
4591        {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
4592        {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
4593       {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
4594        {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
4595        {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
4596        {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
4597        {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
4598        {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
4599        {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
4600        {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
4601       {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
4602        {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
4603        {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
4604        {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
4605        {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
4606        {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
4607        {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
4608        {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
4609       kVectorCalculationsSource);
4610   TestVectorInstruction(
4611       ExecVasubvv,
4612       ExecMaskedVasubvv,
4613       {{0, 247, 255, 246, 253, 245, 253, 244, 251, 3, 251, 2, 250, 1, 249, 0},
4614        {248, 239, 247, 238, 245, 237, 245, 236, 243, 251, 243, 250, 242, 249, 241, 248},
4615        {240, 231, 239, 230, 237, 229, 237, 228, 235, 243, 235, 242, 234, 241, 233, 240},
4616        {232, 223, 231, 222, 229, 221, 229, 220, 227, 235, 227, 234, 226, 233, 225, 232},
4617        {96, 215, 95, 214, 93, 213, 93, 212, 91, 227, 91, 226, 90, 225, 89, 224},
4618        {88, 207, 87, 206, 85, 205, 85, 204, 83, 219, 83, 218, 82, 217, 81, 216},
4619        {80, 199, 79, 198, 77, 197, 77, 196, 75, 211, 75, 210, 74, 209, 73, 208},
4620        {72, 191, 71, 190, 69, 189, 69, 188, 67, 203, 67, 202, 66, 201, 65, 200}},
4621       {{0xf780, 0xf67f, 0xf57d, 0xf47d, 0x037b, 0x027b, 0x017a, 0x0079},
4622        {0xef78, 0xee77, 0xed75, 0xec75, 0xfb73, 0xfa73, 0xf972, 0xf871},
4623        {0xe770, 0xe66f, 0xe56d, 0xe46d, 0xf36b, 0xf26b, 0xf16a, 0xf069},
4624        {0xdf68, 0xde67, 0xdd65, 0xdc65, 0xeb63, 0xea63, 0xe962, 0xe861},
4625        {0xd760, 0xd65f, 0xd55d, 0xd45d, 0xe35b, 0xe25b, 0xe15a, 0xe059},
4626        {0xcf58, 0xce57, 0xcd55, 0xcc55, 0xdb53, 0xda53, 0xd952, 0xd851},
4627        {0xc750, 0xc64f, 0xc54d, 0xc44d, 0xd34b, 0xd24b, 0xd14a, 0xd049},
4628        {0xbf48, 0xbe47, 0xbd45, 0xbc45, 0xcb43, 0xca43, 0xc942, 0xc841}},
4629       {{0xf67e'f780, 0xf47c'f57d, 0x027b'037b, 0x0079'017a},
4630        {0xee76'ef78, 0xec74'ed75, 0xfa72'fb73, 0xf870'f972},
4631        {0xe66e'e770, 0xe46c'e56d, 0xf26a'f36b, 0xf068'f16a},
4632        {0xde66'df68, 0xdc64'dd65, 0xea62'eb63, 0xe860'e962},
4633        {0xd65f'5760, 0xd45d'555d, 0xe25b'635b, 0xe059'615a},
4634        {0xce57'4f58, 0xcc55'4d55, 0xda53'5b53, 0xd851'5952},
4635        {0xc64f'4750, 0xc44d'454d, 0xd24b'534b, 0xd049'514a},
4636        {0xbe47'3f48, 0xbc45'3d45, 0xca43'4b43, 0xc841'4942}},
4637       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037b},
4638        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb73},
4639        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36b},
4640        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb63},
4641        {0xd45d'555d'd65f'5760, 0xe059'615a'625b'635b},
4642        {0xcc55'4d55'ce57'4f58, 0xd851'5952'5a53'5b53},
4643        {0xc44d'454d'c64f'4750, 0xd049'514a'524b'534b},
4644        {0xbc45'3d45'be47'3f48, 0xc841'4942'4a43'4b43}},
4645       kVectorCalculationsSource);
4646   TestVectorInstruction(ExecVasubvx,
4647                         ExecMaskedVasubvx,
4648                         {{43, 235, 44, 236, 45, 237, 46, 238, 47, 239, 48, 240, 49, 241, 50, 242},
4649                          {51, 243, 52, 244, 53, 245, 54, 246, 55, 247, 56, 248, 57, 249, 58, 250},
4650                          {59, 251, 60, 252, 61, 253, 62, 254, 63, 255, 64, 0, 65, 1, 66, 2},
4651                          {67, 3, 68, 4, 69, 5, 70, 6, 71, 7, 72, 8, 73, 9, 74, 10},
4652                          {75, 11, 76, 12, 77, 13, 78, 14, 79, 15, 80, 16, 81, 17, 82, 18},
4653                          {83, 19, 84, 20, 85, 21, 86, 22, 87, 23, 88, 24, 89, 25, 90, 26},
4654                          {91, 27, 92, 28, 93, 29, 94, 30, 95, 31, 96, 32, 97, 33, 98, 34},
4655                          {99, 35, 100, 36, 101, 37, 102, 38, 103, 39, 104, 40, 105, 41, 106, 42}},
4656                         {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
4657                          {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
4658                          {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
4659                          {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
4660                          {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
4661                          {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
4662                          {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
4663                          {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
4664                         {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
4665                          {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
4666                          {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
4667                          {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
4668                          {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
4669                          {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
4670                          {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
4671                          {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
4672                         {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
4673                          {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
4674                          {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
4675                          {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
4676                          {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
4677                          {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
4678                          {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
4679                          {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
4680                         kVectorCalculationsSource);
4681   TestNarrowingVectorInstruction(ExecVnclipuwi,
4682                                  ExecMaskedVnclipuwi,
4683                                  {{32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39},
4684                                   {40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47},
4685                                   {48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55},
4686                                   {56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63}},
4687                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
4688                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
4689                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
4690                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
4691                                  {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
4692                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
4693                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
4694                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
4695                                  kVectorCalculationsSource);
4696   TestNarrowingVectorInstruction(
4697       ExecVnclipwi,
4698       ExecMaskedVnclipwi,
4699       {{224, 224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231},
4700        {232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239},
4701        {240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247},
4702        {248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255}},
4703       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
4704        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
4705        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
4706        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
4707       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
4708        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
4709        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
4710        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000}},
4711       kVectorCalculationsSource);
4712 
4713   TestNarrowingVectorInstruction(ExecVnclipuwx,
4714                                  ExecMaskedVnclipuwx,
4715                                  {{32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39},
4716                                   {40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47},
4717                                   {48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55},
4718                                   {56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63}},
4719                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
4720                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
4721                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
4722                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
4723                                  {{0x0021'c1a1, 0x0023'c3a3, 0x0025'c5a5, 0x0027'c7a7},
4724                                   {0x0029'c9a9, 0x002b'cbab, 0x002d'cdad, 0x002f'cfaf},
4725                                   {0x0031'd1b1, 0x0033'd3b3, 0x0035'd5b5, 0x0037'd7b7},
4726                                   {0x0039'd9b9, 0x003b'dbbb, 0x003d'ddbd, 0x003f'dfbf}},
4727                                  kVectorCalculationsSource);
4728 
4729   TestNarrowingVectorInstruction(
4730       ExecVnclipwx,
4731       ExecMaskedVnclipwx,
4732       {{224, 224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231},
4733        {232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239},
4734        {240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247},
4735        {248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255}},
4736       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
4737        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
4738        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
4739        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
4740       {{0xffe1'c1a1, 0xffe3'c3a3, 0xffe5'c5a5, 0xffe7'c7a7},
4741        {0xffe9'c9a9, 0xffeb'cbab, 0xffed'cdad, 0xffef'cfaf},
4742        {0xfff1'd1b1, 0xfff3'd3b3, 0xfff5'd5b5, 0xfff7'd7b7},
4743        {0xfff9'd9b9, 0xfffb'dbbb, 0xfffd'ddbd, 0xffff'dfbf}},
4744       kVectorCalculationsSource);
4745 
4746   TestNarrowingVectorInstruction(
4747       ExecVnclipuwv,
4748       ExecMaskedVnclipuwv,
4749       {{255, 255, 255, 255, 68, 34, 8, 2, 255, 255, 255, 255, 153, 38, 9, 2},
4750        {255, 255, 255, 255, 84, 42, 10, 2, 255, 255, 255, 255, 185, 46, 11, 2},
4751        {255, 255, 255, 255, 100, 50, 12, 3, 255, 255, 255, 255, 217, 54, 13, 3},
4752        {255, 255, 255, 255, 116, 58, 14, 3, 255, 255, 255, 255, 249, 62, 15, 3}},
4753       {{0xffff, 0xffff, 0xffff, 0xffff, 0x4989, 0x0971, 0x009b, 0x0009},
4754        {0xffff, 0xffff, 0xffff, 0xffff, 0x5999, 0x0b73, 0x00bb, 0x000b},
4755        {0xffff, 0xffff, 0xffff, 0xffff, 0x69a9, 0x0d75, 0x00db, 0x000d},
4756        {0xffff, 0xffff, 0xffff, 0xffff, 0x79b9, 0x0f77, 0x00fb, 0x000f}},
4757       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
4758        {0xa726'a524, 0x0057'9756, 0x0000'5b9b, 0x0000'00bf},
4759        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
4760        {0xe766'e564, 0x0077'b776, 0x0000'7bbb, 0x0000'00ff}},
4761       kVectorCalculationsSource);
4762 
4763   TestNarrowingVectorInstruction(
4764       ExecVnclipwv,
4765       ExecMaskedVnclipwv,
4766       {{128, 128, 128, 128, 196, 226, 248, 254, 128, 128, 128, 128, 153, 230, 249, 254},
4767        {128, 128, 128, 128, 212, 234, 250, 254, 128, 128, 128, 128, 185, 238, 251, 254},
4768        {128, 128, 128, 128, 228, 242, 252, 255, 128, 128, 128, 128, 217, 246, 253, 255},
4769        {128, 128, 128, 157, 244, 250, 254, 255, 128, 128, 128, 221, 249, 254, 255, 255}},
4770       {{0x8000, 0x8000, 0x8000, 0x8000, 0xc989, 0xf971, 0xff9b, 0xfff9},
4771        {0x8000, 0x8000, 0x8000, 0x8000, 0xd999, 0xfb73, 0xffbb, 0xfffb},
4772        {0x8000, 0x8000, 0x8000, 0x8000, 0xe9a9, 0xfd75, 0xffdb, 0xfffd},
4773        {0x8000, 0x8000, 0x8000, 0x8000, 0xf9b9, 0xff77, 0xfffb, 0xffff}},
4774       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
4775        {0xa726'a524, 0xffd7'9756, 0xffff'db9b, 0xffff'ffbf},
4776        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
4777        {0xe766'e564, 0xfff7'b776, 0xffff'fbbb, 0xffff'ffff}},
4778       kVectorCalculationsSource);
4779 
4780   TestVectorInstruction(
4781       ExecVsmulvv,
4782       ExecMaskedVsmulvv,
4783       {{0, 109, 0, 103, 0, 98, 0, 92, 1, 117, 1, 111, 2, 106, 3, 100},
4784        {4, 67, 5, 63, 6, 58, 7, 54, 9, 75, 10, 71, 12, 66, 14, 62},
4785        {16, 34, 18, 30, 20, 27, 22, 23, 25, 42, 27, 38, 30, 35, 33, 31},
4786        {36, 8, 39, 6, 42, 3, 45, 1, 49, 16, 52, 14, 56, 11, 60, 9},
4787        {192, 247, 192, 245, 192, 244, 192, 242, 193, 255, 193, 253, 194, 252, 195, 250},
4788        {196, 237, 197, 237, 198, 236, 199, 236, 201, 245, 202, 245, 204, 244, 206, 244},
4789        {208, 236, 210, 236, 213, 237, 214, 237, 217, 244, 219, 244, 222, 245, 225, 245},
4790        {228, 242, 231, 244, 235, 245, 237, 247, 241, 250, 244, 252, 248, 253, 252, 255}},
4791       {{0x6d24, 0x677e, 0x61f8, 0x5c94, 0x750c, 0x6f68, 0x69e3, 0x647e},
4792        {0x437e, 0x3eda, 0x3a56, 0x35f4, 0x4b6a, 0x46c8, 0x4245, 0x3de3},
4793        {0x21e9, 0x1e47, 0x1ac5, 0x1765, 0x29d9, 0x2639, 0x22b8, 0x1f57},
4794        {0x0863, 0x05c4, 0x0344, 0x00e5, 0x1058, 0x0db9, 0x0b3b, 0x08dc},
4795        {0xf6ee, 0xf550, 0xf3d2, 0xf276, 0xfee7, 0xfd4a, 0xfbcd, 0xfa71},
4796        {0xed88, 0xeced, 0xec71, 0xec17, 0xf585, 0xf4eb, 0xf470, 0xf415},
4797        {0xec33, 0xec9a, 0xed20, 0xedc7, 0xf434, 0xf49b, 0xf523, 0xf5ca},
4798        {0xf2ee, 0xf456, 0xf5df, 0xf788, 0xfaf3, 0xfc5c, 0xfde5, 0xff8f}},
4799       {{0x677d'76ae, 0x5c93'1930, 0x6f67'3830, 0x647d'dbb6},
4800        {0x3eda'09c6, 0x35f3'b250, 0x46c7'cf50, 0x3de2'78dd},
4801        {0x1e46'b4fd, 0x1764'638f, 0x2638'7e8f, 0x1f57'2e25},
4802        {0x05c3'7854, 0x00e5'2cef, 0x0db9'45ef, 0x08db'fb8c},
4803        {0xf550'cd46, 0xf276'7fe1, 0xfd4a'8ed9, 0xfa71'4276},
4804        {0xeced'a0be, 0xec17'5961, 0xf4eb'6659, 0xf416'1ffe},
4805        {0xec9a'8c56, 0xedc8'4b00, 0xf49c'55f8, 0xf5cb'15a6},
4806        {0xf457'900d, 0xf789'54c0, 0xfc5d'5db8, 0xff90'236d}},
4807       {{0x5c93'192f'ccd4'7781, 0x647d'dbb5'bb66'23af},
4808        {0x35f3'b24f'43d0'aa38, 0x3de2'78dd'1a4e'4256},
4809        {0x1764'638e'e2fd'152f, 0x1f57'2e24'a166'993d},
4810        {0x00e5'2cee'aa59'b866, 0x08db'fb8c'50af'2864},
4811        {0xf276'7fe1'80cf'f441, 0xfa71'4276'eef1'1fff},
4812        {0xec17'5961'584c'a798, 0xf416'1ffe'ae59'bf46},
4813        {0xedc8'4b01'57f9'9330, 0xf5cb'15a6'95f2'96ce},
4814        {0xf789'54c1'7fd6'b708, 0xff90'236e'a5bb'a696}},
4815       kVectorCalculationsSource);
4816   TestVectorInstruction(ExecVsmulvx,
4817                         ExecMaskedVsmulvx,
4818                         {{0, 85, 254, 83, 253, 82, 251, 81, 250, 79, 249, 78, 247, 77, 246, 75},
4819                          {245, 74, 243, 73, 242, 71, 241, 70, 239, 69, 238, 67, 237, 66, 235, 65},
4820                          {234, 63, 233, 62, 231, 61, 230, 59, 229, 58, 227, 57, 226, 55, 225, 54},
4821                          {223, 53, 222, 51, 221, 50, 219, 49, 218, 47, 217, 46, 215, 45, 214, 43},
4822                          {213, 42, 211, 40, 210, 39, 208, 38, 207, 36, 206, 35, 204, 34, 203, 32},
4823                          {202, 31, 200, 30, 199, 28, 198, 27, 196, 26, 195, 24, 194, 23, 192, 22},
4824                          {191, 20, 190, 19, 188, 18, 187, 16, 186, 15, 184, 14, 183, 12, 182, 11},
4825                          {180, 10, 179, 8, 178, 7, 176, 6, 175, 4, 174, 3, 172, 2, 171, 0}},
4826                         {{0x54ab, 0x5354, 0x51fd, 0x50a7, 0x4f50, 0x4df9, 0x4ca3, 0x4b4c},
4827                          {0x49f5, 0x489f, 0x4748, 0x45f1, 0x449b, 0x4344, 0x41ed, 0x4097},
4828                          {0x3f40, 0x3de9, 0x3c93, 0x3b3c, 0x39e5, 0x388f, 0x3738, 0x35e1},
4829                          {0x348b, 0x3334, 0x31dd, 0x3087, 0x2f30, 0x2dd9, 0x2c83, 0x2b2c},
4830                          {0x29d5, 0x287e, 0x2728, 0x25d1, 0x247a, 0x2324, 0x21cd, 0x2076},
4831                          {0x1f20, 0x1dc9, 0x1c72, 0x1b1c, 0x19c5, 0x186e, 0x1718, 0x15c1},
4832                          {0x146a, 0x1314, 0x11bd, 0x1066, 0x0f10, 0x0db9, 0x0c62, 0x0b0c},
4833                          {0x09b5, 0x085e, 0x0708, 0x05b1, 0x045a, 0x0304, 0x01ad, 0x0056}},
4834                         {{0x5353'aa00, 0x50a6'51fd, 0x4df8'f9fb, 0x4b4b'a1f8},
4835                          {0x489e'49f5, 0x45f0'f1f3, 0x4343'99f0, 0x4096'41ed},
4836                          {0x3de8'e9eb, 0x3b3b'91e8, 0x388e'39e5, 0x35e0'e1e3},
4837                          {0x3333'89e0, 0x3086'31dd, 0x2dd8'd9db, 0x2b2b'81d8},
4838                          {0x287e'29d5, 0x25d0'd1d2, 0x2323'79d0, 0x2076'21cd},
4839                          {0x1dc8'c9ca, 0x1b1b'71c8, 0x186e'19c5, 0x15c0'c1c2},
4840                          {0x1313'69c0, 0x1066'11bd, 0x0db8'b9ba, 0x0b0b'61b8},
4841                          {0x085e'09b5, 0x05b0'b1b2, 0x0303'59b0, 0x0056'01ad}},
4842                         {{0x50a6'51fc'fdfe'54ab, 0x4b4b'a1f7'a34e'4f50},
4843                          {0x45f0'f1f2'489e'49f5, 0x4096'41ec'edee'449b},
4844                          {0x3b3b'91e7'933e'3f40, 0x35e0'e1e2'388e'39e5},
4845                          {0x3086'31dc'ddde'348b, 0x2b2b'81d7'832e'2f30},
4846                          {0x25d0'd1d2'287e'29d5, 0x2076'21cc'cdce'247a},
4847                          {0x1b1b'71c7'731e'1f20, 0x15c0'c1c2'186e'19c5},
4848                          {0x1066'11bc'bdbe'146a, 0x0b0b'61b7'630e'0f10},
4849                          {0x05b0'b1b2'085e'09b5, 0x0056'01ac'adae'045a}},
4850                         kVectorCalculationsSource);
4851 
4852   TestVectorInstruction(ExecVssrlvv,
4853                         ExecMaskedVssrlvv,
4854                         {{0, 32, 0, 2, 2, 33, 0, 2, 4, 34, 0, 2, 12, 35, 0, 2},
4855                          {16, 36, 1, 2, 10, 37, 1, 2, 12, 38, 1, 2, 28, 39, 1, 2},
4856                          {32, 40, 2, 2, 18, 41, 2, 2, 20, 42, 2, 2, 44, 43, 2, 2},
4857                          {48, 44, 3, 2, 26, 45, 3, 2, 28, 46, 3, 2, 60, 47, 3, 2},
4858                          {64, 48, 4, 3, 34, 49, 4, 3, 36, 50, 4, 3, 76, 51, 4, 3},
4859                          {80, 52, 5, 3, 42, 53, 5, 3, 44, 54, 5, 3, 92, 55, 5, 3},
4860                          {96, 56, 6, 3, 50, 57, 6, 3, 52, 58, 6, 3, 108, 59, 6, 3},
4861                          {112, 60, 7, 3, 58, 61, 7, 3, 60, 62, 7, 3, 124, 63, 7, 3}},
4862                         {{0x8100, 0x0830, 0x0042, 0x0008, 0x4484, 0x08b0, 0x008d, 0x0008},
4863                          {0x9110, 0x0931, 0x004a, 0x0009, 0x4c8c, 0x09b1, 0x009d, 0x0009},
4864                          {0xa120, 0x0a32, 0x0052, 0x000a, 0x5494, 0x0ab2, 0x00ad, 0x000a},
4865                          {0xb130, 0x0b33, 0x005a, 0x000b, 0x5c9c, 0x0bb3, 0x00bd, 0x000b},
4866                          {0xc140, 0x0c34, 0x0062, 0x000c, 0x64a4, 0x0cb4, 0x00cd, 0x000c},
4867                          {0xd150, 0x0d35, 0x006a, 0x000d, 0x6cac, 0x0db5, 0x00dd, 0x000d},
4868                          {0xe160, 0x0e36, 0x0072, 0x000e, 0x74b4, 0x0eb6, 0x00ed, 0x000e},
4869                          {0xf170, 0x0f37, 0x007a, 0x000f, 0x7cbc, 0x0fb7, 0x00fd, 0x000f}},
4870                         {{0x8302'8100, 0x0043'8342, 0x0000'4585, 0x0000'008f},
4871                          {0x9312'9110, 0x004b'8b4a, 0x0000'4d8d, 0x0000'009f},
4872                          {0xa322'a120, 0x0053'9352, 0x0000'5595, 0x0000'00af},
4873                          {0xb332'b130, 0x005b'9b5a, 0x0000'5d9d, 0x0000'00bf},
4874                          {0xc342'c140, 0x0063'a362, 0x0000'65a5, 0x0000'00cf},
4875                          {0xd352'd150, 0x006b'ab6a, 0x0000'6dad, 0x0000'00df},
4876                          {0xe362'e160, 0x0073'b372, 0x0000'75b5, 0x0000'00ef},
4877                          {0xf372'f170, 0x007b'bb7a, 0x0000'7dbd, 0x0000'00ff}},
4878                         {{0x8706'8504'8302'8100, 0x0000'4787'4686'4585},
4879                          {0x0000'0000'9716'9514, 0x0000'0000'0000'4f8f},
4880                          {0xa726'a524'a322'a120, 0x0000'5797'5696'5595},
4881                          {0x0000'0000'b736'b534, 0x0000'0000'0000'5f9f},
4882                          {0xc746'c544'c342'c140, 0x0000'67a7'66a6'65a5},
4883                          {0x0000'0000'd756'd554, 0x0000'0000'0000'6faf},
4884                          {0xe766'e564'e362'e160, 0x0000'77b7'76b6'75b5},
4885                          {0x0000'0000'f776'f574, 0x0000'0000'0000'7fbf}},
4886                         kVectorCalculationsSource);
4887 
4888   TestVectorInstruction(ExecVssrlvx,
4889                         ExecMaskedVssrlvx,
4890                         {{0, 32, 0, 32, 1, 33, 1, 33, 2, 34, 2, 34, 3, 35, 3, 35},
4891                          {4, 36, 4, 36, 5, 37, 5, 37, 6, 38, 6, 38, 7, 39, 7, 39},
4892                          {8, 40, 8, 40, 9, 41, 9, 41, 10, 42, 10, 42, 11, 43, 11, 43},
4893                          {12, 44, 12, 44, 13, 45, 13, 45, 14, 46, 14, 46, 15, 47, 15, 47},
4894                          {16, 48, 16, 48, 17, 49, 17, 49, 18, 50, 18, 50, 19, 51, 19, 51},
4895                          {20, 52, 20, 52, 21, 53, 21, 53, 22, 54, 22, 54, 23, 55, 23, 55},
4896                          {24, 56, 24, 56, 25, 57, 25, 57, 26, 58, 26, 58, 27, 59, 27, 59},
4897                          {28, 60, 28, 60, 29, 61, 29, 61, 30, 62, 30, 62, 31, 63, 31, 63}},
4898                         {{0x0020, 0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023},
4899                          {0x0024, 0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027},
4900                          {0x0028, 0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b},
4901                          {0x002c, 0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f},
4902                          {0x0030, 0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033},
4903                          {0x0034, 0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037},
4904                          {0x0038, 0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b},
4905                          {0x003c, 0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f}},
4906                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
4907                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
4908                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
4909                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
4910                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
4911                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
4912                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
4913                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
4914                         {{0x0000'0000'0021'c1a1, 0x0000'0000'0023'c3a3},
4915                          {0x0000'0000'0025'c5a5, 0x0000'0000'0027'c7a7},
4916                          {0x0000'0000'0029'c9a9, 0x0000'0000'002b'cbab},
4917                          {0x0000'0000'002d'cdad, 0x0000'0000'002f'cfaf},
4918                          {0x0000'0000'0031'd1b1, 0x0000'0000'0033'd3b3},
4919                          {0x0000'0000'0035'd5b5, 0x0000'0000'0037'd7b7},
4920                          {0x0000'0000'0039'd9b9, 0x0000'0000'003b'dbbb},
4921                          {0x0000'0000'003d'ddbd, 0x0000'0000'003f'dfbf}},
4922                         kVectorCalculationsSource);
4923 
4924   TestVectorInstruction(ExecVssrlvi,
4925                         ExecMaskedVssrlvi,
4926                         {{0, 32, 0, 32, 1, 33, 1, 33, 2, 34, 2, 34, 3, 35, 3, 35},
4927                          {4, 36, 4, 36, 5, 37, 5, 37, 6, 38, 6, 38, 7, 39, 7, 39},
4928                          {8, 40, 8, 40, 9, 41, 9, 41, 10, 42, 10, 42, 11, 43, 11, 43},
4929                          {12, 44, 12, 44, 13, 45, 13, 45, 14, 46, 14, 46, 15, 47, 15, 47},
4930                          {16, 48, 16, 48, 17, 49, 17, 49, 18, 50, 18, 50, 19, 51, 19, 51},
4931                          {20, 52, 20, 52, 21, 53, 21, 53, 22, 54, 22, 54, 23, 55, 23, 55},
4932                          {24, 56, 24, 56, 25, 57, 25, 57, 26, 58, 26, 58, 27, 59, 27, 59},
4933                          {28, 60, 28, 60, 29, 61, 29, 61, 30, 62, 30, 62, 31, 63, 31, 63}},
4934                         {{0x0020, 0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023},
4935                          {0x0024, 0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027},
4936                          {0x0028, 0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b},
4937                          {0x002c, 0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f},
4938                          {0x0030, 0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033},
4939                          {0x0034, 0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037},
4940                          {0x0038, 0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b},
4941                          {0x003c, 0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f}},
4942                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
4943                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
4944                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
4945                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
4946                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
4947                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
4948                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
4949                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
4950                         {{0x0021'c1a1'4120'c0a0, 0x0023'c3a3'4322'c2a2},
4951                          {0x0025'c5a5'4524'c4a4, 0x0027'c7a7'4726'c6a6},
4952                          {0x0029'c9a9'4928'c8a8, 0x002b'cbab'4b2a'caaa},
4953                          {0x002d'cdad'4d2c'ccac, 0x002f'cfaf'4f2e'ceae},
4954                          {0x0031'd1b1'5130'd0b0, 0x0033'd3b3'5332'd2b2},
4955                          {0x0035'd5b5'5534'd4b4, 0x0037'd7b7'5736'd6b6},
4956                          {0x0039'd9b9'5938'd8b8, 0x003b'dbbb'5b3a'daba},
4957                          {0x003d'ddbd'5d3c'dcbc, 0x003f'dfbf'5f3e'debe}},
4958                         kVectorCalculationsSource);
4959   TestVectorInstruction(ExecVssravv,
4960                         ExecMaskedVssravv,
4961                         {{0, 224, 0, 254, 2, 225, 0, 254, 4, 226, 0, 254, 12, 227, 0, 254},
4962                          {16, 228, 1, 254, 10, 229, 1, 254, 12, 230, 1, 254, 28, 231, 1, 254},
4963                          {32, 232, 2, 254, 18, 233, 2, 254, 20, 234, 2, 254, 44, 235, 2, 254},
4964                          {48, 236, 3, 254, 26, 237, 3, 254, 28, 238, 3, 254, 60, 239, 3, 254},
4965                          {64, 240, 4, 255, 34, 241, 4, 255, 36, 242, 4, 255, 76, 243, 4, 255},
4966                          {80, 244, 5, 255, 42, 245, 5, 255, 44, 246, 5, 255, 92, 247, 5, 255},
4967                          {96, 248, 6, 255, 50, 249, 6, 255, 52, 250, 6, 255, 108, 251, 6, 255},
4968                          {112, 252, 7, 255, 58, 253, 7, 255, 60, 254, 7, 255, 124, 255, 7, 255}},
4969                         {{0x8100, 0xf830, 0xffc2, 0xfff8, 0xc484, 0xf8b0, 0xff8d, 0xfff8},
4970                          {0x9110, 0xf931, 0xffca, 0xfff9, 0xcc8c, 0xf9b1, 0xff9d, 0xfff9},
4971                          {0xa120, 0xfa32, 0xffd2, 0xfffa, 0xd494, 0xfab2, 0xffad, 0xfffa},
4972                          {0xb130, 0xfb33, 0xffda, 0xfffb, 0xdc9c, 0xfbb3, 0xffbd, 0xfffb},
4973                          {0xc140, 0xfc34, 0xffe2, 0xfffc, 0xe4a4, 0xfcb4, 0xffcd, 0xfffc},
4974                          {0xd150, 0xfd35, 0xffea, 0xfffd, 0xecac, 0xfdb5, 0xffdd, 0xfffd},
4975                          {0xe160, 0xfe36, 0xfff2, 0xfffe, 0xf4b4, 0xfeb6, 0xffed, 0xfffe},
4976                          {0xf170, 0xff37, 0xfffa, 0xffff, 0xfcbc, 0xffb7, 0xfffd, 0xffff}},
4977                         {{0x8302'8100, 0xffc3'8342, 0xffff'c585, 0xffff'ff8f},
4978                          {0x9312'9110, 0xffcb'8b4a, 0xffff'cd8d, 0xffff'ff9f},
4979                          {0xa322'a120, 0xffd3'9352, 0xffff'd595, 0xffff'ffaf},
4980                          {0xb332'b130, 0xffdb'9b5a, 0xffff'dd9d, 0xffff'ffbf},
4981                          {0xc342'c140, 0xffe3'a362, 0xffff'e5a5, 0xffff'ffcf},
4982                          {0xd352'd150, 0xffeb'ab6a, 0xffff'edad, 0xffff'ffdf},
4983                          {0xe362'e160, 0xfff3'b372, 0xffff'f5b5, 0xffff'ffef},
4984                          {0xf372'f170, 0xfffb'bb7a, 0xffff'fdbd, 0xffff'ffff}},
4985                         {{0x8706'8504'8302'8100, 0xffff'c787'4686'4585},
4986                          {0xffff'ffff'9716'9514, 0xffff'ffff'ffff'cf8f},
4987                          {0xa726'a524'a322'a120, 0xffff'd797'5696'5595},
4988                          {0xffff'ffff'b736'b534, 0xffff'ffff'ffff'df9f},
4989                          {0xc746'c544'c342'c140, 0xffff'e7a7'66a6'65a5},
4990                          {0xffff'ffff'd756'd554, 0xffff'ffff'ffff'efaf},
4991                          {0xe766'e564'e362'e160, 0xffff'f7b7'76b6'75b5},
4992                          {0xffff'ffff'f776'f574, 0xffff'ffff'ffff'ffbf}},
4993                         kVectorCalculationsSource);
4994 
4995   TestVectorInstruction(ExecVssravx,
4996                         ExecMaskedVssravx,
4997                         {{0, 224, 0, 224, 1, 225, 1, 225, 2, 226, 2, 226, 3, 227, 3, 227},
4998                          {4, 228, 4, 228, 5, 229, 5, 229, 6, 230, 6, 230, 7, 231, 7, 231},
4999                          {8, 232, 8, 232, 9, 233, 9, 233, 10, 234, 10, 234, 11, 235, 11, 235},
5000                          {12, 236, 12, 236, 13, 237, 13, 237, 14, 238, 14, 238, 15, 239, 15, 239},
5001                          {16, 240, 16, 240, 17, 241, 17, 241, 18, 242, 18, 242, 19, 243, 19, 243},
5002                          {20, 244, 20, 244, 21, 245, 21, 245, 22, 246, 22, 246, 23, 247, 23, 247},
5003                          {24, 248, 24, 248, 25, 249, 25, 249, 26, 250, 26, 250, 27, 251, 27, 251},
5004                          {28, 252, 28, 252, 29, 253, 29, 253, 30, 254, 30, 254, 31, 255, 31, 255}},
5005                         {{0xffe0, 0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3},
5006                          {0xffe4, 0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7},
5007                          {0xffe8, 0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb},
5008                          {0xffec, 0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef},
5009                          {0xfff0, 0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3},
5010                          {0xfff4, 0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7},
5011                          {0xfff8, 0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb},
5012                          {0xfffc, 0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff}},
5013                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
5014                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
5015                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
5016                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
5017                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
5018                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
5019                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
5020                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
5021                         {{0xffff'ffff'ffe1'c1a1, 0xffff'ffff'ffe3'c3a3},
5022                          {0xffff'ffff'ffe5'c5a5, 0xffff'ffff'ffe7'c7a7},
5023                          {0xffff'ffff'ffe9'c9a9, 0xffff'ffff'ffeb'cbab},
5024                          {0xffff'ffff'ffed'cdad, 0xffff'ffff'ffef'cfaf},
5025                          {0xffff'ffff'fff1'd1b1, 0xffff'ffff'fff3'd3b3},
5026                          {0xffff'ffff'fff5'd5b5, 0xffff'ffff'fff7'd7b7},
5027                          {0xffff'ffff'fff9'd9b9, 0xffff'ffff'fffb'dbbb},
5028                          {0xffff'ffff'fffd'ddbd, 0xffff'ffff'ffff'dfbf}},
5029                         kVectorCalculationsSource);
5030 
5031   TestVectorInstruction(ExecVssravi,
5032                         ExecMaskedVssravi,
5033                         {{0, 224, 0, 224, 1, 225, 1, 225, 2, 226, 2, 226, 3, 227, 3, 227},
5034                          {4, 228, 4, 228, 5, 229, 5, 229, 6, 230, 6, 230, 7, 231, 7, 231},
5035                          {8, 232, 8, 232, 9, 233, 9, 233, 10, 234, 10, 234, 11, 235, 11, 235},
5036                          {12, 236, 12, 236, 13, 237, 13, 237, 14, 238, 14, 238, 15, 239, 15, 239},
5037                          {16, 240, 16, 240, 17, 241, 17, 241, 18, 242, 18, 242, 19, 243, 19, 243},
5038                          {20, 244, 20, 244, 21, 245, 21, 245, 22, 246, 22, 246, 23, 247, 23, 247},
5039                          {24, 248, 24, 248, 25, 249, 25, 249, 26, 250, 26, 250, 27, 251, 27, 251},
5040                          {28, 252, 28, 252, 29, 253, 29, 253, 30, 254, 30, 254, 31, 255, 31, 255}},
5041                         {{0xffe0, 0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3},
5042                          {0xffe4, 0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7},
5043                          {0xffe8, 0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb},
5044                          {0xffec, 0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef},
5045                          {0xfff0, 0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3},
5046                          {0xfff4, 0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7},
5047                          {0xfff8, 0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb},
5048                          {0xfffc, 0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff}},
5049                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
5050                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
5051                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
5052                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
5053                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
5054                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
5055                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
5056                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
5057                         {{0xffe1'c1a1'4120'c0a0, 0xffe3'c3a3'4322'c2a2},
5058                          {0xffe5'c5a5'4524'c4a4, 0xffe7'c7a7'4726'c6a6},
5059                          {0xffe9'c9a9'4928'c8a8, 0xffeb'cbab'4b2a'caaa},
5060                          {0xffed'cdad'4d2c'ccac, 0xffef'cfaf'4f2e'ceae},
5061                          {0xfff1'd1b1'5130'd0b0, 0xfff3'd3b3'5332'd2b2},
5062                          {0xfff5'd5b5'5534'd4b4, 0xfff7'd7b7'5736'd6b6},
5063                          {0xfff9'd9b9'5938'd8b8, 0xfffb'dbbb'5b3a'daba},
5064                          {0xfffd'ddbd'5d3c'dcbc, 0xffff'dfbf'5f3e'debe}},
5065                         kVectorCalculationsSource);
5066   asm volatile("csrw vxrm, %0\n\t" ::"r"(vxrm));
5067 }
5068 
TEST(InlineAsmTestRiscv64,TestRNE)5069 TEST(InlineAsmTestRiscv64, TestRNE) {
5070   uint64_t vxrm;
5071   asm volatile(
5072       "csrr %0, vxrm\n\t"
5073       "csrwi vxrm, %c1\n\t"
5074       : "=r"(vxrm)
5075       : "i"(VXRMFlags::RNE));
5076   TestVectorInstruction(
5077       ExecVaadduvv,
5078       ExecMaskedVaadduvv,
5079       {{0, 138, 3, 140, 6, 144, 9, 146, 12, 134, 15, 136, 18, 140, 21, 142},
5080        {24, 162, 27, 164, 30, 168, 33, 170, 36, 158, 39, 160, 42, 164, 45, 166},
5081        {48, 186, 51, 188, 54, 192, 57, 194, 60, 182, 63, 184, 66, 188, 69, 190},
5082        {72, 210, 75, 212, 78, 216, 81, 218, 84, 206, 87, 208, 90, 212, 93, 214},
5083        {96, 106, 99, 108, 102, 112, 105, 114, 108, 102, 111, 104, 114, 108, 117, 110},
5084        {120, 130, 123, 132, 126, 136, 129, 138, 132, 126, 135, 128, 138, 132, 141, 134},
5085        {144, 154, 147, 156, 150, 160, 153, 162, 156, 150, 159, 152, 162, 156, 165, 158},
5086        {168, 178, 171, 180, 174, 184, 177, 186, 180, 174, 183, 176, 186, 180, 189, 182}},
5087       {{0x8980, 0x8c83, 0x8f86, 0x9289, 0x858c, 0x888f, 0x8b92, 0x8e95},
5088        {0xa198, 0xa49b, 0xa79e, 0xaaa1, 0x9da4, 0xa0a7, 0xa3aa, 0xa6ad},
5089        {0xb9b0, 0xbcb3, 0xbfb6, 0xc2b9, 0xb5bc, 0xb8bf, 0xbbc2, 0xbec5},
5090        {0xd1c8, 0xd4cb, 0xd7ce, 0xdad1, 0xcdd4, 0xd0d7, 0xd3da, 0xd6dd},
5091        {0x69e0, 0x6ce3, 0x6fe6, 0x72e9, 0x65ec, 0x68ef, 0x6bf2, 0x6ef5},
5092        {0x81f8, 0x84fb, 0x87fe, 0x8b01, 0x7e04, 0x8107, 0x840a, 0x870d},
5093        {0x9a10, 0x9d13, 0xa016, 0xa319, 0x961c, 0x991f, 0x9c22, 0x9f25},
5094        {0xb228, 0xb52b, 0xb82e, 0xbb31, 0xae34, 0xb137, 0xb43a, 0xb73d}},
5095       {{0x8c83'8980, 0x9289'8f86, 0x888f'858c, 0x8e95'8b92},
5096        {0xa49b'a198, 0xaaa1'a79e, 0xa0a7'9da4, 0xa6ad'a3aa},
5097        {0xbcb3'b9b0, 0xc2b9'bfb6, 0xb8bf'b5bc, 0xbec5'bbc2},
5098        {0xd4cb'd1c8, 0xdad1'd7ce, 0xd0d7'cdd4, 0xd6dd'd3da},
5099        {0x6ce3'69e0, 0x72e9'6fe6, 0x68ef'65ec, 0x6ef5'6bf2},
5100        {0x84fb'81f8, 0x8b01'87fe, 0x8107'7e04, 0x870d'840a},
5101        {0x9d13'9a10, 0xa319'a016, 0x991f'961c, 0x9f25'9c22},
5102        {0xb52b'b228, 0xbb31'b82e, 0xb137'ae34, 0xb73d'b43a}},
5103       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858c},
5104        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da4},
5105        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bc},
5106        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd4},
5107        {0x72e9'6fe6'ece3'69e0, 0x6ef5'6bf2'68ef'65ec},
5108        {0x8b01'87ff'04fb'81f8, 0x870d'840a'8107'7e04},
5109        {0xa319'a017'1d13'9a10, 0x9f25'9c22'991f'961c},
5110        {0xbb31'b82f'352b'b228, 0xb73d'b43a'b137'ae34}},
5111       kVectorCalculationsSource);
5112   TestVectorInstruction(
5113       ExecVaadduvx,
5114       ExecMaskedVaadduvx,
5115       {{85, 150, 86, 150, 87, 152, 88, 152, 89, 154, 90, 154, 91, 156, 92, 156},
5116        {93, 158, 94, 158, 95, 160, 96, 160, 97, 162, 98, 162, 99, 164, 100, 164},
5117        {101, 166, 102, 166, 103, 168, 104, 168, 105, 170, 106, 170, 107, 172, 108, 172},
5118        {109, 174, 110, 174, 111, 176, 112, 176, 113, 178, 114, 178, 115, 180, 116, 180},
5119        {117, 182, 118, 182, 119, 184, 120, 184, 121, 186, 122, 186, 123, 188, 124, 188},
5120        {125, 190, 126, 190, 127, 192, 128, 192, 129, 194, 130, 194, 131, 196, 132, 196},
5121        {133, 198, 134, 198, 135, 200, 136, 200, 137, 202, 138, 202, 139, 204, 140, 204},
5122        {141, 206, 142, 206, 143, 208, 144, 208, 145, 210, 146, 210, 147, 212, 148, 212}},
5123       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
5124        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
5125        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
5126        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
5127        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
5128        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
5129        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
5130        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
5131       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
5132        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
5133        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
5134        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
5135        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
5136        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
5137        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
5138        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
5139       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
5140        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
5141        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
5142        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
5143        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
5144        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
5145        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
5146        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
5147       kVectorCalculationsSource);
5148   TestVectorInstruction(
5149       ExecVaaddvv,
5150       ExecMaskedVaaddvv,
5151       {{0, 138, 3, 140, 6, 144, 9, 146, 12, 134, 15, 136, 18, 140, 21, 142},
5152        {24, 162, 27, 164, 30, 168, 33, 170, 36, 158, 39, 160, 42, 164, 45, 166},
5153        {48, 186, 51, 188, 54, 192, 57, 194, 60, 182, 63, 184, 66, 188, 69, 190},
5154        {72, 210, 75, 212, 78, 216, 81, 218, 84, 206, 87, 208, 90, 212, 93, 214},
5155        {224, 234, 227, 236, 230, 240, 233, 242, 236, 230, 239, 232, 242, 236, 245, 238},
5156        {248, 2, 251, 4, 254, 8, 1, 10, 4, 254, 7, 0, 10, 4, 13, 6},
5157        {16, 26, 19, 28, 22, 32, 25, 34, 28, 22, 31, 24, 34, 28, 37, 30},
5158        {40, 50, 43, 52, 46, 56, 49, 58, 52, 46, 55, 48, 58, 52, 61, 54}},
5159       {{0x8980, 0x8c83, 0x8f86, 0x9289, 0x858c, 0x888f, 0x8b92, 0x8e95},
5160        {0xa198, 0xa49b, 0xa79e, 0xaaa1, 0x9da4, 0xa0a7, 0xa3aa, 0xa6ad},
5161        {0xb9b0, 0xbcb3, 0xbfb6, 0xc2b9, 0xb5bc, 0xb8bf, 0xbbc2, 0xbec5},
5162        {0xd1c8, 0xd4cb, 0xd7ce, 0xdad1, 0xcdd4, 0xd0d7, 0xd3da, 0xd6dd},
5163        {0xe9e0, 0xece3, 0xefe6, 0xf2e9, 0xe5ec, 0xe8ef, 0xebf2, 0xeef5},
5164        {0x01f8, 0x04fb, 0x07fe, 0x0b01, 0xfe04, 0x0107, 0x040a, 0x070d},
5165        {0x1a10, 0x1d13, 0x2016, 0x2319, 0x161c, 0x191f, 0x1c22, 0x1f25},
5166        {0x3228, 0x352b, 0x382e, 0x3b31, 0x2e34, 0x3137, 0x343a, 0x373d}},
5167       {{0x8c83'8980, 0x9289'8f86, 0x888f'858c, 0x8e95'8b92},
5168        {0xa49b'a198, 0xaaa1'a79e, 0xa0a7'9da4, 0xa6ad'a3aa},
5169        {0xbcb3'b9b0, 0xc2b9'bfb6, 0xb8bf'b5bc, 0xbec5'bbc2},
5170        {0xd4cb'd1c8, 0xdad1'd7ce, 0xd0d7'cdd4, 0xd6dd'd3da},
5171        {0xece3'69e0, 0xf2e9'6fe6, 0xe8ef'65ec, 0xeef5'6bf2},
5172        {0x04fb'81f8, 0x0b01'87fe, 0x0107'7e04, 0x070d'840a},
5173        {0x1d13'9a10, 0x2319'a016, 0x191f'961c, 0x1f25'9c22},
5174        {0x352b'b228, 0x3b31'b82e, 0x3137'ae34, 0x373d'b43a}},
5175       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858c},
5176        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da4},
5177        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bc},
5178        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd4},
5179        {0xf2e9'6fe6'ece3'69e0, 0xeef5'6bf2'68ef'65ec},
5180        {0x0b01'87ff'04fb'81f8, 0x070d'840a'8107'7e04},
5181        {0x2319'a017'1d13'9a10, 0x1f25'9c22'991f'961c},
5182        {0x3b31'b82f'352b'b228, 0x373d'b43a'b137'ae34}},
5183       kVectorCalculationsSource);
5184   TestVectorInstruction(
5185       ExecVaaddvx,
5186       ExecMaskedVaaddvx,
5187       {{213, 150, 214, 150, 215, 152, 216, 152, 217, 154, 218, 154, 219, 156, 220, 156},
5188        {221, 158, 222, 158, 223, 160, 224, 160, 225, 162, 226, 162, 227, 164, 228, 164},
5189        {229, 166, 230, 166, 231, 168, 232, 168, 233, 170, 234, 170, 235, 172, 236, 172},
5190        {237, 174, 238, 174, 239, 176, 240, 176, 241, 178, 242, 178, 243, 180, 244, 180},
5191        {245, 182, 246, 182, 247, 184, 248, 184, 249, 186, 250, 186, 251, 188, 252, 188},
5192        {253, 190, 254, 190, 255, 192, 0, 192, 1, 194, 2, 194, 3, 196, 4, 196},
5193        {5, 198, 6, 198, 7, 200, 8, 200, 9, 202, 10, 202, 11, 204, 12, 204},
5194        {13, 206, 14, 206, 15, 208, 16, 208, 17, 210, 18, 210, 19, 212, 20, 212}},
5195       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
5196        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
5197        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
5198        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
5199        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
5200        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
5201        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
5202        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
5203       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
5204        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
5205        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
5206        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
5207        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
5208        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
5209        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
5210        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
5211       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
5212        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
5213        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
5214        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
5215        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
5216        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
5217        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
5218        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
5219       kVectorCalculationsSource);
5220   TestVectorInstruction(
5221       ExecVasubuvv,
5222       ExecMaskedVasubuvv,
5223       {{0, 248, 255, 246, 254, 246, 253, 244, 252, 4, 251, 2, 250, 2, 249, 0},
5224        {248, 240, 247, 238, 246, 238, 245, 236, 244, 252, 243, 250, 242, 250, 241, 248},
5225        {240, 232, 239, 230, 238, 230, 237, 228, 236, 244, 235, 242, 234, 242, 233, 240},
5226        {232, 224, 231, 222, 230, 222, 229, 220, 228, 236, 227, 234, 226, 234, 225, 232},
5227        {224, 88, 223, 86, 222, 86, 221, 84, 220, 100, 219, 98, 218, 98, 217, 96},
5228        {216, 80, 215, 78, 214, 78, 213, 76, 212, 92, 211, 90, 210, 90, 209, 88},
5229        {208, 72, 207, 70, 206, 70, 205, 68, 204, 84, 203, 82, 202, 82, 201, 80},
5230        {200, 64, 199, 62, 198, 62, 197, 60, 196, 76, 195, 74, 194, 74, 193, 72}},
5231       {{0xf780, 0xf67f, 0xf57e, 0xf47d, 0x037c, 0x027b, 0x017a, 0x0079},
5232        {0xef78, 0xee77, 0xed76, 0xec75, 0xfb74, 0xfa73, 0xf972, 0xf871},
5233        {0xe770, 0xe66f, 0xe56e, 0xe46d, 0xf36c, 0xf26b, 0xf16a, 0xf069},
5234        {0xdf68, 0xde67, 0xdd66, 0xdc65, 0xeb64, 0xea63, 0xe962, 0xe861},
5235        {0x5760, 0x565f, 0x555e, 0x545d, 0x635c, 0x625b, 0x615a, 0x6059},
5236        {0x4f58, 0x4e57, 0x4d56, 0x4c55, 0x5b54, 0x5a53, 0x5952, 0x5851},
5237        {0x4750, 0x464f, 0x454e, 0x444d, 0x534c, 0x524b, 0x514a, 0x5049},
5238        {0x3f48, 0x3e47, 0x3d46, 0x3c45, 0x4b44, 0x4a43, 0x4942, 0x4841}},
5239       {{0xf67e'f780, 0xf47c'f57e, 0x027b'037c, 0x0079'017a},
5240        {0xee76'ef78, 0xec74'ed76, 0xfa72'fb74, 0xf870'f972},
5241        {0xe66e'e770, 0xe46c'e56e, 0xf26a'f36c, 0xf068'f16a},
5242        {0xde66'df68, 0xdc64'dd66, 0xea62'eb64, 0xe860'e962},
5243        {0x565f'5760, 0x545d'555e, 0x625b'635c, 0x6059'615a},
5244        {0x4e57'4f58, 0x4c55'4d56, 0x5a53'5b54, 0x5851'5952},
5245        {0x464f'4750, 0x444d'454e, 0x524b'534c, 0x5049'514a},
5246        {0x3e47'3f48, 0x3c45'3d46, 0x4a43'4b44, 0x4841'4942}},
5247       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037c},
5248        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb74},
5249        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36c},
5250        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb64},
5251        {0x545d'555d'd65f'5760, 0x6059'615a'625b'635c},
5252        {0x4c55'4d55'ce57'4f58, 0x5851'5952'5a53'5b54},
5253        {0x444d'454d'c64f'4750, 0x5049'514a'524b'534c},
5254        {0x3c45'3d45'be47'3f48, 0x4841'4942'4a43'4b44}},
5255       kVectorCalculationsSource);
5256   TestVectorInstruction(
5257       ExecVasubuvx,
5258       ExecMaskedVasubuvx,
5259       {{171, 236, 172, 236, 173, 238, 174, 238, 175, 240, 176, 240, 177, 242, 178, 242},
5260        {179, 244, 180, 244, 181, 246, 182, 246, 183, 248, 184, 248, 185, 250, 186, 250},
5261        {187, 252, 188, 252, 189, 254, 190, 254, 191, 0, 192, 0, 193, 2, 194, 2},
5262        {195, 4, 196, 4, 197, 6, 198, 6, 199, 8, 200, 8, 201, 10, 202, 10},
5263        {203, 12, 204, 12, 205, 14, 206, 14, 207, 16, 208, 16, 209, 18, 210, 18},
5264        {211, 20, 212, 20, 213, 22, 214, 22, 215, 24, 216, 24, 217, 26, 218, 26},
5265        {219, 28, 220, 28, 221, 30, 222, 30, 223, 32, 224, 32, 225, 34, 226, 34},
5266        {227, 36, 228, 36, 229, 38, 230, 38, 231, 40, 232, 40, 233, 42, 234, 42}},
5267       {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
5268        {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
5269        {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
5270        {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
5271        {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
5272        {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
5273        {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
5274        {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
5275       {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
5276        {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
5277        {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
5278        {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
5279        {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
5280        {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
5281        {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
5282        {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
5283       {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
5284        {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
5285        {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
5286        {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
5287        {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
5288        {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
5289        {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
5290        {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
5291       kVectorCalculationsSource);
5292   TestVectorInstruction(
5293       ExecVasubvv,
5294       ExecMaskedVasubvv,
5295       {{0, 248, 255, 246, 254, 246, 253, 244, 252, 4, 251, 2, 250, 2, 249, 0},
5296        {248, 240, 247, 238, 246, 238, 245, 236, 244, 252, 243, 250, 242, 250, 241, 248},
5297        {240, 232, 239, 230, 238, 230, 237, 228, 236, 244, 235, 242, 234, 242, 233, 240},
5298        {232, 224, 231, 222, 230, 222, 229, 220, 228, 236, 227, 234, 226, 234, 225, 232},
5299        {96, 216, 95, 214, 94, 214, 93, 212, 92, 228, 91, 226, 90, 226, 89, 224},
5300        {88, 208, 87, 206, 86, 206, 85, 204, 84, 220, 83, 218, 82, 218, 81, 216},
5301        {80, 200, 79, 198, 78, 198, 77, 196, 76, 212, 75, 210, 74, 210, 73, 208},
5302        {72, 192, 71, 190, 70, 190, 69, 188, 68, 204, 67, 202, 66, 202, 65, 200}},
5303       {{0xf780, 0xf67f, 0xf57e, 0xf47d, 0x037c, 0x027b, 0x017a, 0x0079},
5304        {0xef78, 0xee77, 0xed76, 0xec75, 0xfb74, 0xfa73, 0xf972, 0xf871},
5305        {0xe770, 0xe66f, 0xe56e, 0xe46d, 0xf36c, 0xf26b, 0xf16a, 0xf069},
5306        {0xdf68, 0xde67, 0xdd66, 0xdc65, 0xeb64, 0xea63, 0xe962, 0xe861},
5307        {0xd760, 0xd65f, 0xd55e, 0xd45d, 0xe35c, 0xe25b, 0xe15a, 0xe059},
5308        {0xcf58, 0xce57, 0xcd56, 0xcc55, 0xdb54, 0xda53, 0xd952, 0xd851},
5309        {0xc750, 0xc64f, 0xc54e, 0xc44d, 0xd34c, 0xd24b, 0xd14a, 0xd049},
5310        {0xbf48, 0xbe47, 0xbd46, 0xbc45, 0xcb44, 0xca43, 0xc942, 0xc841}},
5311       {{0xf67e'f780, 0xf47c'f57e, 0x027b'037c, 0x0079'017a},
5312        {0xee76'ef78, 0xec74'ed76, 0xfa72'fb74, 0xf870'f972},
5313        {0xe66e'e770, 0xe46c'e56e, 0xf26a'f36c, 0xf068'f16a},
5314        {0xde66'df68, 0xdc64'dd66, 0xea62'eb64, 0xe860'e962},
5315        {0xd65f'5760, 0xd45d'555e, 0xe25b'635c, 0xe059'615a},
5316        {0xce57'4f58, 0xcc55'4d56, 0xda53'5b54, 0xd851'5952},
5317        {0xc64f'4750, 0xc44d'454e, 0xd24b'534c, 0xd049'514a},
5318        {0xbe47'3f48, 0xbc45'3d46, 0xca43'4b44, 0xc841'4942}},
5319       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037c},
5320        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb74},
5321        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36c},
5322        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb64},
5323        {0xd45d'555d'd65f'5760, 0xe059'615a'625b'635c},
5324        {0xcc55'4d55'ce57'4f58, 0xd851'5952'5a53'5b54},
5325        {0xc44d'454d'c64f'4750, 0xd049'514a'524b'534c},
5326        {0xbc45'3d45'be47'3f48, 0xc841'4942'4a43'4b44}},
5327       kVectorCalculationsSource);
5328   TestVectorInstruction(ExecVasubvx,
5329                         ExecMaskedVasubvx,
5330                         {{43, 236, 44, 236, 45, 238, 46, 238, 47, 240, 48, 240, 49, 242, 50, 242},
5331                          {51, 244, 52, 244, 53, 246, 54, 246, 55, 248, 56, 248, 57, 250, 58, 250},
5332                          {59, 252, 60, 252, 61, 254, 62, 254, 63, 0, 64, 0, 65, 2, 66, 2},
5333                          {67, 4, 68, 4, 69, 6, 70, 6, 71, 8, 72, 8, 73, 10, 74, 10},
5334                          {75, 12, 76, 12, 77, 14, 78, 14, 79, 16, 80, 16, 81, 18, 82, 18},
5335                          {83, 20, 84, 20, 85, 22, 86, 22, 87, 24, 88, 24, 89, 26, 90, 26},
5336                          {91, 28, 92, 28, 93, 30, 94, 30, 95, 32, 96, 32, 97, 34, 98, 34},
5337                          {99, 36, 100, 36, 101, 38, 102, 38, 103, 40, 104, 40, 105, 42, 106, 42}},
5338                         {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
5339                          {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
5340                          {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
5341                          {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
5342                          {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
5343                          {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
5344                          {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
5345                          {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
5346                         {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
5347                          {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
5348                          {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
5349                          {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
5350                          {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
5351                          {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
5352                          {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
5353                          {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
5354                         {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
5355                          {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
5356                          {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
5357                          {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
5358                          {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
5359                          {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
5360                          {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
5361                          {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
5362                         kVectorCalculationsSource);
5363   TestNarrowingVectorInstruction(ExecVnclipuwi,
5364                                  ExecMaskedVnclipuwi,
5365                                  {{32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40},
5366                                   {40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48},
5367                                   {48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56},
5368                                   {56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64}},
5369                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
5370                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
5371                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
5372                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
5373                                  {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
5374                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
5375                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
5376                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
5377                                  kVectorCalculationsSource);
5378   TestNarrowingVectorInstruction(
5379       ExecVnclipwi,
5380       ExecMaskedVnclipwi,
5381       {{224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232},
5382        {232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240},
5383        {240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248},
5384        {248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, 0}},
5385       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
5386        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
5387        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
5388        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
5389       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
5390        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
5391        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
5392        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000}},
5393       kVectorCalculationsSource);
5394 
5395   TestNarrowingVectorInstruction(ExecVnclipuwx,
5396                                  ExecMaskedVnclipuwx,
5397                                  {{32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40},
5398                                   {40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48},
5399                                   {48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56},
5400                                   {56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64}},
5401                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
5402                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
5403                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
5404                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
5405                                  {{0x0021'c1a1, 0x0023'c3a3, 0x0025'c5a5, 0x0027'c7a7},
5406                                   {0x0029'c9a9, 0x002b'cbab, 0x002d'cdad, 0x002f'cfaf},
5407                                   {0x0031'd1b1, 0x0033'd3b3, 0x0035'd5b5, 0x0037'd7b7},
5408                                   {0x0039'd9b9, 0x003b'dbbb, 0x003d'ddbd, 0x003f'dfbf}},
5409                                  kVectorCalculationsSource);
5410 
5411   TestNarrowingVectorInstruction(
5412       ExecVnclipwx,
5413       ExecMaskedVnclipwx,
5414       {{224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232},
5415        {232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240},
5416        {240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248},
5417        {248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, 0}},
5418       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
5419        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
5420        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
5421        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
5422       {{0xffe1'c1a1, 0xffe3'c3a3, 0xffe5'c5a5, 0xffe7'c7a7},
5423        {0xffe9'c9a9, 0xffeb'cbab, 0xffed'cdad, 0xffef'cfaf},
5424        {0xfff1'd1b1, 0xfff3'd3b3, 0xfff5'd5b5, 0xfff7'd7b7},
5425        {0xfff9'd9b9, 0xfffb'dbbb, 0xfffd'ddbd, 0xffff'dfbf}},
5426       kVectorCalculationsSource);
5427 
5428   TestNarrowingVectorInstruction(
5429       ExecVnclipuwv,
5430       ExecMaskedVnclipuwv,
5431       {{255, 255, 255, 255, 69, 35, 9, 2, 255, 255, 255, 255, 153, 39, 10, 2},
5432        {255, 255, 255, 255, 85, 43, 11, 3, 255, 255, 255, 255, 185, 47, 12, 3},
5433        {255, 255, 255, 255, 101, 51, 13, 3, 255, 255, 255, 255, 217, 55, 14, 3},
5434        {255, 255, 255, 255, 117, 59, 15, 4, 255, 255, 255, 255, 249, 63, 16, 4}},
5435       {{0xffff, 0xffff, 0xffff, 0xffff, 0x4989, 0x0971, 0x009b, 0x000a},
5436        {0xffff, 0xffff, 0xffff, 0xffff, 0x5999, 0x0b73, 0x00bb, 0x000c},
5437        {0xffff, 0xffff, 0xffff, 0xffff, 0x69a9, 0x0d75, 0x00db, 0x000e},
5438        {0xffff, 0xffff, 0xffff, 0xffff, 0x79b9, 0x0f77, 0x00fb, 0x0010}},
5439       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
5440        {0xa726'a525, 0x0057'9757, 0x0000'5b9b, 0x0000'00bf},
5441        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
5442        {0xe766'e565, 0x0077'b777, 0x0000'7bbb, 0x0000'00ff}},
5443       kVectorCalculationsSource);
5444 
5445   TestNarrowingVectorInstruction(
5446       ExecVnclipwv,
5447       ExecMaskedVnclipwv,
5448       {{128, 128, 128, 128, 197, 227, 249, 254, 128, 128, 128, 128, 153, 231, 250, 254},
5449        {128, 128, 128, 128, 213, 235, 251, 255, 128, 128, 128, 128, 185, 239, 252, 255},
5450        {128, 128, 128, 128, 229, 243, 253, 255, 128, 128, 128, 128, 217, 247, 254, 255},
5451        {128, 128, 128, 158, 245, 251, 255, 0, 128, 128, 128, 222, 249, 255, 0, 0}},
5452       {{0x8000, 0x8000, 0x8000, 0x8000, 0xc989, 0xf971, 0xff9b, 0xfffa},
5453        {0x8000, 0x8000, 0x8000, 0x8000, 0xd999, 0xfb73, 0xffbb, 0xfffc},
5454        {0x8000, 0x8000, 0x8000, 0x8000, 0xe9a9, 0xfd75, 0xffdb, 0xfffe},
5455        {0x8000, 0x8000, 0x8000, 0x8000, 0xf9b9, 0xff77, 0xfffb, 0x0000}},
5456       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
5457        {0xa726'a525, 0xffd7'9757, 0xffff'db9b, 0xffff'ffbf},
5458        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
5459        {0xe766'e565, 0xfff7'b777, 0xffff'fbbb, 0xffff'ffff}},
5460       kVectorCalculationsSource);
5461 
5462   TestVectorInstruction(
5463       ExecVsmulvv,
5464       ExecMaskedVsmulvv,
5465       {{0, 109, 0, 104, 0, 98, 1, 93, 1, 117, 2, 112, 2, 106, 3, 101},
5466        {4, 68, 5, 63, 6, 59, 8, 54, 9, 76, 11, 71, 12, 67, 14, 62},
5467        {16, 34, 18, 31, 21, 27, 23, 24, 25, 42, 28, 39, 30, 35, 33, 32},
5468        {36, 9, 39, 6, 43, 4, 46, 1, 49, 17, 53, 14, 56, 12, 60, 9},
5469        {192, 247, 192, 246, 193, 244, 193, 243, 194, 255, 194, 254, 194, 252, 195, 251},
5470        {196, 238, 197, 237, 199, 237, 200, 236, 202, 246, 203, 245, 204, 245, 206, 244},
5471        {208, 236, 210, 237, 213, 237, 215, 238, 218, 244, 220, 245, 222, 245, 225, 246},
5472        {228, 243, 231, 244, 235, 246, 238, 247, 242, 251, 245, 252, 248, 254, 252, 255}},
5473       {{0x6d24, 0x677e, 0x61f8, 0x5c94, 0x750c, 0x6f68, 0x69e3, 0x647f},
5474        {0x437f, 0x3edb, 0x3a57, 0x35f5, 0x4b6b, 0x46c9, 0x4246, 0x3de3},
5475        {0x21e9, 0x1e48, 0x1ac5, 0x1765, 0x29da, 0x2639, 0x22b8, 0x1f58},
5476        {0x0864, 0x05c4, 0x0344, 0x00e6, 0x1058, 0x0dba, 0x0b3b, 0x08dd},
5477        {0xf6ee, 0xf551, 0xf3d3, 0xf276, 0xfee7, 0xfd4b, 0xfbce, 0xfa71},
5478        {0xed89, 0xeced, 0xec72, 0xec17, 0xf586, 0xf4eb, 0xf470, 0xf416},
5479        {0xec34, 0xec9a, 0xed21, 0xedc8, 0xf435, 0xf49c, 0xf523, 0xf5cb},
5480        {0xf2ee, 0xf457, 0xf5df, 0xf788, 0xfaf4, 0xfc5d, 0xfde6, 0xff8f}},
5481       {{0x677d'76af, 0x5c93'1931, 0x6f67'3831, 0x647d'dbb7},
5482        {0x3eda'09c6, 0x35f3'b250, 0x46c7'cf50, 0x3de2'78de},
5483        {0x1e46'b4fd, 0x1764'6390, 0x2638'7e90, 0x1f57'2e25},
5484        {0x05c3'7855, 0x00e5'2cef, 0x0db9'45ef, 0x08db'fb8d},
5485        {0xf550'cd47, 0xf276'7fe1, 0xfd4a'8eda, 0xfa71'4277},
5486        {0xeced'a0be, 0xec17'5961, 0xf4eb'6659, 0xf416'1ffe},
5487        {0xec9a'8c56, 0xedc8'4b01, 0xf49c'55f9, 0xf5cb'15a6},
5488        {0xf457'900e, 0xf789'54c1, 0xfc5d'5db9, 0xff90'236e}},
5489       {{0x5c93'192f'ccd4'7781, 0x647d'dbb5'bb66'23af},
5490        {0x35f3'b24f'43d0'aa38, 0x3de2'78dd'1a4e'4256},
5491        {0x1764'638e'e2fd'152f, 0x1f57'2e24'a166'993d},
5492        {0x00e5'2cee'aa59'b866, 0x08db'fb8c'50af'2865},
5493        {0xf276'7fe1'80cf'f441, 0xfa71'4276'eef1'1fff},
5494        {0xec17'5961'584c'a799, 0xf416'1ffe'ae59'bf47},
5495        {0xedc8'4b01'57f9'9330, 0xf5cb'15a6'95f2'96cf},
5496        {0xf789'54c1'7fd6'b708, 0xff90'236e'a5bb'a696}},
5497       kVectorCalculationsSource);
5498   TestVectorInstruction(ExecVsmulvx,
5499                         ExecMaskedVsmulvx,
5500                         {{0, 85, 255, 84, 253, 83, 252, 81, 251, 80, 249, 79, 248, 77, 247, 76},
5501                          {245, 75, 244, 73, 243, 72, 241, 71, 240, 69, 239, 68, 237, 67, 236, 65},
5502                          {234, 64, 233, 62, 232, 61, 230, 60, 229, 58, 228, 57, 226, 56, 225, 54},
5503                          {224, 53, 222, 52, 221, 50, 220, 49, 218, 48, 217, 46, 216, 45, 214, 44},
5504                          {213, 42, 212, 41, 210, 40, 209, 38, 208, 37, 206, 36, 205, 34, 204, 33},
5505                          {202, 32, 201, 30, 200, 29, 198, 28, 197, 26, 196, 25, 194, 24, 193, 22},
5506                          {192, 21, 190, 19, 189, 18, 187, 17, 186, 15, 185, 14, 183, 13, 182, 11},
5507                          {181, 10, 179, 9, 178, 7, 177, 6, 175, 5, 174, 3, 173, 2, 171, 1}},
5508                         {{0x54ab, 0x5355, 0x51fe, 0x50a7, 0x4f51, 0x4dfa, 0x4ca3, 0x4b4d},
5509                          {0x49f6, 0x489f, 0x4749, 0x45f2, 0x449b, 0x4345, 0x41ee, 0x4097},
5510                          {0x3f40, 0x3dea, 0x3c93, 0x3b3c, 0x39e6, 0x388f, 0x3738, 0x35e2},
5511                          {0x348b, 0x3334, 0x31de, 0x3087, 0x2f30, 0x2dda, 0x2c83, 0x2b2c},
5512                          {0x29d6, 0x287f, 0x2728, 0x25d2, 0x247b, 0x2324, 0x21ce, 0x2077},
5513                          {0x1f20, 0x1dca, 0x1c73, 0x1b1c, 0x19c6, 0x186f, 0x1718, 0x15c2},
5514                          {0x146b, 0x1314, 0x11bd, 0x1067, 0x0f10, 0x0db9, 0x0c63, 0x0b0c},
5515                          {0x09b5, 0x085f, 0x0708, 0x05b1, 0x045b, 0x0304, 0x01ad, 0x0057}},
5516                         {{0x5353'aa01, 0x50a6'51fe, 0x4df8'f9fb, 0x4b4b'a1f9},
5517                          {0x489e'49f6, 0x45f0'f1f3, 0x4343'99f1, 0x4096'41ee},
5518                          {0x3de8'e9eb, 0x3b3b'91e8, 0x388e'39e6, 0x35e0'e1e3},
5519                          {0x3333'89e0, 0x3086'31de, 0x2dd8'd9db, 0x2b2b'81d8},
5520                          {0x287e'29d6, 0x25d0'd1d3, 0x2323'79d0, 0x2076'21ce},
5521                          {0x1dc8'c9cb, 0x1b1b'71c8, 0x186e'19c6, 0x15c0'c1c3},
5522                          {0x1313'69c0, 0x1066'11bd, 0x0db8'b9bb, 0x0b0b'61b8},
5523                          {0x085e'09b5, 0x05b0'b1b3, 0x0303'59b0, 0x0056'01ad}},
5524                         {{0x50a6'51fc'fdfe'54ab, 0x4b4b'a1f7'a34e'4f51},
5525                          {0x45f0'f1f2'489e'49f6, 0x4096'41ec'edee'449b},
5526                          {0x3b3b'91e7'933e'3f40, 0x35e0'e1e2'388e'39e6},
5527                          {0x3086'31dc'ddde'348b, 0x2b2b'81d7'832e'2f30},
5528                          {0x25d0'd1d2'287e'29d6, 0x2076'21cc'cdce'247b},
5529                          {0x1b1b'71c7'731e'1f20, 0x15c0'c1c2'186e'19c6},
5530                          {0x1066'11bc'bdbe'146b, 0x0b0b'61b7'630e'0f10},
5531                          {0x05b0'b1b2'085e'09b5, 0x0056'01ac'adae'045b}},
5532                         kVectorCalculationsSource);
5533   TestVectorInstruction(ExecVssrlvv,
5534                         ExecMaskedVssrlvv,
5535                         {{0, 32, 0, 2, 2, 33, 0, 2, 4, 34, 1, 2, 12, 35, 1, 2},
5536                          {16, 36, 1, 2, 10, 37, 1, 2, 12, 38, 2, 2, 28, 39, 2, 2},
5537                          {32, 40, 2, 3, 18, 41, 2, 3, 20, 42, 3, 3, 44, 43, 3, 3},
5538                          {48, 44, 3, 3, 26, 45, 3, 3, 28, 46, 4, 3, 60, 47, 4, 3},
5539                          {64, 48, 4, 3, 34, 49, 4, 3, 36, 50, 5, 3, 76, 51, 5, 3},
5540                          {80, 52, 5, 3, 42, 53, 5, 3, 44, 54, 6, 3, 92, 55, 6, 3},
5541                          {96, 56, 6, 4, 50, 57, 6, 4, 52, 58, 7, 4, 108, 59, 7, 4},
5542                          {112, 60, 7, 4, 58, 61, 7, 4, 60, 62, 8, 4, 124, 63, 8, 4}},
5543                         {{0x8100, 0x0830, 0x0043, 0x0008, 0x4484, 0x08b1, 0x008d, 0x0009},
5544                          {0x9110, 0x0931, 0x004b, 0x0009, 0x4c8c, 0x09b2, 0x009d, 0x000a},
5545                          {0xa120, 0x0a32, 0x0053, 0x000a, 0x5494, 0x0ab3, 0x00ad, 0x000b},
5546                          {0xb130, 0x0b33, 0x005b, 0x000b, 0x5c9c, 0x0bb4, 0x00bd, 0x000c},
5547                          {0xc140, 0x0c34, 0x0063, 0x000c, 0x64a4, 0x0cb5, 0x00cd, 0x000d},
5548                          {0xd150, 0x0d35, 0x006b, 0x000d, 0x6cac, 0x0db6, 0x00dd, 0x000e},
5549                          {0xe160, 0x0e36, 0x0073, 0x000e, 0x74b4, 0x0eb7, 0x00ed, 0x000f},
5550                          {0xf170, 0x0f37, 0x007b, 0x000f, 0x7cbc, 0x0fb8, 0x00fd, 0x0010}},
5551                         {{0x8302'8100, 0x0043'8343, 0x0000'4585, 0x0000'008f},
5552                          {0x9312'9110, 0x004b'8b4b, 0x0000'4d8d, 0x0000'009f},
5553                          {0xa322'a120, 0x0053'9353, 0x0000'5595, 0x0000'00af},
5554                          {0xb332'b130, 0x005b'9b5b, 0x0000'5d9d, 0x0000'00bf},
5555                          {0xc342'c140, 0x0063'a363, 0x0000'65a5, 0x0000'00cf},
5556                          {0xd352'd150, 0x006b'ab6b, 0x0000'6dad, 0x0000'00df},
5557                          {0xe362'e160, 0x0073'b373, 0x0000'75b5, 0x0000'00ef},
5558                          {0xf372'f170, 0x007b'bb7b, 0x0000'7dbd, 0x0000'00ff}},
5559                         {{0x8706'8504'8302'8100, 0x0000'4787'4686'4585},
5560                          {0x0000'0000'9716'9515, 0x0000'0000'0000'4f8f},
5561                          {0xa726'a524'a322'a120, 0x0000'5797'5696'5595},
5562                          {0x0000'0000'b736'b535, 0x0000'0000'0000'5f9f},
5563                          {0xc746'c544'c342'c140, 0x0000'67a7'66a6'65a5},
5564                          {0x0000'0000'd756'd555, 0x0000'0000'0000'6faf},
5565                          {0xe766'e564'e362'e160, 0x0000'77b7'76b6'75b5},
5566                          {0x0000'0000'f776'f575, 0x0000'0000'0000'7fbf}},
5567                         kVectorCalculationsSource);
5568 
5569   TestVectorInstruction(ExecVssrlvx,
5570                         ExecMaskedVssrlvx,
5571                         {{0, 32, 0, 33, 1, 33, 2, 34, 2, 34, 2, 35, 3, 35, 4, 36},
5572                          {4, 36, 4, 37, 5, 37, 6, 38, 6, 38, 6, 39, 7, 39, 8, 40},
5573                          {8, 40, 8, 41, 9, 41, 10, 42, 10, 42, 10, 43, 11, 43, 12, 44},
5574                          {12, 44, 12, 45, 13, 45, 14, 46, 14, 46, 14, 47, 15, 47, 16, 48},
5575                          {16, 48, 16, 49, 17, 49, 18, 50, 18, 50, 18, 51, 19, 51, 20, 52},
5576                          {20, 52, 20, 53, 21, 53, 22, 54, 22, 54, 22, 55, 23, 55, 24, 56},
5577                          {24, 56, 24, 57, 25, 57, 26, 58, 26, 58, 26, 59, 27, 59, 28, 60},
5578                          {28, 60, 28, 61, 29, 61, 30, 62, 30, 62, 30, 63, 31, 63, 32, 64}},
5579                         {{0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x0024},
5580                          {0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027, 0x0028},
5581                          {0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b, 0x002c},
5582                          {0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f, 0x0030},
5583                          {0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033, 0x0034},
5584                          {0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037, 0x0038},
5585                          {0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b, 0x003c},
5586                          {0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f, 0x0040}},
5587                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
5588                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
5589                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
5590                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
5591                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
5592                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
5593                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
5594                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
5595                         {{0x0000'0000'0021'c1a1, 0x0000'0000'0023'c3a3},
5596                          {0x0000'0000'0025'c5a5, 0x0000'0000'0027'c7a7},
5597                          {0x0000'0000'0029'c9a9, 0x0000'0000'002b'cbab},
5598                          {0x0000'0000'002d'cdad, 0x0000'0000'002f'cfaf},
5599                          {0x0000'0000'0031'd1b1, 0x0000'0000'0033'd3b3},
5600                          {0x0000'0000'0035'd5b5, 0x0000'0000'0037'd7b7},
5601                          {0x0000'0000'0039'd9b9, 0x0000'0000'003b'dbbb},
5602                          {0x0000'0000'003d'ddbd, 0x0000'0000'003f'dfbf}},
5603                         kVectorCalculationsSource);
5604 
5605   TestVectorInstruction(ExecVssrlvi,
5606                         ExecMaskedVssrlvi,
5607                         {{0, 32, 0, 33, 1, 33, 2, 34, 2, 34, 2, 35, 3, 35, 4, 36},
5608                          {4, 36, 4, 37, 5, 37, 6, 38, 6, 38, 6, 39, 7, 39, 8, 40},
5609                          {8, 40, 8, 41, 9, 41, 10, 42, 10, 42, 10, 43, 11, 43, 12, 44},
5610                          {12, 44, 12, 45, 13, 45, 14, 46, 14, 46, 14, 47, 15, 47, 16, 48},
5611                          {16, 48, 16, 49, 17, 49, 18, 50, 18, 50, 18, 51, 19, 51, 20, 52},
5612                          {20, 52, 20, 53, 21, 53, 22, 54, 22, 54, 22, 55, 23, 55, 24, 56},
5613                          {24, 56, 24, 57, 25, 57, 26, 58, 26, 58, 26, 59, 27, 59, 28, 60},
5614                          {28, 60, 28, 61, 29, 61, 30, 62, 30, 62, 30, 63, 31, 63, 32, 64}},
5615                         {{0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x0024},
5616                          {0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027, 0x0028},
5617                          {0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b, 0x002c},
5618                          {0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f, 0x0030},
5619                          {0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033, 0x0034},
5620                          {0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037, 0x0038},
5621                          {0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b, 0x003c},
5622                          {0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f, 0x0040}},
5623                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
5624                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
5625                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
5626                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
5627                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
5628                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
5629                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
5630                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
5631                         {{0x0021'c1a1'4120'c0a0, 0x0023'c3a3'4322'c2a2},
5632                          {0x0025'c5a5'4524'c4a4, 0x0027'c7a7'4726'c6a6},
5633                          {0x0029'c9a9'4928'c8a8, 0x002b'cbab'4b2a'caaa},
5634                          {0x002d'cdad'4d2c'ccac, 0x002f'cfaf'4f2e'ceae},
5635                          {0x0031'd1b1'5130'd0b0, 0x0033'd3b3'5332'd2b2},
5636                          {0x0035'd5b5'5534'd4b4, 0x0037'd7b7'5736'd6b6},
5637                          {0x0039'd9b9'5938'd8b8, 0x003b'dbbb'5b3a'daba},
5638                          {0x003d'ddbd'5d3c'dcbc, 0x003f'dfbf'5f3e'debe}},
5639                         kVectorCalculationsSource);
5640   TestVectorInstruction(ExecVssravv,
5641                         ExecMaskedVssravv,
5642                         {{0, 224, 0, 254, 2, 225, 0, 254, 4, 226, 1, 254, 12, 227, 1, 254},
5643                          {16, 228, 1, 254, 10, 229, 1, 254, 12, 230, 2, 254, 28, 231, 2, 254},
5644                          {32, 232, 2, 255, 18, 233, 2, 255, 20, 234, 3, 255, 44, 235, 3, 255},
5645                          {48, 236, 3, 255, 26, 237, 3, 255, 28, 238, 4, 255, 60, 239, 4, 255},
5646                          {64, 240, 4, 255, 34, 241, 4, 255, 36, 242, 5, 255, 76, 243, 5, 255},
5647                          {80, 244, 5, 255, 42, 245, 5, 255, 44, 246, 6, 255, 92, 247, 6, 255},
5648                          {96, 248, 6, 0, 50, 249, 6, 0, 52, 250, 7, 0, 108, 251, 7, 0},
5649                          {112, 252, 7, 0, 58, 253, 7, 0, 60, 254, 8, 0, 124, 255, 8, 0}},
5650                         {{0x8100, 0xf830, 0xffc3, 0xfff8, 0xc484, 0xf8b1, 0xff8d, 0xfff9},
5651                          {0x9110, 0xf931, 0xffcb, 0xfff9, 0xcc8c, 0xf9b2, 0xff9d, 0xfffa},
5652                          {0xa120, 0xfa32, 0xffd3, 0xfffa, 0xd494, 0xfab3, 0xffad, 0xfffb},
5653                          {0xb130, 0xfb33, 0xffdb, 0xfffb, 0xdc9c, 0xfbb4, 0xffbd, 0xfffc},
5654                          {0xc140, 0xfc34, 0xffe3, 0xfffc, 0xe4a4, 0xfcb5, 0xffcd, 0xfffd},
5655                          {0xd150, 0xfd35, 0xffeb, 0xfffd, 0xecac, 0xfdb6, 0xffdd, 0xfffe},
5656                          {0xe160, 0xfe36, 0xfff3, 0xfffe, 0xf4b4, 0xfeb7, 0xffed, 0xffff},
5657                          {0xf170, 0xff37, 0xfffb, 0xffff, 0xfcbc, 0xffb8, 0xfffd, 0x0000}},
5658                         {{0x8302'8100, 0xffc3'8343, 0xffff'c585, 0xffff'ff8f},
5659                          {0x9312'9110, 0xffcb'8b4b, 0xffff'cd8d, 0xffff'ff9f},
5660                          {0xa322'a120, 0xffd3'9353, 0xffff'd595, 0xffff'ffaf},
5661                          {0xb332'b130, 0xffdb'9b5b, 0xffff'dd9d, 0xffff'ffbf},
5662                          {0xc342'c140, 0xffe3'a363, 0xffff'e5a5, 0xffff'ffcf},
5663                          {0xd352'd150, 0xffeb'ab6b, 0xffff'edad, 0xffff'ffdf},
5664                          {0xe362'e160, 0xfff3'b373, 0xffff'f5b5, 0xffff'ffef},
5665                          {0xf372'f170, 0xfffb'bb7b, 0xffff'fdbd, 0xffff'ffff}},
5666                         {{0x8706'8504'8302'8100, 0xffff'c787'4686'4585},
5667                          {0xffff'ffff'9716'9515, 0xffff'ffff'ffff'cf8f},
5668                          {0xa726'a524'a322'a120, 0xffff'd797'5696'5595},
5669                          {0xffff'ffff'b736'b535, 0xffff'ffff'ffff'df9f},
5670                          {0xc746'c544'c342'c140, 0xffff'e7a7'66a6'65a5},
5671                          {0xffff'ffff'd756'd555, 0xffff'ffff'ffff'efaf},
5672                          {0xe766'e564'e362'e160, 0xffff'f7b7'76b6'75b5},
5673                          {0xffff'ffff'f776'f575, 0xffff'ffff'ffff'ffbf}},
5674                         kVectorCalculationsSource);
5675 
5676   TestVectorInstruction(ExecVssravx,
5677                         ExecMaskedVssravx,
5678                         {{0, 224, 0, 225, 1, 225, 2, 226, 2, 226, 2, 227, 3, 227, 4, 228},
5679                          {4, 228, 4, 229, 5, 229, 6, 230, 6, 230, 6, 231, 7, 231, 8, 232},
5680                          {8, 232, 8, 233, 9, 233, 10, 234, 10, 234, 10, 235, 11, 235, 12, 236},
5681                          {12, 236, 12, 237, 13, 237, 14, 238, 14, 238, 14, 239, 15, 239, 16, 240},
5682                          {16, 240, 16, 241, 17, 241, 18, 242, 18, 242, 18, 243, 19, 243, 20, 244},
5683                          {20, 244, 20, 245, 21, 245, 22, 246, 22, 246, 22, 247, 23, 247, 24, 248},
5684                          {24, 248, 24, 249, 25, 249, 26, 250, 26, 250, 26, 251, 27, 251, 28, 252},
5685                          {28, 252, 28, 253, 29, 253, 30, 254, 30, 254, 30, 255, 31, 255, 32, 0}},
5686                         {{0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3, 0xffe4},
5687                          {0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7, 0xffe8},
5688                          {0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb, 0xffec},
5689                          {0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef, 0xfff0},
5690                          {0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3, 0xfff4},
5691                          {0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7, 0xfff8},
5692                          {0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb, 0xfffc},
5693                          {0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff, 0x0000}},
5694                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
5695                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
5696                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
5697                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
5698                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
5699                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
5700                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
5701                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
5702                         {{0xffff'ffff'ffe1'c1a1, 0xffff'ffff'ffe3'c3a3},
5703                          {0xffff'ffff'ffe5'c5a5, 0xffff'ffff'ffe7'c7a7},
5704                          {0xffff'ffff'ffe9'c9a9, 0xffff'ffff'ffeb'cbab},
5705                          {0xffff'ffff'ffed'cdad, 0xffff'ffff'ffef'cfaf},
5706                          {0xffff'ffff'fff1'd1b1, 0xffff'ffff'fff3'd3b3},
5707                          {0xffff'ffff'fff5'd5b5, 0xffff'ffff'fff7'd7b7},
5708                          {0xffff'ffff'fff9'd9b9, 0xffff'ffff'fffb'dbbb},
5709                          {0xffff'ffff'fffd'ddbd, 0xffff'ffff'ffff'dfbf}},
5710                         kVectorCalculationsSource);
5711 
5712   TestVectorInstruction(ExecVssravi,
5713                         ExecMaskedVssravi,
5714                         {{0, 224, 0, 225, 1, 225, 2, 226, 2, 226, 2, 227, 3, 227, 4, 228},
5715                          {4, 228, 4, 229, 5, 229, 6, 230, 6, 230, 6, 231, 7, 231, 8, 232},
5716                          {8, 232, 8, 233, 9, 233, 10, 234, 10, 234, 10, 235, 11, 235, 12, 236},
5717                          {12, 236, 12, 237, 13, 237, 14, 238, 14, 238, 14, 239, 15, 239, 16, 240},
5718                          {16, 240, 16, 241, 17, 241, 18, 242, 18, 242, 18, 243, 19, 243, 20, 244},
5719                          {20, 244, 20, 245, 21, 245, 22, 246, 22, 246, 22, 247, 23, 247, 24, 248},
5720                          {24, 248, 24, 249, 25, 249, 26, 250, 26, 250, 26, 251, 27, 251, 28, 252},
5721                          {28, 252, 28, 253, 29, 253, 30, 254, 30, 254, 30, 255, 31, 255, 32, 0}},
5722                         {{0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3, 0xffe4},
5723                          {0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7, 0xffe8},
5724                          {0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb, 0xffec},
5725                          {0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef, 0xfff0},
5726                          {0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3, 0xfff4},
5727                          {0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7, 0xfff8},
5728                          {0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb, 0xfffc},
5729                          {0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff, 0x0000}},
5730                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
5731                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
5732                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
5733                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
5734                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
5735                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
5736                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
5737                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
5738                         {{0xffe1'c1a1'4120'c0a0, 0xffe3'c3a3'4322'c2a2},
5739                          {0xffe5'c5a5'4524'c4a4, 0xffe7'c7a7'4726'c6a6},
5740                          {0xffe9'c9a9'4928'c8a8, 0xffeb'cbab'4b2a'caaa},
5741                          {0xffed'cdad'4d2c'ccac, 0xffef'cfaf'4f2e'ceae},
5742                          {0xfff1'd1b1'5130'd0b0, 0xfff3'd3b3'5332'd2b2},
5743                          {0xfff5'd5b5'5534'd4b4, 0xfff7'd7b7'5736'd6b6},
5744                          {0xfff9'd9b9'5938'd8b8, 0xfffb'dbbb'5b3a'daba},
5745                          {0xfffd'ddbd'5d3c'dcbc, 0xffff'dfbf'5f3e'debe}},
5746                         kVectorCalculationsSource);
5747   asm volatile("csrw vxrm, %0\n\t" ::"r"(vxrm));
5748 }
5749 
TEST(InlineAsmTestRiscv64,TestRNU)5750 TEST(InlineAsmTestRiscv64, TestRNU) {
5751   uint64_t vxrm;
5752   asm volatile(
5753       "csrr %0, vxrm\n\t"
5754       "csrwi vxrm, %c1\n\t"
5755       : "=r"(vxrm)
5756       : "i"(VXRMFlags::RNU));
5757   TestVectorInstruction(
5758       ExecVaadduvv,
5759       ExecMaskedVaadduvv,
5760       {{0, 138, 3, 141, 7, 144, 9, 147, 13, 134, 15, 137, 18, 140, 21, 143},
5761        {24, 162, 27, 165, 31, 168, 33, 171, 37, 158, 39, 161, 42, 164, 45, 167},
5762        {48, 186, 51, 189, 55, 192, 57, 195, 61, 182, 63, 185, 66, 188, 69, 191},
5763        {72, 210, 75, 213, 79, 216, 81, 219, 85, 206, 87, 209, 90, 212, 93, 215},
5764        {96, 106, 99, 109, 103, 112, 105, 115, 109, 102, 111, 105, 114, 108, 117, 111},
5765        {120, 130, 123, 133, 127, 136, 129, 139, 133, 126, 135, 129, 138, 132, 141, 135},
5766        {144, 154, 147, 157, 151, 160, 153, 163, 157, 150, 159, 153, 162, 156, 165, 159},
5767        {168, 178, 171, 181, 175, 184, 177, 187, 181, 174, 183, 177, 186, 180, 189, 183}},
5768       {{0x8980, 0x8c83, 0x8f87, 0x9289, 0x858d, 0x888f, 0x8b92, 0x8e95},
5769        {0xa198, 0xa49b, 0xa79f, 0xaaa1, 0x9da5, 0xa0a7, 0xa3aa, 0xa6ad},
5770        {0xb9b0, 0xbcb3, 0xbfb7, 0xc2b9, 0xb5bd, 0xb8bf, 0xbbc2, 0xbec5},
5771        {0xd1c8, 0xd4cb, 0xd7cf, 0xdad1, 0xcdd5, 0xd0d7, 0xd3da, 0xd6dd},
5772        {0x69e0, 0x6ce3, 0x6fe7, 0x72e9, 0x65ed, 0x68ef, 0x6bf2, 0x6ef5},
5773        {0x81f8, 0x84fb, 0x87ff, 0x8b01, 0x7e05, 0x8107, 0x840a, 0x870d},
5774        {0x9a10, 0x9d13, 0xa017, 0xa319, 0x961d, 0x991f, 0x9c22, 0x9f25},
5775        {0xb228, 0xb52b, 0xb82f, 0xbb31, 0xae35, 0xb137, 0xb43a, 0xb73d}},
5776       {{0x8c83'8980, 0x9289'8f87, 0x888f'858d, 0x8e95'8b92},
5777        {0xa49b'a198, 0xaaa1'a79f, 0xa0a7'9da5, 0xa6ad'a3aa},
5778        {0xbcb3'b9b0, 0xc2b9'bfb7, 0xb8bf'b5bd, 0xbec5'bbc2},
5779        {0xd4cb'd1c8, 0xdad1'd7cf, 0xd0d7'cdd5, 0xd6dd'd3da},
5780        {0x6ce3'69e0, 0x72e9'6fe7, 0x68ef'65ed, 0x6ef5'6bf2},
5781        {0x84fb'81f8, 0x8b01'87ff, 0x8107'7e05, 0x870d'840a},
5782        {0x9d13'9a10, 0xa319'a017, 0x991f'961d, 0x9f25'9c22},
5783        {0xb52b'b228, 0xbb31'b82f, 0xb137'ae35, 0xb73d'b43a}},
5784       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858d},
5785        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da5},
5786        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bd},
5787        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd5},
5788        {0x72e9'6fe6'ece3'69e0, 0x6ef5'6bf2'68ef'65ed},
5789        {0x8b01'87ff'04fb'81f8, 0x870d'840a'8107'7e05},
5790        {0xa319'a017'1d13'9a10, 0x9f25'9c22'991f'961d},
5791        {0xbb31'b82f'352b'b228, 0xb73d'b43a'b137'ae35}},
5792       kVectorCalculationsSource);
5793   TestVectorInstruction(
5794       ExecVaadduvx,
5795       ExecMaskedVaadduvx,
5796       {{85, 150, 86, 151, 87, 152, 88, 153, 89, 154, 90, 155, 91, 156, 92, 157},
5797        {93, 158, 94, 159, 95, 160, 96, 161, 97, 162, 98, 163, 99, 164, 100, 165},
5798        {101, 166, 102, 167, 103, 168, 104, 169, 105, 170, 106, 171, 107, 172, 108, 173},
5799        {109, 174, 110, 175, 111, 176, 112, 177, 113, 178, 114, 179, 115, 180, 116, 181},
5800        {117, 182, 118, 183, 119, 184, 120, 185, 121, 186, 122, 187, 123, 188, 124, 189},
5801        {125, 190, 126, 191, 127, 192, 128, 193, 129, 194, 130, 195, 131, 196, 132, 197},
5802        {133, 198, 134, 199, 135, 200, 136, 201, 137, 202, 138, 203, 139, 204, 140, 205},
5803        {141, 206, 142, 207, 143, 208, 144, 209, 145, 210, 146, 211, 147, 212, 148, 213}},
5804       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
5805        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
5806        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
5807        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
5808        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
5809        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
5810        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
5811        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
5812       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
5813        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
5814        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
5815        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
5816        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
5817        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
5818        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
5819        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
5820       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
5821        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
5822        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
5823        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
5824        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
5825        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
5826        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
5827        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
5828       kVectorCalculationsSource);
5829   TestVectorInstruction(
5830       ExecVaaddvv,
5831       ExecMaskedVaaddvv,
5832       {{0, 138, 3, 141, 7, 144, 9, 147, 13, 134, 15, 137, 18, 140, 21, 143},
5833        {24, 162, 27, 165, 31, 168, 33, 171, 37, 158, 39, 161, 42, 164, 45, 167},
5834        {48, 186, 51, 189, 55, 192, 57, 195, 61, 182, 63, 185, 66, 188, 69, 191},
5835        {72, 210, 75, 213, 79, 216, 81, 219, 85, 206, 87, 209, 90, 212, 93, 215},
5836        {224, 234, 227, 237, 231, 240, 233, 243, 237, 230, 239, 233, 242, 236, 245, 239},
5837        {248, 2, 251, 5, 255, 8, 1, 11, 5, 254, 7, 1, 10, 4, 13, 7},
5838        {16, 26, 19, 29, 23, 32, 25, 35, 29, 22, 31, 25, 34, 28, 37, 31},
5839        {40, 50, 43, 53, 47, 56, 49, 59, 53, 46, 55, 49, 58, 52, 61, 55}},
5840       {{0x8980, 0x8c83, 0x8f87, 0x9289, 0x858d, 0x888f, 0x8b92, 0x8e95},
5841        {0xa198, 0xa49b, 0xa79f, 0xaaa1, 0x9da5, 0xa0a7, 0xa3aa, 0xa6ad},
5842        {0xb9b0, 0xbcb3, 0xbfb7, 0xc2b9, 0xb5bd, 0xb8bf, 0xbbc2, 0xbec5},
5843        {0xd1c8, 0xd4cb, 0xd7cf, 0xdad1, 0xcdd5, 0xd0d7, 0xd3da, 0xd6dd},
5844        {0xe9e0, 0xece3, 0xefe7, 0xf2e9, 0xe5ed, 0xe8ef, 0xebf2, 0xeef5},
5845        {0x01f8, 0x04fb, 0x07ff, 0x0b01, 0xfe05, 0x0107, 0x040a, 0x070d},
5846        {0x1a10, 0x1d13, 0x2017, 0x2319, 0x161d, 0x191f, 0x1c22, 0x1f25},
5847        {0x3228, 0x352b, 0x382f, 0x3b31, 0x2e35, 0x3137, 0x343a, 0x373d}},
5848       {{0x8c83'8980, 0x9289'8f87, 0x888f'858d, 0x8e95'8b92},
5849        {0xa49b'a198, 0xaaa1'a79f, 0xa0a7'9da5, 0xa6ad'a3aa},
5850        {0xbcb3'b9b0, 0xc2b9'bfb7, 0xb8bf'b5bd, 0xbec5'bbc2},
5851        {0xd4cb'd1c8, 0xdad1'd7cf, 0xd0d7'cdd5, 0xd6dd'd3da},
5852        {0xece3'69e0, 0xf2e9'6fe7, 0xe8ef'65ed, 0xeef5'6bf2},
5853        {0x04fb'81f8, 0x0b01'87ff, 0x0107'7e05, 0x070d'840a},
5854        {0x1d13'9a10, 0x2319'a017, 0x191f'961d, 0x1f25'9c22},
5855        {0x352b'b228, 0x3b31'b82f, 0x3137'ae35, 0x373d'b43a}},
5856       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858d},
5857        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da5},
5858        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bd},
5859        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd5},
5860        {0xf2e9'6fe6'ece3'69e0, 0xeef5'6bf2'68ef'65ed},
5861        {0x0b01'87ff'04fb'81f8, 0x070d'840a'8107'7e05},
5862        {0x2319'a017'1d13'9a10, 0x1f25'9c22'991f'961d},
5863        {0x3b31'b82f'352b'b228, 0x373d'b43a'b137'ae35}},
5864       kVectorCalculationsSource);
5865   TestVectorInstruction(
5866       ExecVaaddvx,
5867       ExecMaskedVaaddvx,
5868       {{213, 150, 214, 151, 215, 152, 216, 153, 217, 154, 218, 155, 219, 156, 220, 157},
5869        {221, 158, 222, 159, 223, 160, 224, 161, 225, 162, 226, 163, 227, 164, 228, 165},
5870        {229, 166, 230, 167, 231, 168, 232, 169, 233, 170, 234, 171, 235, 172, 236, 173},
5871        {237, 174, 238, 175, 239, 176, 240, 177, 241, 178, 242, 179, 243, 180, 244, 181},
5872        {245, 182, 246, 183, 247, 184, 248, 185, 249, 186, 250, 187, 251, 188, 252, 189},
5873        {253, 190, 254, 191, 255, 192, 0, 193, 1, 194, 2, 195, 3, 196, 4, 197},
5874        {5, 198, 6, 199, 7, 200, 8, 201, 9, 202, 10, 203, 11, 204, 12, 205},
5875        {13, 206, 14, 207, 15, 208, 16, 209, 17, 210, 18, 211, 19, 212, 20, 213}},
5876       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
5877        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
5878        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
5879        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
5880        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
5881        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
5882        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
5883        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
5884       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
5885        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
5886        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
5887        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
5888        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
5889        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
5890        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
5891        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
5892       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
5893        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
5894        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
5895        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
5896        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
5897        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
5898        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
5899        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
5900       kVectorCalculationsSource);
5901   TestVectorInstruction(
5902       ExecVasubuvv,
5903       ExecMaskedVasubuvv,
5904       {{0, 248, 255, 247, 254, 246, 253, 245, 252, 4, 251, 3, 250, 2, 249, 1},
5905        {248, 240, 247, 239, 246, 238, 245, 237, 244, 252, 243, 251, 242, 250, 241, 249},
5906        {240, 232, 239, 231, 238, 230, 237, 229, 236, 244, 235, 243, 234, 242, 233, 241},
5907        {232, 224, 231, 223, 230, 222, 229, 221, 228, 236, 227, 235, 226, 234, 225, 233},
5908        {224, 88, 223, 87, 222, 86, 221, 85, 220, 100, 219, 99, 218, 98, 217, 97},
5909        {216, 80, 215, 79, 214, 78, 213, 77, 212, 92, 211, 91, 210, 90, 209, 89},
5910        {208, 72, 207, 71, 206, 70, 205, 69, 204, 84, 203, 83, 202, 82, 201, 81},
5911        {200, 64, 199, 63, 198, 62, 197, 61, 196, 76, 195, 75, 194, 74, 193, 73}},
5912       {{0xf780, 0xf67f, 0xf57e, 0xf47d, 0x037c, 0x027b, 0x017a, 0x0079},
5913        {0xef78, 0xee77, 0xed76, 0xec75, 0xfb74, 0xfa73, 0xf972, 0xf871},
5914        {0xe770, 0xe66f, 0xe56e, 0xe46d, 0xf36c, 0xf26b, 0xf16a, 0xf069},
5915        {0xdf68, 0xde67, 0xdd66, 0xdc65, 0xeb64, 0xea63, 0xe962, 0xe861},
5916        {0x5760, 0x565f, 0x555e, 0x545d, 0x635c, 0x625b, 0x615a, 0x6059},
5917        {0x4f58, 0x4e57, 0x4d56, 0x4c55, 0x5b54, 0x5a53, 0x5952, 0x5851},
5918        {0x4750, 0x464f, 0x454e, 0x444d, 0x534c, 0x524b, 0x514a, 0x5049},
5919        {0x3f48, 0x3e47, 0x3d46, 0x3c45, 0x4b44, 0x4a43, 0x4942, 0x4841}},
5920       {{0xf67e'f780, 0xf47c'f57e, 0x027b'037c, 0x0079'017a},
5921        {0xee76'ef78, 0xec74'ed76, 0xfa72'fb74, 0xf870'f972},
5922        {0xe66e'e770, 0xe46c'e56e, 0xf26a'f36c, 0xf068'f16a},
5923        {0xde66'df68, 0xdc64'dd66, 0xea62'eb64, 0xe860'e962},
5924        {0x565f'5760, 0x545d'555e, 0x625b'635c, 0x6059'615a},
5925        {0x4e57'4f58, 0x4c55'4d56, 0x5a53'5b54, 0x5851'5952},
5926        {0x464f'4750, 0x444d'454e, 0x524b'534c, 0x5049'514a},
5927        {0x3e47'3f48, 0x3c45'3d46, 0x4a43'4b44, 0x4841'4942}},
5928       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037c},
5929        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb74},
5930        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36c},
5931        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb64},
5932        {0x545d'555d'd65f'5760, 0x6059'615a'625b'635c},
5933        {0x4c55'4d55'ce57'4f58, 0x5851'5952'5a53'5b54},
5934        {0x444d'454d'c64f'4750, 0x5049'514a'524b'534c},
5935        {0x3c45'3d45'be47'3f48, 0x4841'4942'4a43'4b44}},
5936       kVectorCalculationsSource);
5937   TestVectorInstruction(
5938       ExecVasubuvx,
5939       ExecMaskedVasubuvx,
5940       {{171, 236, 172, 237, 173, 238, 174, 239, 175, 240, 176, 241, 177, 242, 178, 243},
5941        {179, 244, 180, 245, 181, 246, 182, 247, 183, 248, 184, 249, 185, 250, 186, 251},
5942        {187, 252, 188, 253, 189, 254, 190, 255, 191, 0, 192, 1, 193, 2, 194, 3},
5943        {195, 4, 196, 5, 197, 6, 198, 7, 199, 8, 200, 9, 201, 10, 202, 11},
5944        {203, 12, 204, 13, 205, 14, 206, 15, 207, 16, 208, 17, 209, 18, 210, 19},
5945        {211, 20, 212, 21, 213, 22, 214, 23, 215, 24, 216, 25, 217, 26, 218, 27},
5946        {219, 28, 220, 29, 221, 30, 222, 31, 223, 32, 224, 33, 225, 34, 226, 35},
5947        {227, 36, 228, 37, 229, 38, 230, 39, 231, 40, 232, 41, 233, 42, 234, 43}},
5948       {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
5949        {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
5950        {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
5951        {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
5952        {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
5953        {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
5954        {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
5955        {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
5956       {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
5957        {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
5958        {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
5959        {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
5960        {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
5961        {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
5962        {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
5963        {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
5964       {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
5965        {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
5966        {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
5967        {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
5968        {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
5969        {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
5970        {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
5971        {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
5972       kVectorCalculationsSource);
5973   TestVectorInstruction(
5974       ExecVasubvv,
5975       ExecMaskedVasubvv,
5976       {{0, 248, 255, 247, 254, 246, 253, 245, 252, 4, 251, 3, 250, 2, 249, 1},
5977        {248, 240, 247, 239, 246, 238, 245, 237, 244, 252, 243, 251, 242, 250, 241, 249},
5978        {240, 232, 239, 231, 238, 230, 237, 229, 236, 244, 235, 243, 234, 242, 233, 241},
5979        {232, 224, 231, 223, 230, 222, 229, 221, 228, 236, 227, 235, 226, 234, 225, 233},
5980        {96, 216, 95, 215, 94, 214, 93, 213, 92, 228, 91, 227, 90, 226, 89, 225},
5981        {88, 208, 87, 207, 86, 206, 85, 205, 84, 220, 83, 219, 82, 218, 81, 217},
5982        {80, 200, 79, 199, 78, 198, 77, 197, 76, 212, 75, 211, 74, 210, 73, 209},
5983        {72, 192, 71, 191, 70, 190, 69, 189, 68, 204, 67, 203, 66, 202, 65, 201}},
5984       {{0xf780, 0xf67f, 0xf57e, 0xf47d, 0x037c, 0x027b, 0x017a, 0x0079},
5985        {0xef78, 0xee77, 0xed76, 0xec75, 0xfb74, 0xfa73, 0xf972, 0xf871},
5986        {0xe770, 0xe66f, 0xe56e, 0xe46d, 0xf36c, 0xf26b, 0xf16a, 0xf069},
5987        {0xdf68, 0xde67, 0xdd66, 0xdc65, 0xeb64, 0xea63, 0xe962, 0xe861},
5988        {0xd760, 0xd65f, 0xd55e, 0xd45d, 0xe35c, 0xe25b, 0xe15a, 0xe059},
5989        {0xcf58, 0xce57, 0xcd56, 0xcc55, 0xdb54, 0xda53, 0xd952, 0xd851},
5990        {0xc750, 0xc64f, 0xc54e, 0xc44d, 0xd34c, 0xd24b, 0xd14a, 0xd049},
5991        {0xbf48, 0xbe47, 0xbd46, 0xbc45, 0xcb44, 0xca43, 0xc942, 0xc841}},
5992       {{0xf67e'f780, 0xf47c'f57e, 0x027b'037c, 0x0079'017a},
5993        {0xee76'ef78, 0xec74'ed76, 0xfa72'fb74, 0xf870'f972},
5994        {0xe66e'e770, 0xe46c'e56e, 0xf26a'f36c, 0xf068'f16a},
5995        {0xde66'df68, 0xdc64'dd66, 0xea62'eb64, 0xe860'e962},
5996        {0xd65f'5760, 0xd45d'555e, 0xe25b'635c, 0xe059'615a},
5997        {0xce57'4f58, 0xcc55'4d56, 0xda53'5b54, 0xd851'5952},
5998        {0xc64f'4750, 0xc44d'454e, 0xd24b'534c, 0xd049'514a},
5999        {0xbe47'3f48, 0xbc45'3d46, 0xca43'4b44, 0xc841'4942}},
6000       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037c},
6001        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb74},
6002        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36c},
6003        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb64},
6004        {0xd45d'555d'd65f'5760, 0xe059'615a'625b'635c},
6005        {0xcc55'4d55'ce57'4f58, 0xd851'5952'5a53'5b54},
6006        {0xc44d'454d'c64f'4750, 0xd049'514a'524b'534c},
6007        {0xbc45'3d45'be47'3f48, 0xc841'4942'4a43'4b44}},
6008       kVectorCalculationsSource);
6009   TestVectorInstruction(ExecVasubvx,
6010                         ExecMaskedVasubvx,
6011                         {{43, 236, 44, 237, 45, 238, 46, 239, 47, 240, 48, 241, 49, 242, 50, 243},
6012                          {51, 244, 52, 245, 53, 246, 54, 247, 55, 248, 56, 249, 57, 250, 58, 251},
6013                          {59, 252, 60, 253, 61, 254, 62, 255, 63, 0, 64, 1, 65, 2, 66, 3},
6014                          {67, 4, 68, 5, 69, 6, 70, 7, 71, 8, 72, 9, 73, 10, 74, 11},
6015                          {75, 12, 76, 13, 77, 14, 78, 15, 79, 16, 80, 17, 81, 18, 82, 19},
6016                          {83, 20, 84, 21, 85, 22, 86, 23, 87, 24, 88, 25, 89, 26, 90, 27},
6017                          {91, 28, 92, 29, 93, 30, 94, 31, 95, 32, 96, 33, 97, 34, 98, 35},
6018                          {99, 36, 100, 37, 101, 38, 102, 39, 103, 40, 104, 41, 105, 42, 106, 43}},
6019                         {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
6020                          {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
6021                          {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
6022                          {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
6023                          {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
6024                          {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
6025                          {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
6026                          {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
6027                         {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
6028                          {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
6029                          {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
6030                          {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
6031                          {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
6032                          {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
6033                          {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
6034                          {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
6035                         {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
6036                          {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
6037                          {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
6038                          {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
6039                          {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
6040                          {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
6041                          {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
6042                          {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
6043                         kVectorCalculationsSource);
6044   TestNarrowingVectorInstruction(ExecVnclipuwi,
6045                                  ExecMaskedVnclipuwi,
6046                                  {{32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40},
6047                                   {40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48},
6048                                   {48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56},
6049                                   {56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64}},
6050                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6051                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6052                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6053                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
6054                                  {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6055                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6056                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6057                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
6058                                  kVectorCalculationsSource);
6059   TestNarrowingVectorInstruction(
6060       ExecVnclipwi,
6061       ExecMaskedVnclipwi,
6062       {{224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232},
6063        {232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240},
6064        {240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248},
6065        {248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, 0}},
6066       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6067        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6068        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6069        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
6070       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6071        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6072        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6073        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000}},
6074       kVectorCalculationsSource);
6075 
6076   TestNarrowingVectorInstruction(ExecVnclipuwx,
6077                                  ExecMaskedVnclipuwx,
6078                                  {{32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40},
6079                                   {40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48},
6080                                   {48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56},
6081                                   {56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64}},
6082                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6083                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6084                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6085                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
6086                                  {{0x0021'c1a1, 0x0023'c3a3, 0x0025'c5a5, 0x0027'c7a7},
6087                                   {0x0029'c9a9, 0x002b'cbab, 0x002d'cdad, 0x002f'cfaf},
6088                                   {0x0031'd1b1, 0x0033'd3b3, 0x0035'd5b5, 0x0037'd7b7},
6089                                   {0x0039'd9b9, 0x003b'dbbb, 0x003d'ddbd, 0x003f'dfbf}},
6090                                  kVectorCalculationsSource);
6091 
6092   TestNarrowingVectorInstruction(
6093       ExecVnclipwx,
6094       ExecMaskedVnclipwx,
6095       {{224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232},
6096        {232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240},
6097        {240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248},
6098        {248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, 0}},
6099       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6100        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6101        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6102        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
6103       {{0xffe1'c1a1, 0xffe3'c3a3, 0xffe5'c5a5, 0xffe7'c7a7},
6104        {0xffe9'c9a9, 0xffeb'cbab, 0xffed'cdad, 0xffef'cfaf},
6105        {0xfff1'd1b1, 0xfff3'd3b3, 0xfff5'd5b5, 0xfff7'd7b7},
6106        {0xfff9'd9b9, 0xfffb'dbbb, 0xfffd'ddbd, 0xffff'dfbf}},
6107       kVectorCalculationsSource);
6108 
6109   TestNarrowingVectorInstruction(
6110       ExecVnclipuwv,
6111       ExecMaskedVnclipuwv,
6112       {{255, 255, 255, 255, 69, 35, 9, 2, 255, 255, 255, 255, 153, 39, 10, 2},
6113        {255, 255, 255, 255, 85, 43, 11, 3, 255, 255, 255, 255, 185, 47, 12, 3},
6114        {255, 255, 255, 255, 101, 51, 13, 3, 255, 255, 255, 255, 217, 55, 14, 3},
6115        {255, 255, 255, 255, 117, 59, 15, 4, 255, 255, 255, 255, 249, 63, 16, 4}},
6116       {{0xffff, 0xffff, 0xffff, 0xffff, 0x4989, 0x0971, 0x009b, 0x000a},
6117        {0xffff, 0xffff, 0xffff, 0xffff, 0x5999, 0x0b73, 0x00bb, 0x000c},
6118        {0xffff, 0xffff, 0xffff, 0xffff, 0x69a9, 0x0d75, 0x00db, 0x000e},
6119        {0xffff, 0xffff, 0xffff, 0xffff, 0x79b9, 0x0f77, 0x00fb, 0x0010}},
6120       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6121        {0xa726'a525, 0x0057'9757, 0x0000'5b9b, 0x0000'00bf},
6122        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6123        {0xe766'e565, 0x0077'b777, 0x0000'7bbb, 0x0000'00ff}},
6124       kVectorCalculationsSource);
6125 
6126   TestNarrowingVectorInstruction(
6127       ExecVnclipwv,
6128       ExecMaskedVnclipwv,
6129       {{128, 128, 128, 128, 197, 227, 249, 254, 128, 128, 128, 128, 153, 231, 250, 254},
6130        {128, 128, 128, 128, 213, 235, 251, 255, 128, 128, 128, 128, 185, 239, 252, 255},
6131        {128, 128, 128, 128, 229, 243, 253, 255, 128, 128, 128, 128, 217, 247, 254, 255},
6132        {128, 128, 128, 158, 245, 251, 255, 0, 128, 128, 128, 222, 249, 255, 0, 0}},
6133       {{0x8000, 0x8000, 0x8000, 0x8000, 0xc989, 0xf971, 0xff9b, 0xfffa},
6134        {0x8000, 0x8000, 0x8000, 0x8000, 0xd999, 0xfb73, 0xffbb, 0xfffc},
6135        {0x8000, 0x8000, 0x8000, 0x8000, 0xe9a9, 0xfd75, 0xffdb, 0xfffe},
6136        {0x8000, 0x8000, 0x8000, 0x8000, 0xf9b9, 0xff77, 0xfffb, 0x0000}},
6137       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6138        {0xa726'a525, 0xffd7'9757, 0xffff'db9b, 0xffff'ffbf},
6139        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6140        {0xe766'e565, 0xfff7'b777, 0xffff'fbbb, 0xffff'ffff}},
6141       kVectorCalculationsSource);
6142 
6143   TestVectorInstruction(
6144       ExecVsmulvv,
6145       ExecMaskedVsmulvv,
6146       {{0, 109, 0, 104, 0, 98, 1, 93, 1, 117, 2, 112, 2, 106, 3, 101},
6147        {4, 68, 5, 63, 6, 59, 8, 54, 9, 76, 11, 71, 12, 67, 14, 62},
6148        {16, 34, 18, 31, 21, 27, 23, 24, 25, 42, 28, 39, 30, 35, 33, 32},
6149        {36, 9, 39, 6, 43, 4, 46, 1, 49, 17, 53, 14, 56, 12, 60, 9},
6150        {192, 247, 192, 246, 193, 244, 193, 243, 194, 255, 194, 254, 194, 252, 195, 251},
6151        {196, 238, 197, 237, 199, 237, 200, 236, 202, 246, 203, 245, 204, 245, 206, 244},
6152        {208, 236, 210, 237, 213, 237, 215, 238, 218, 244, 220, 245, 222, 245, 225, 246},
6153        {228, 243, 231, 244, 235, 246, 238, 247, 242, 251, 245, 252, 248, 254, 252, 255}},
6154       {{0x6d24, 0x677e, 0x61f8, 0x5c94, 0x750c, 0x6f68, 0x69e3, 0x647f},
6155        {0x437f, 0x3edb, 0x3a57, 0x35f5, 0x4b6b, 0x46c9, 0x4246, 0x3de3},
6156        {0x21e9, 0x1e48, 0x1ac5, 0x1765, 0x29da, 0x2639, 0x22b8, 0x1f58},
6157        {0x0864, 0x05c4, 0x0344, 0x00e6, 0x1058, 0x0dba, 0x0b3b, 0x08dd},
6158        {0xf6ee, 0xf551, 0xf3d3, 0xf276, 0xfee7, 0xfd4b, 0xfbce, 0xfa71},
6159        {0xed89, 0xeced, 0xec72, 0xec17, 0xf586, 0xf4eb, 0xf470, 0xf416},
6160        {0xec34, 0xec9a, 0xed21, 0xedc8, 0xf435, 0xf49c, 0xf523, 0xf5cb},
6161        {0xf2ee, 0xf457, 0xf5df, 0xf788, 0xfaf4, 0xfc5d, 0xfde6, 0xff8f}},
6162       {{0x677d'76af, 0x5c93'1931, 0x6f67'3831, 0x647d'dbb7},
6163        {0x3eda'09c6, 0x35f3'b250, 0x46c7'cf50, 0x3de2'78de},
6164        {0x1e46'b4fd, 0x1764'6390, 0x2638'7e90, 0x1f57'2e25},
6165        {0x05c3'7855, 0x00e5'2cef, 0x0db9'45ef, 0x08db'fb8d},
6166        {0xf550'cd47, 0xf276'7fe1, 0xfd4a'8eda, 0xfa71'4277},
6167        {0xeced'a0be, 0xec17'5961, 0xf4eb'6659, 0xf416'1ffe},
6168        {0xec9a'8c56, 0xedc8'4b01, 0xf49c'55f9, 0xf5cb'15a6},
6169        {0xf457'900e, 0xf789'54c1, 0xfc5d'5db9, 0xff90'236e}},
6170       {{0x5c93'192f'ccd4'7781, 0x647d'dbb5'bb66'23af},
6171        {0x35f3'b24f'43d0'aa38, 0x3de2'78dd'1a4e'4256},
6172        {0x1764'638e'e2fd'152f, 0x1f57'2e24'a166'993d},
6173        {0x00e5'2cee'aa59'b866, 0x08db'fb8c'50af'2865},
6174        {0xf276'7fe1'80cf'f441, 0xfa71'4276'eef1'1fff},
6175        {0xec17'5961'584c'a799, 0xf416'1ffe'ae59'bf47},
6176        {0xedc8'4b01'57f9'9330, 0xf5cb'15a6'95f2'96cf},
6177        {0xf789'54c1'7fd6'b708, 0xff90'236e'a5bb'a696}},
6178       kVectorCalculationsSource);
6179   TestVectorInstruction(ExecVsmulvx,
6180                         ExecMaskedVsmulvx,
6181                         {{0, 85, 255, 84, 253, 83, 252, 81, 251, 80, 249, 79, 248, 77, 247, 76},
6182                          {245, 75, 244, 73, 243, 72, 241, 71, 240, 69, 239, 68, 237, 67, 236, 65},
6183                          {235, 64, 233, 62, 232, 61, 230, 60, 229, 58, 228, 57, 226, 56, 225, 54},
6184                          {224, 53, 222, 52, 221, 50, 220, 49, 218, 48, 217, 46, 216, 45, 214, 44},
6185                          {213, 42, 212, 41, 210, 40, 209, 38, 208, 37, 206, 36, 205, 34, 204, 33},
6186                          {202, 32, 201, 30, 200, 29, 198, 28, 197, 26, 196, 25, 194, 24, 193, 22},
6187                          {192, 21, 190, 19, 189, 18, 187, 17, 186, 15, 185, 14, 183, 13, 182, 11},
6188                          {181, 10, 179, 9, 178, 7, 177, 6, 175, 5, 174, 3, 173, 2, 171, 1}},
6189                         {{0x54ab, 0x5355, 0x51fe, 0x50a7, 0x4f51, 0x4dfa, 0x4ca3, 0x4b4d},
6190                          {0x49f6, 0x489f, 0x4749, 0x45f2, 0x449b, 0x4345, 0x41ee, 0x4097},
6191                          {0x3f40, 0x3dea, 0x3c93, 0x3b3c, 0x39e6, 0x388f, 0x3738, 0x35e2},
6192                          {0x348b, 0x3334, 0x31de, 0x3087, 0x2f30, 0x2dda, 0x2c83, 0x2b2c},
6193                          {0x29d6, 0x287f, 0x2728, 0x25d2, 0x247b, 0x2324, 0x21ce, 0x2077},
6194                          {0x1f20, 0x1dca, 0x1c73, 0x1b1c, 0x19c6, 0x186f, 0x1718, 0x15c2},
6195                          {0x146b, 0x1314, 0x11bd, 0x1067, 0x0f10, 0x0db9, 0x0c63, 0x0b0c},
6196                          {0x09b5, 0x085f, 0x0708, 0x05b1, 0x045b, 0x0304, 0x01ad, 0x0057}},
6197                         {{0x5353'aa01, 0x50a6'51fe, 0x4df8'f9fb, 0x4b4b'a1f9},
6198                          {0x489e'49f6, 0x45f0'f1f3, 0x4343'99f1, 0x4096'41ee},
6199                          {0x3de8'e9eb, 0x3b3b'91e8, 0x388e'39e6, 0x35e0'e1e3},
6200                          {0x3333'89e0, 0x3086'31de, 0x2dd8'd9db, 0x2b2b'81d8},
6201                          {0x287e'29d6, 0x25d0'd1d3, 0x2323'79d0, 0x2076'21ce},
6202                          {0x1dc8'c9cb, 0x1b1b'71c8, 0x186e'19c6, 0x15c0'c1c3},
6203                          {0x1313'69c0, 0x1066'11bd, 0x0db8'b9bb, 0x0b0b'61b8},
6204                          {0x085e'09b5, 0x05b0'b1b3, 0x0303'59b0, 0x0056'01ad}},
6205                         {{0x50a6'51fc'fdfe'54ab, 0x4b4b'a1f7'a34e'4f51},
6206                          {0x45f0'f1f2'489e'49f6, 0x4096'41ec'edee'449b},
6207                          {0x3b3b'91e7'933e'3f40, 0x35e0'e1e2'388e'39e6},
6208                          {0x3086'31dc'ddde'348b, 0x2b2b'81d7'832e'2f30},
6209                          {0x25d0'd1d2'287e'29d6, 0x2076'21cc'cdce'247b},
6210                          {0x1b1b'71c7'731e'1f20, 0x15c0'c1c2'186e'19c6},
6211                          {0x1066'11bc'bdbe'146b, 0x0b0b'61b7'630e'0f10},
6212                          {0x05b0'b1b2'085e'09b5, 0x0056'01ac'adae'045b}},
6213                         kVectorCalculationsSource);
6214 
6215   TestVectorInstruction(ExecVssrlvv,
6216                         ExecMaskedVssrlvv,
6217                         {{0, 32, 0, 2, 2, 33, 0, 2, 4, 34, 1, 2, 12, 35, 1, 2},
6218                          {16, 36, 1, 2, 10, 37, 1, 2, 12, 38, 2, 2, 28, 39, 2, 2},
6219                          {32, 40, 2, 3, 18, 41, 2, 3, 20, 42, 3, 3, 44, 43, 3, 3},
6220                          {48, 44, 3, 3, 26, 45, 3, 3, 28, 46, 4, 3, 60, 47, 4, 3},
6221                          {64, 48, 4, 3, 34, 49, 4, 3, 36, 50, 5, 3, 76, 51, 5, 3},
6222                          {80, 52, 5, 3, 42, 53, 5, 3, 44, 54, 6, 3, 92, 55, 6, 3},
6223                          {96, 56, 6, 4, 50, 57, 6, 4, 52, 58, 7, 4, 108, 59, 7, 4},
6224                          {112, 60, 7, 4, 58, 61, 7, 4, 60, 62, 8, 4, 124, 63, 8, 4}},
6225                         {{0x8100, 0x0830, 0x0043, 0x0008, 0x4484, 0x08b1, 0x008d, 0x0009},
6226                          {0x9110, 0x0931, 0x004b, 0x0009, 0x4c8c, 0x09b2, 0x009d, 0x000a},
6227                          {0xa120, 0x0a32, 0x0053, 0x000a, 0x5494, 0x0ab3, 0x00ad, 0x000b},
6228                          {0xb130, 0x0b33, 0x005b, 0x000b, 0x5c9c, 0x0bb4, 0x00bd, 0x000c},
6229                          {0xc140, 0x0c34, 0x0063, 0x000c, 0x64a4, 0x0cb5, 0x00cd, 0x000d},
6230                          {0xd150, 0x0d35, 0x006b, 0x000d, 0x6cac, 0x0db6, 0x00dd, 0x000e},
6231                          {0xe160, 0x0e36, 0x0073, 0x000e, 0x74b4, 0x0eb7, 0x00ed, 0x000f},
6232                          {0xf170, 0x0f37, 0x007b, 0x000f, 0x7cbc, 0x0fb8, 0x00fd, 0x0010}},
6233                         {{0x8302'8100, 0x0043'8343, 0x0000'4585, 0x0000'008f},
6234                          {0x9312'9110, 0x004b'8b4b, 0x0000'4d8d, 0x0000'009f},
6235                          {0xa322'a120, 0x0053'9353, 0x0000'5595, 0x0000'00af},
6236                          {0xb332'b130, 0x005b'9b5b, 0x0000'5d9d, 0x0000'00bf},
6237                          {0xc342'c140, 0x0063'a363, 0x0000'65a5, 0x0000'00cf},
6238                          {0xd352'd150, 0x006b'ab6b, 0x0000'6dad, 0x0000'00df},
6239                          {0xe362'e160, 0x0073'b373, 0x0000'75b5, 0x0000'00ef},
6240                          {0xf372'f170, 0x007b'bb7b, 0x0000'7dbd, 0x0000'00ff}},
6241                         {{0x8706'8504'8302'8100, 0x0000'4787'4686'4585},
6242                          {0x0000'0000'9716'9515, 0x0000'0000'0000'4f8f},
6243                          {0xa726'a524'a322'a120, 0x0000'5797'5696'5595},
6244                          {0x0000'0000'b736'b535, 0x0000'0000'0000'5f9f},
6245                          {0xc746'c544'c342'c140, 0x0000'67a7'66a6'65a5},
6246                          {0x0000'0000'd756'd555, 0x0000'0000'0000'6faf},
6247                          {0xe766'e564'e362'e160, 0x0000'77b7'76b6'75b5},
6248                          {0x0000'0000'f776'f575, 0x0000'0000'0000'7fbf}},
6249                         kVectorCalculationsSource);
6250 
6251   TestVectorInstruction(ExecVssrlvx,
6252                         ExecMaskedVssrlvx,
6253                         {{0, 32, 1, 33, 1, 33, 2, 34, 2, 34, 3, 35, 3, 35, 4, 36},
6254                          {4, 36, 5, 37, 5, 37, 6, 38, 6, 38, 7, 39, 7, 39, 8, 40},
6255                          {8, 40, 9, 41, 9, 41, 10, 42, 10, 42, 11, 43, 11, 43, 12, 44},
6256                          {12, 44, 13, 45, 13, 45, 14, 46, 14, 46, 15, 47, 15, 47, 16, 48},
6257                          {16, 48, 17, 49, 17, 49, 18, 50, 18, 50, 19, 51, 19, 51, 20, 52},
6258                          {20, 52, 21, 53, 21, 53, 22, 54, 22, 54, 23, 55, 23, 55, 24, 56},
6259                          {24, 56, 25, 57, 25, 57, 26, 58, 26, 58, 27, 59, 27, 59, 28, 60},
6260                          {28, 60, 29, 61, 29, 61, 30, 62, 30, 62, 31, 63, 31, 63, 32, 64}},
6261                         {{0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x0024},
6262                          {0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027, 0x0028},
6263                          {0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b, 0x002c},
6264                          {0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f, 0x0030},
6265                          {0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033, 0x0034},
6266                          {0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037, 0x0038},
6267                          {0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b, 0x003c},
6268                          {0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f, 0x0040}},
6269                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
6270                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
6271                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
6272                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
6273                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
6274                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
6275                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
6276                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
6277                         {{0x0000'0000'0021'c1a1, 0x0000'0000'0023'c3a3},
6278                          {0x0000'0000'0025'c5a5, 0x0000'0000'0027'c7a7},
6279                          {0x0000'0000'0029'c9a9, 0x0000'0000'002b'cbab},
6280                          {0x0000'0000'002d'cdad, 0x0000'0000'002f'cfaf},
6281                          {0x0000'0000'0031'd1b1, 0x0000'0000'0033'd3b3},
6282                          {0x0000'0000'0035'd5b5, 0x0000'0000'0037'd7b7},
6283                          {0x0000'0000'0039'd9b9, 0x0000'0000'003b'dbbb},
6284                          {0x0000'0000'003d'ddbd, 0x0000'0000'003f'dfbf}},
6285                         kVectorCalculationsSource);
6286 
6287   TestVectorInstruction(ExecVssrlvi,
6288                         ExecMaskedVssrlvi,
6289                         {{0, 32, 1, 33, 1, 33, 2, 34, 2, 34, 3, 35, 3, 35, 4, 36},
6290                          {4, 36, 5, 37, 5, 37, 6, 38, 6, 38, 7, 39, 7, 39, 8, 40},
6291                          {8, 40, 9, 41, 9, 41, 10, 42, 10, 42, 11, 43, 11, 43, 12, 44},
6292                          {12, 44, 13, 45, 13, 45, 14, 46, 14, 46, 15, 47, 15, 47, 16, 48},
6293                          {16, 48, 17, 49, 17, 49, 18, 50, 18, 50, 19, 51, 19, 51, 20, 52},
6294                          {20, 52, 21, 53, 21, 53, 22, 54, 22, 54, 23, 55, 23, 55, 24, 56},
6295                          {24, 56, 25, 57, 25, 57, 26, 58, 26, 58, 27, 59, 27, 59, 28, 60},
6296                          {28, 60, 29, 61, 29, 61, 30, 62, 30, 62, 31, 63, 31, 63, 32, 64}},
6297                         {{0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x0024},
6298                          {0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027, 0x0028},
6299                          {0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b, 0x002c},
6300                          {0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f, 0x0030},
6301                          {0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033, 0x0034},
6302                          {0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037, 0x0038},
6303                          {0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b, 0x003c},
6304                          {0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f, 0x0040}},
6305                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
6306                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
6307                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
6308                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
6309                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
6310                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
6311                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
6312                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
6313                         {{0x0021'c1a1'4120'c0a0, 0x0023'c3a3'4322'c2a2},
6314                          {0x0025'c5a5'4524'c4a4, 0x0027'c7a7'4726'c6a6},
6315                          {0x0029'c9a9'4928'c8a8, 0x002b'cbab'4b2a'caaa},
6316                          {0x002d'cdad'4d2c'ccac, 0x002f'cfaf'4f2e'ceae},
6317                          {0x0031'd1b1'5130'd0b0, 0x0033'd3b3'5332'd2b2},
6318                          {0x0035'd5b5'5534'd4b4, 0x0037'd7b7'5736'd6b6},
6319                          {0x0039'd9b9'5938'd8b8, 0x003b'dbbb'5b3a'daba},
6320                          {0x003d'ddbd'5d3c'dcbc, 0x003f'dfbf'5f3e'debe}},
6321                         kVectorCalculationsSource);
6322   TestVectorInstruction(ExecVssravv,
6323                         ExecMaskedVssravv,
6324                         {{0, 224, 0, 254, 2, 225, 0, 254, 4, 226, 1, 254, 12, 227, 1, 254},
6325                          {16, 228, 1, 254, 10, 229, 1, 254, 12, 230, 2, 254, 28, 231, 2, 254},
6326                          {32, 232, 2, 255, 18, 233, 2, 255, 20, 234, 3, 255, 44, 235, 3, 255},
6327                          {48, 236, 3, 255, 26, 237, 3, 255, 28, 238, 4, 255, 60, 239, 4, 255},
6328                          {64, 240, 4, 255, 34, 241, 4, 255, 36, 242, 5, 255, 76, 243, 5, 255},
6329                          {80, 244, 5, 255, 42, 245, 5, 255, 44, 246, 6, 255, 92, 247, 6, 255},
6330                          {96, 248, 6, 0, 50, 249, 6, 0, 52, 250, 7, 0, 108, 251, 7, 0},
6331                          {112, 252, 7, 0, 58, 253, 7, 0, 60, 254, 8, 0, 124, 255, 8, 0}},
6332                         {{0x8100, 0xf830, 0xffc3, 0xfff8, 0xc484, 0xf8b1, 0xff8d, 0xfff9},
6333                          {0x9110, 0xf931, 0xffcb, 0xfff9, 0xcc8c, 0xf9b2, 0xff9d, 0xfffa},
6334                          {0xa120, 0xfa32, 0xffd3, 0xfffa, 0xd494, 0xfab3, 0xffad, 0xfffb},
6335                          {0xb130, 0xfb33, 0xffdb, 0xfffb, 0xdc9c, 0xfbb4, 0xffbd, 0xfffc},
6336                          {0xc140, 0xfc34, 0xffe3, 0xfffc, 0xe4a4, 0xfcb5, 0xffcd, 0xfffd},
6337                          {0xd150, 0xfd35, 0xffeb, 0xfffd, 0xecac, 0xfdb6, 0xffdd, 0xfffe},
6338                          {0xe160, 0xfe36, 0xfff3, 0xfffe, 0xf4b4, 0xfeb7, 0xffed, 0xffff},
6339                          {0xf170, 0xff37, 0xfffb, 0xffff, 0xfcbc, 0xffb8, 0xfffd, 0x0000}},
6340                         {{0x8302'8100, 0xffc3'8343, 0xffff'c585, 0xffff'ff8f},
6341                          {0x9312'9110, 0xffcb'8b4b, 0xffff'cd8d, 0xffff'ff9f},
6342                          {0xa322'a120, 0xffd3'9353, 0xffff'd595, 0xffff'ffaf},
6343                          {0xb332'b130, 0xffdb'9b5b, 0xffff'dd9d, 0xffff'ffbf},
6344                          {0xc342'c140, 0xffe3'a363, 0xffff'e5a5, 0xffff'ffcf},
6345                          {0xd352'd150, 0xffeb'ab6b, 0xffff'edad, 0xffff'ffdf},
6346                          {0xe362'e160, 0xfff3'b373, 0xffff'f5b5, 0xffff'ffef},
6347                          {0xf372'f170, 0xfffb'bb7b, 0xffff'fdbd, 0xffff'ffff}},
6348                         {{0x8706'8504'8302'8100, 0xffff'c787'4686'4585},
6349                          {0xffff'ffff'9716'9515, 0xffff'ffff'ffff'cf8f},
6350                          {0xa726'a524'a322'a120, 0xffff'd797'5696'5595},
6351                          {0xffff'ffff'b736'b535, 0xffff'ffff'ffff'df9f},
6352                          {0xc746'c544'c342'c140, 0xffff'e7a7'66a6'65a5},
6353                          {0xffff'ffff'd756'd555, 0xffff'ffff'ffff'efaf},
6354                          {0xe766'e564'e362'e160, 0xffff'f7b7'76b6'75b5},
6355                          {0xffff'ffff'f776'f575, 0xffff'ffff'ffff'ffbf}},
6356                         kVectorCalculationsSource);
6357 
6358   TestVectorInstruction(ExecVssravx,
6359                         ExecMaskedVssravx,
6360                         {{0, 224, 1, 225, 1, 225, 2, 226, 2, 226, 3, 227, 3, 227, 4, 228},
6361                          {4, 228, 5, 229, 5, 229, 6, 230, 6, 230, 7, 231, 7, 231, 8, 232},
6362                          {8, 232, 9, 233, 9, 233, 10, 234, 10, 234, 11, 235, 11, 235, 12, 236},
6363                          {12, 236, 13, 237, 13, 237, 14, 238, 14, 238, 15, 239, 15, 239, 16, 240},
6364                          {16, 240, 17, 241, 17, 241, 18, 242, 18, 242, 19, 243, 19, 243, 20, 244},
6365                          {20, 244, 21, 245, 21, 245, 22, 246, 22, 246, 23, 247, 23, 247, 24, 248},
6366                          {24, 248, 25, 249, 25, 249, 26, 250, 26, 250, 27, 251, 27, 251, 28, 252},
6367                          {28, 252, 29, 253, 29, 253, 30, 254, 30, 254, 31, 255, 31, 255, 32, 0}},
6368                         {{0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3, 0xffe4},
6369                          {0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7, 0xffe8},
6370                          {0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb, 0xffec},
6371                          {0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef, 0xfff0},
6372                          {0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3, 0xfff4},
6373                          {0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7, 0xfff8},
6374                          {0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb, 0xfffc},
6375                          {0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff, 0x0000}},
6376                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
6377                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
6378                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
6379                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
6380                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
6381                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
6382                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
6383                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
6384                         {{0xffff'ffff'ffe1'c1a1, 0xffff'ffff'ffe3'c3a3},
6385                          {0xffff'ffff'ffe5'c5a5, 0xffff'ffff'ffe7'c7a7},
6386                          {0xffff'ffff'ffe9'c9a9, 0xffff'ffff'ffeb'cbab},
6387                          {0xffff'ffff'ffed'cdad, 0xffff'ffff'ffef'cfaf},
6388                          {0xffff'ffff'fff1'd1b1, 0xffff'ffff'fff3'd3b3},
6389                          {0xffff'ffff'fff5'd5b5, 0xffff'ffff'fff7'd7b7},
6390                          {0xffff'ffff'fff9'd9b9, 0xffff'ffff'fffb'dbbb},
6391                          {0xffff'ffff'fffd'ddbd, 0xffff'ffff'ffff'dfbf}},
6392                         kVectorCalculationsSource);
6393 
6394   TestVectorInstruction(ExecVssravi,
6395                         ExecMaskedVssravi,
6396                         {{0, 224, 1, 225, 1, 225, 2, 226, 2, 226, 3, 227, 3, 227, 4, 228},
6397                          {4, 228, 5, 229, 5, 229, 6, 230, 6, 230, 7, 231, 7, 231, 8, 232},
6398                          {8, 232, 9, 233, 9, 233, 10, 234, 10, 234, 11, 235, 11, 235, 12, 236},
6399                          {12, 236, 13, 237, 13, 237, 14, 238, 14, 238, 15, 239, 15, 239, 16, 240},
6400                          {16, 240, 17, 241, 17, 241, 18, 242, 18, 242, 19, 243, 19, 243, 20, 244},
6401                          {20, 244, 21, 245, 21, 245, 22, 246, 22, 246, 23, 247, 23, 247, 24, 248},
6402                          {24, 248, 25, 249, 25, 249, 26, 250, 26, 250, 27, 251, 27, 251, 28, 252},
6403                          {28, 252, 29, 253, 29, 253, 30, 254, 30, 254, 31, 255, 31, 255, 32, 0}},
6404                         {{0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3, 0xffe4},
6405                          {0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7, 0xffe8},
6406                          {0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb, 0xffec},
6407                          {0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef, 0xfff0},
6408                          {0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3, 0xfff4},
6409                          {0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7, 0xfff8},
6410                          {0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb, 0xfffc},
6411                          {0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff, 0x0000}},
6412                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
6413                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
6414                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
6415                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
6416                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
6417                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
6418                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
6419                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
6420                         {{0xffe1'c1a1'4120'c0a0, 0xffe3'c3a3'4322'c2a2},
6421                          {0xffe5'c5a5'4524'c4a4, 0xffe7'c7a7'4726'c6a6},
6422                          {0xffe9'c9a9'4928'c8a8, 0xffeb'cbab'4b2a'caaa},
6423                          {0xffed'cdad'4d2c'ccac, 0xffef'cfaf'4f2e'ceae},
6424                          {0xfff1'd1b1'5130'd0b0, 0xfff3'd3b3'5332'd2b2},
6425                          {0xfff5'd5b5'5534'd4b4, 0xfff7'd7b7'5736'd6b6},
6426                          {0xfff9'd9b9'5938'd8b8, 0xfffb'dbbb'5b3a'daba},
6427                          {0xfffd'ddbd'5d3c'dcbc, 0xffff'dfbf'5f3e'debe}},
6428                         kVectorCalculationsSource);
6429   asm volatile("csrw vxrm, %0\n\t" ::"r"(vxrm));
6430 }
6431 
TEST(InlineAsmTestRiscv64,TestROD)6432 TEST(InlineAsmTestRiscv64, TestROD) {
6433   uint64_t vxrm;
6434   asm volatile(
6435       "csrr %0, vxrm\n\t"
6436       "csrwi vxrm, %c1\n\t"
6437       : "=r"(vxrm)
6438       : "i"(VXRMFlags::ROD));
6439   TestVectorInstruction(
6440       ExecVaadduvv,
6441       ExecMaskedVaadduvv,
6442       {{0, 137, 3, 141, 7, 143, 9, 147, 13, 133, 15, 137, 18, 139, 21, 143},
6443        {24, 161, 27, 165, 31, 167, 33, 171, 37, 157, 39, 161, 42, 163, 45, 167},
6444        {48, 185, 51, 189, 55, 191, 57, 195, 61, 181, 63, 185, 66, 187, 69, 191},
6445        {72, 209, 75, 213, 79, 215, 81, 219, 85, 205, 87, 209, 90, 211, 93, 215},
6446        {96, 105, 99, 109, 103, 111, 105, 115, 109, 101, 111, 105, 114, 107, 117, 111},
6447        {120, 129, 123, 133, 127, 135, 129, 139, 133, 125, 135, 129, 138, 131, 141, 135},
6448        {144, 153, 147, 157, 151, 159, 153, 163, 157, 149, 159, 153, 162, 155, 165, 159},
6449        {168, 177, 171, 181, 175, 183, 177, 187, 181, 173, 183, 177, 186, 179, 189, 183}},
6450       {{0x8980, 0x8c83, 0x8f87, 0x9289, 0x858d, 0x888f, 0x8b92, 0x8e95},
6451        {0xa198, 0xa49b, 0xa79f, 0xaaa1, 0x9da5, 0xa0a7, 0xa3aa, 0xa6ad},
6452        {0xb9b0, 0xbcb3, 0xbfb7, 0xc2b9, 0xb5bd, 0xb8bf, 0xbbc2, 0xbec5},
6453        {0xd1c8, 0xd4cb, 0xd7cf, 0xdad1, 0xcdd5, 0xd0d7, 0xd3da, 0xd6dd},
6454        {0x69e0, 0x6ce3, 0x6fe7, 0x72e9, 0x65ed, 0x68ef, 0x6bf2, 0x6ef5},
6455        {0x81f8, 0x84fb, 0x87ff, 0x8b01, 0x7e05, 0x8107, 0x840a, 0x870d},
6456        {0x9a10, 0x9d13, 0xa017, 0xa319, 0x961d, 0x991f, 0x9c22, 0x9f25},
6457        {0xb228, 0xb52b, 0xb82f, 0xbb31, 0xae35, 0xb137, 0xb43a, 0xb73d}},
6458       {{0x8c83'8980, 0x9289'8f87, 0x888f'858d, 0x8e95'8b92},
6459        {0xa49b'a198, 0xaaa1'a79f, 0xa0a7'9da5, 0xa6ad'a3aa},
6460        {0xbcb3'b9b0, 0xc2b9'bfb7, 0xb8bf'b5bd, 0xbec5'bbc2},
6461        {0xd4cb'd1c8, 0xdad1'd7cf, 0xd0d7'cdd5, 0xd6dd'd3da},
6462        {0x6ce3'69e0, 0x72e9'6fe7, 0x68ef'65ed, 0x6ef5'6bf2},
6463        {0x84fb'81f8, 0x8b01'87ff, 0x8107'7e05, 0x870d'840a},
6464        {0x9d13'9a10, 0xa319'a017, 0x991f'961d, 0x9f25'9c22},
6465        {0xb52b'b228, 0xbb31'b82f, 0xb137'ae35, 0xb73d'b43a}},
6466       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858d},
6467        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da5},
6468        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bd},
6469        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd5},
6470        {0x72e9'6fe6'ece3'69e0, 0x6ef5'6bf2'68ef'65ed},
6471        {0x8b01'87ff'04fb'81f8, 0x870d'840a'8107'7e05},
6472        {0xa319'a017'1d13'9a10, 0x9f25'9c22'991f'961d},
6473        {0xbb31'b82f'352b'b228, 0xb73d'b43a'b137'ae35}},
6474       kVectorCalculationsSource);
6475   TestVectorInstruction(
6476       ExecVaadduvx,
6477       ExecMaskedVaadduvx,
6478       {{85, 149, 86, 151, 87, 151, 88, 153, 89, 153, 90, 155, 91, 155, 92, 157},
6479        {93, 157, 94, 159, 95, 159, 96, 161, 97, 161, 98, 163, 99, 163, 100, 165},
6480        {101, 165, 102, 167, 103, 167, 104, 169, 105, 169, 106, 171, 107, 171, 108, 173},
6481        {109, 173, 110, 175, 111, 175, 112, 177, 113, 177, 114, 179, 115, 179, 116, 181},
6482        {117, 181, 118, 183, 119, 183, 120, 185, 121, 185, 122, 187, 123, 187, 124, 189},
6483        {125, 189, 126, 191, 127, 191, 128, 193, 129, 193, 130, 195, 131, 195, 132, 197},
6484        {133, 197, 134, 199, 135, 199, 136, 201, 137, 201, 138, 203, 139, 203, 140, 205},
6485        {141, 205, 142, 207, 143, 207, 144, 209, 145, 209, 146, 211, 147, 211, 148, 213}},
6486       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
6487        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
6488        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
6489        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
6490        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
6491        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
6492        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
6493        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
6494       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
6495        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
6496        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
6497        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
6498        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
6499        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
6500        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
6501        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
6502       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
6503        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
6504        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
6505        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
6506        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
6507        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
6508        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
6509        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
6510       kVectorCalculationsSource);
6511   TestVectorInstruction(
6512       ExecVaaddvv,
6513       ExecMaskedVaaddvv,
6514       {{0, 137, 3, 141, 7, 143, 9, 147, 13, 133, 15, 137, 18, 139, 21, 143},
6515        {24, 161, 27, 165, 31, 167, 33, 171, 37, 157, 39, 161, 42, 163, 45, 167},
6516        {48, 185, 51, 189, 55, 191, 57, 195, 61, 181, 63, 185, 66, 187, 69, 191},
6517        {72, 209, 75, 213, 79, 215, 81, 219, 85, 205, 87, 209, 90, 211, 93, 215},
6518        {224, 233, 227, 237, 231, 239, 233, 243, 237, 229, 239, 233, 242, 235, 245, 239},
6519        {248, 1, 251, 5, 255, 7, 1, 11, 5, 253, 7, 1, 10, 3, 13, 7},
6520        {16, 25, 19, 29, 23, 31, 25, 35, 29, 21, 31, 25, 34, 27, 37, 31},
6521        {40, 49, 43, 53, 47, 55, 49, 59, 53, 45, 55, 49, 58, 51, 61, 55}},
6522       {{0x8980, 0x8c83, 0x8f87, 0x9289, 0x858d, 0x888f, 0x8b92, 0x8e95},
6523        {0xa198, 0xa49b, 0xa79f, 0xaaa1, 0x9da5, 0xa0a7, 0xa3aa, 0xa6ad},
6524        {0xb9b0, 0xbcb3, 0xbfb7, 0xc2b9, 0xb5bd, 0xb8bf, 0xbbc2, 0xbec5},
6525        {0xd1c8, 0xd4cb, 0xd7cf, 0xdad1, 0xcdd5, 0xd0d7, 0xd3da, 0xd6dd},
6526        {0xe9e0, 0xece3, 0xefe7, 0xf2e9, 0xe5ed, 0xe8ef, 0xebf2, 0xeef5},
6527        {0x01f8, 0x04fb, 0x07ff, 0x0b01, 0xfe05, 0x0107, 0x040a, 0x070d},
6528        {0x1a10, 0x1d13, 0x2017, 0x2319, 0x161d, 0x191f, 0x1c22, 0x1f25},
6529        {0x3228, 0x352b, 0x382f, 0x3b31, 0x2e35, 0x3137, 0x343a, 0x373d}},
6530       {{0x8c83'8980, 0x9289'8f87, 0x888f'858d, 0x8e95'8b92},
6531        {0xa49b'a198, 0xaaa1'a79f, 0xa0a7'9da5, 0xa6ad'a3aa},
6532        {0xbcb3'b9b0, 0xc2b9'bfb7, 0xb8bf'b5bd, 0xbec5'bbc2},
6533        {0xd4cb'd1c8, 0xdad1'd7cf, 0xd0d7'cdd5, 0xd6dd'd3da},
6534        {0xece3'69e0, 0xf2e9'6fe7, 0xe8ef'65ed, 0xeef5'6bf2},
6535        {0x04fb'81f8, 0x0b01'87ff, 0x0107'7e05, 0x070d'840a},
6536        {0x1d13'9a10, 0x2319'a017, 0x191f'961d, 0x1f25'9c22},
6537        {0x352b'b228, 0x3b31'b82f, 0x3137'ae35, 0x373d'b43a}},
6538       {{0x9289'8f87'0c83'8980, 0x8e95'8b92'888f'858d},
6539        {0xaaa1'a79f'249b'a198, 0xa6ad'a3aa'a0a7'9da5},
6540        {0xc2b9'bfb7'3cb3'b9b0, 0xbec5'bbc2'b8bf'b5bd},
6541        {0xdad1'd7cf'54cb'd1c8, 0xd6dd'd3da'd0d7'cdd5},
6542        {0xf2e9'6fe6'ece3'69e0, 0xeef5'6bf2'68ef'65ed},
6543        {0x0b01'87ff'04fb'81f8, 0x070d'840a'8107'7e05},
6544        {0x2319'a017'1d13'9a10, 0x1f25'9c22'991f'961d},
6545        {0x3b31'b82f'352b'b228, 0x373d'b43a'b137'ae35}},
6546       kVectorCalculationsSource);
6547   TestVectorInstruction(
6548       ExecVaaddvx,
6549       ExecMaskedVaaddvx,
6550       {{213, 149, 214, 151, 215, 151, 216, 153, 217, 153, 218, 155, 219, 155, 220, 157},
6551        {221, 157, 222, 159, 223, 159, 224, 161, 225, 161, 226, 163, 227, 163, 228, 165},
6552        {229, 165, 230, 167, 231, 167, 232, 169, 233, 169, 234, 171, 235, 171, 236, 173},
6553        {237, 173, 238, 175, 239, 175, 240, 177, 241, 177, 242, 179, 243, 179, 244, 181},
6554        {245, 181, 246, 183, 247, 183, 248, 185, 249, 185, 250, 187, 251, 187, 252, 189},
6555        {253, 189, 254, 191, 255, 191, 0, 193, 1, 193, 2, 195, 3, 195, 4, 197},
6556        {5, 197, 6, 199, 7, 199, 8, 201, 9, 201, 10, 203, 11, 203, 12, 205},
6557        {13, 205, 14, 207, 15, 207, 16, 209, 17, 209, 18, 211, 19, 211, 20, 213}},
6558       {{0x95d5, 0x96d6, 0x97d7, 0x98d8, 0x99d9, 0x9ada, 0x9bdb, 0x9cdc},
6559        {0x9ddd, 0x9ede, 0x9fdf, 0xa0e0, 0xa1e1, 0xa2e2, 0xa3e3, 0xa4e4},
6560        {0xa5e5, 0xa6e6, 0xa7e7, 0xa8e8, 0xa9e9, 0xaaea, 0xabeb, 0xacec},
6561        {0xaded, 0xaeee, 0xafef, 0xb0f0, 0xb1f1, 0xb2f2, 0xb3f3, 0xb4f4},
6562        {0xb5f5, 0xb6f6, 0xb7f7, 0xb8f8, 0xb9f9, 0xbafa, 0xbbfb, 0xbcfc},
6563        {0xbdfd, 0xbefe, 0xbfff, 0xc100, 0xc201, 0xc302, 0xc403, 0xc504},
6564        {0xc605, 0xc706, 0xc807, 0xc908, 0xca09, 0xcb0a, 0xcc0b, 0xcd0c},
6565        {0xce0d, 0xcf0e, 0xd00f, 0xd110, 0xd211, 0xd312, 0xd413, 0xd514}},
6566       {{0x96d6'95d5, 0x98d8'97d7, 0x9ada'99d9, 0x9cdc'9bdb},
6567        {0x9ede'9ddd, 0xa0e0'9fdf, 0xa2e2'a1e1, 0xa4e4'a3e3},
6568        {0xa6e6'a5e5, 0xa8e8'a7e7, 0xaaea'a9e9, 0xacec'abeb},
6569        {0xaeee'aded, 0xb0f0'afef, 0xb2f2'b1f1, 0xb4f4'b3f3},
6570        {0xb6f6'b5f5, 0xb8f8'b7f7, 0xbafa'b9f9, 0xbcfc'bbfb},
6571        {0xbefe'bdfd, 0xc100'bfff, 0xc302'c201, 0xc504'c403},
6572        {0xc706'c605, 0xc908'c807, 0xcb0a'ca09, 0xcd0c'cc0b},
6573        {0xcf0e'ce0d, 0xd110'd00f, 0xd312'd211, 0xd514'd413}},
6574       {{0x98d8'97d7'96d6'95d5, 0x9cdc'9bdb'9ada'99d9},
6575        {0xa0e0'9fdf'9ede'9ddd, 0xa4e4'a3e3'a2e2'a1e1},
6576        {0xa8e8'a7e7'a6e6'a5e5, 0xacec'abeb'aaea'a9e9},
6577        {0xb0f0'afef'aeee'aded, 0xb4f4'b3f3'b2f2'b1f1},
6578        {0xb8f8'b7f7'b6f6'b5f5, 0xbcfc'bbfb'bafa'b9f9},
6579        {0xc100'bfff'befe'bdfd, 0xc504'c403'c302'c201},
6580        {0xc908'c807'c706'c605, 0xcd0c'cc0b'cb0a'ca09},
6581        {0xd110'd00f'cf0e'ce0d, 0xd514'd413'd312'd211}},
6582       kVectorCalculationsSource);
6583   TestVectorInstruction(
6584       ExecVasubuvv,
6585       ExecMaskedVasubuvv,
6586       {{0, 247, 255, 247, 253, 245, 253, 245, 251, 3, 251, 3, 250, 1, 249, 1},
6587        {248, 239, 247, 239, 245, 237, 245, 237, 243, 251, 243, 251, 242, 249, 241, 249},
6588        {240, 231, 239, 231, 237, 229, 237, 229, 235, 243, 235, 243, 234, 241, 233, 241},
6589        {232, 223, 231, 223, 229, 221, 229, 221, 227, 235, 227, 235, 226, 233, 225, 233},
6590        {224, 87, 223, 87, 221, 85, 221, 85, 219, 99, 219, 99, 218, 97, 217, 97},
6591        {216, 79, 215, 79, 213, 77, 213, 77, 211, 91, 211, 91, 210, 89, 209, 89},
6592        {208, 71, 207, 71, 205, 69, 205, 69, 203, 83, 203, 83, 202, 81, 201, 81},
6593        {200, 63, 199, 63, 197, 61, 197, 61, 195, 75, 195, 75, 194, 73, 193, 73}},
6594       {{0xf780, 0xf67f, 0xf57d, 0xf47d, 0x037b, 0x027b, 0x017a, 0x0079},
6595        {0xef78, 0xee77, 0xed75, 0xec75, 0xfb73, 0xfa73, 0xf972, 0xf871},
6596        {0xe770, 0xe66f, 0xe56d, 0xe46d, 0xf36b, 0xf26b, 0xf16a, 0xf069},
6597        {0xdf68, 0xde67, 0xdd65, 0xdc65, 0xeb63, 0xea63, 0xe962, 0xe861},
6598        {0x5760, 0x565f, 0x555d, 0x545d, 0x635b, 0x625b, 0x615a, 0x6059},
6599        {0x4f58, 0x4e57, 0x4d55, 0x4c55, 0x5b53, 0x5a53, 0x5952, 0x5851},
6600        {0x4750, 0x464f, 0x454d, 0x444d, 0x534b, 0x524b, 0x514a, 0x5049},
6601        {0x3f48, 0x3e47, 0x3d45, 0x3c45, 0x4b43, 0x4a43, 0x4942, 0x4841}},
6602       {{0xf67e'f780, 0xf47c'f57d, 0x027b'037b, 0x0079'017a},
6603        {0xee76'ef78, 0xec74'ed75, 0xfa72'fb73, 0xf870'f972},
6604        {0xe66e'e770, 0xe46c'e56d, 0xf26a'f36b, 0xf068'f16a},
6605        {0xde66'df68, 0xdc64'dd65, 0xea62'eb63, 0xe860'e962},
6606        {0x565f'5760, 0x545d'555d, 0x625b'635b, 0x6059'615a},
6607        {0x4e57'4f58, 0x4c55'4d55, 0x5a53'5b53, 0x5851'5952},
6608        {0x464f'4750, 0x444d'454d, 0x524b'534b, 0x5049'514a},
6609        {0x3e47'3f48, 0x3c45'3d45, 0x4a43'4b43, 0x4841'4942}},
6610       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037b},
6611        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb73},
6612        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36b},
6613        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb63},
6614        {0x545d'555d'd65f'5760, 0x6059'615a'625b'635b},
6615        {0x4c55'4d55'ce57'4f58, 0x5851'5952'5a53'5b53},
6616        {0x444d'454d'c64f'4750, 0x5049'514a'524b'534b},
6617        {0x3c45'3d45'be47'3f48, 0x4841'4942'4a43'4b43}},
6618       kVectorCalculationsSource);
6619   TestVectorInstruction(
6620       ExecVasubuvx,
6621       ExecMaskedVasubuvx,
6622       {{171, 235, 172, 237, 173, 237, 174, 239, 175, 239, 176, 241, 177, 241, 178, 243},
6623        {179, 243, 180, 245, 181, 245, 182, 247, 183, 247, 184, 249, 185, 249, 186, 251},
6624        {187, 251, 188, 253, 189, 253, 190, 255, 191, 255, 192, 1, 193, 1, 194, 3},
6625        {195, 3, 196, 5, 197, 5, 198, 7, 199, 7, 200, 9, 201, 9, 202, 11},
6626        {203, 11, 204, 13, 205, 13, 206, 15, 207, 15, 208, 17, 209, 17, 210, 19},
6627        {211, 19, 212, 21, 213, 21, 214, 23, 215, 23, 216, 25, 217, 25, 218, 27},
6628        {219, 27, 220, 29, 221, 29, 222, 31, 223, 31, 224, 33, 225, 33, 226, 35},
6629        {227, 35, 228, 37, 229, 37, 230, 39, 231, 39, 232, 41, 233, 41, 234, 43}},
6630       {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
6631        {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
6632        {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
6633        {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
6634        {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
6635        {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
6636        {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
6637        {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
6638       {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
6639        {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
6640        {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
6641        {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
6642        {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
6643        {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
6644        {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
6645        {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
6646       {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
6647        {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
6648        {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
6649        {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
6650        {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
6651        {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
6652        {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
6653        {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
6654       kVectorCalculationsSource);
6655   TestVectorInstruction(
6656       ExecVasubvv,
6657       ExecMaskedVasubvv,
6658       {{0, 247, 255, 247, 253, 245, 253, 245, 251, 3, 251, 3, 250, 1, 249, 1},
6659        {248, 239, 247, 239, 245, 237, 245, 237, 243, 251, 243, 251, 242, 249, 241, 249},
6660        {240, 231, 239, 231, 237, 229, 237, 229, 235, 243, 235, 243, 234, 241, 233, 241},
6661        {232, 223, 231, 223, 229, 221, 229, 221, 227, 235, 227, 235, 226, 233, 225, 233},
6662        {96, 215, 95, 215, 93, 213, 93, 213, 91, 227, 91, 227, 90, 225, 89, 225},
6663        {88, 207, 87, 207, 85, 205, 85, 205, 83, 219, 83, 219, 82, 217, 81, 217},
6664        {80, 199, 79, 199, 77, 197, 77, 197, 75, 211, 75, 211, 74, 209, 73, 209},
6665        {72, 191, 71, 191, 69, 189, 69, 189, 67, 203, 67, 203, 66, 201, 65, 201}},
6666       {{0xf780, 0xf67f, 0xf57d, 0xf47d, 0x037b, 0x027b, 0x017a, 0x0079},
6667        {0xef78, 0xee77, 0xed75, 0xec75, 0xfb73, 0xfa73, 0xf972, 0xf871},
6668        {0xe770, 0xe66f, 0xe56d, 0xe46d, 0xf36b, 0xf26b, 0xf16a, 0xf069},
6669        {0xdf68, 0xde67, 0xdd65, 0xdc65, 0xeb63, 0xea63, 0xe962, 0xe861},
6670        {0xd760, 0xd65f, 0xd55d, 0xd45d, 0xe35b, 0xe25b, 0xe15a, 0xe059},
6671        {0xcf58, 0xce57, 0xcd55, 0xcc55, 0xdb53, 0xda53, 0xd952, 0xd851},
6672        {0xc750, 0xc64f, 0xc54d, 0xc44d, 0xd34b, 0xd24b, 0xd14a, 0xd049},
6673        {0xbf48, 0xbe47, 0xbd45, 0xbc45, 0xcb43, 0xca43, 0xc942, 0xc841}},
6674       {{0xf67e'f780, 0xf47c'f57d, 0x027b'037b, 0x0079'017a},
6675        {0xee76'ef78, 0xec74'ed75, 0xfa72'fb73, 0xf870'f972},
6676        {0xe66e'e770, 0xe46c'e56d, 0xf26a'f36b, 0xf068'f16a},
6677        {0xde66'df68, 0xdc64'dd65, 0xea62'eb63, 0xe860'e962},
6678        {0xd65f'5760, 0xd45d'555d, 0xe25b'635b, 0xe059'615a},
6679        {0xce57'4f58, 0xcc55'4d55, 0xda53'5b53, 0xd851'5952},
6680        {0xc64f'4750, 0xc44d'454d, 0xd24b'534b, 0xd049'514a},
6681        {0xbe47'3f48, 0xbc45'3d45, 0xca43'4b43, 0xc841'4942}},
6682       {{0xf47c'f57d'767e'f780, 0x0079'017a'027b'037b},
6683        {0xec74'ed75'6e76'ef78, 0xf870'f971'fa72'fb73},
6684        {0xe46c'e56d'666e'e770, 0xf068'f169'f26a'f36b},
6685        {0xdc64'dd65'5e66'df68, 0xe860'e961'ea62'eb63},
6686        {0xd45d'555d'd65f'5760, 0xe059'615a'625b'635b},
6687        {0xcc55'4d55'ce57'4f58, 0xd851'5952'5a53'5b53},
6688        {0xc44d'454d'c64f'4750, 0xd049'514a'524b'534b},
6689        {0xbc45'3d45'be47'3f48, 0xc841'4942'4a43'4b43}},
6690       kVectorCalculationsSource);
6691   TestVectorInstruction(ExecVasubvx,
6692                         ExecMaskedVasubvx,
6693                         {{43, 235, 44, 237, 45, 237, 46, 239, 47, 239, 48, 241, 49, 241, 50, 243},
6694                          {51, 243, 52, 245, 53, 245, 54, 247, 55, 247, 56, 249, 57, 249, 58, 251},
6695                          {59, 251, 60, 253, 61, 253, 62, 255, 63, 255, 64, 1, 65, 1, 66, 3},
6696                          {67, 3, 68, 5, 69, 5, 70, 7, 71, 7, 72, 9, 73, 9, 74, 11},
6697                          {75, 11, 76, 13, 77, 13, 78, 15, 79, 15, 80, 17, 81, 17, 82, 19},
6698                          {83, 19, 84, 21, 85, 21, 86, 23, 87, 23, 88, 25, 89, 25, 90, 27},
6699                          {91, 27, 92, 29, 93, 29, 94, 31, 95, 31, 96, 33, 97, 33, 98, 35},
6700                          {99, 35, 100, 37, 101, 37, 102, 39, 103, 39, 104, 41, 105, 41, 106, 43}},
6701                         {{0xeb2b, 0xec2c, 0xed2d, 0xee2e, 0xef2f, 0xf030, 0xf131, 0xf232},
6702                          {0xf333, 0xf434, 0xf535, 0xf636, 0xf737, 0xf838, 0xf939, 0xfa3a},
6703                          {0xfb3b, 0xfc3c, 0xfd3d, 0xfe3e, 0xff3f, 0x0040, 0x0141, 0x0242},
6704                          {0x0343, 0x0444, 0x0545, 0x0646, 0x0747, 0x0848, 0x0949, 0x0a4a},
6705                          {0x0b4b, 0x0c4c, 0x0d4d, 0x0e4e, 0x0f4f, 0x1050, 0x1151, 0x1252},
6706                          {0x1353, 0x1454, 0x1555, 0x1656, 0x1757, 0x1858, 0x1959, 0x1a5a},
6707                          {0x1b5b, 0x1c5c, 0x1d5d, 0x1e5e, 0x1f5f, 0x2060, 0x2161, 0x2262},
6708                          {0x2363, 0x2464, 0x2565, 0x2666, 0x2767, 0x2868, 0x2969, 0x2a6a}},
6709                         {{0xec2b'eb2b, 0xee2d'ed2d, 0xf02f'ef2f, 0xf231'f131},
6710                          {0xf433'f333, 0xf635'f535, 0xf837'f737, 0xfa39'f939},
6711                          {0xfc3b'fb3b, 0xfe3d'fd3d, 0x003f'ff3f, 0x0242'0141},
6712                          {0x0444'0343, 0x0646'0545, 0x0848'0747, 0x0a4a'0949},
6713                          {0x0c4c'0b4b, 0x0e4e'0d4d, 0x1050'0f4f, 0x1252'1151},
6714                          {0x1454'1353, 0x1656'1555, 0x1858'1757, 0x1a5a'1959},
6715                          {0x1c5c'1b5b, 0x1e5e'1d5d, 0x2060'1f5f, 0x2262'2161},
6716                          {0x2464'2363, 0x2666'2565, 0x2868'2767, 0x2a6a'2969}},
6717                         {{0xee2d'ed2c'ec2b'eb2b, 0xf231'f130'f02f'ef2f},
6718                          {0xf635'f534'f433'f333, 0xfa39'f938'f837'f737},
6719                          {0xfe3d'fd3c'fc3b'fb3b, 0x0242'0141'003f'ff3f},
6720                          {0x0646'0545'0444'0343, 0x0a4a'0949'0848'0747},
6721                          {0x0e4e'0d4d'0c4c'0b4b, 0x1252'1151'1050'0f4f},
6722                          {0x1656'1555'1454'1353, 0x1a5a'1959'1858'1757},
6723                          {0x1e5e'1d5d'1c5c'1b5b, 0x2262'2161'2060'1f5f},
6724                          {0x2666'2565'2464'2363, 0x2a6a'2969'2868'2767}},
6725                         kVectorCalculationsSource);
6726   TestNarrowingVectorInstruction(ExecVnclipuwi,
6727                                  ExecMaskedVnclipuwi,
6728                                  {{33, 33, 33, 33, 35, 35, 35, 35, 37, 37, 37, 37, 39, 39, 39, 39},
6729                                   {41, 41, 41, 41, 43, 43, 43, 43, 45, 45, 45, 45, 47, 47, 47, 47},
6730                                   {49, 49, 49, 49, 51, 51, 51, 51, 53, 53, 53, 53, 55, 55, 55, 55},
6731                                   {57, 57, 57, 57, 59, 59, 59, 59, 61, 61, 61, 61, 63, 63, 63, 63}},
6732                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6733                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6734                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6735                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
6736                                  {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6737                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6738                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6739                                   {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff}},
6740                                  kVectorCalculationsSource);
6741   TestNarrowingVectorInstruction(
6742       ExecVnclipwi,
6743       ExecMaskedVnclipwi,
6744       {{225, 225, 225, 225, 227, 227, 227, 227, 229, 229, 229, 229, 231, 231, 231, 231},
6745        {233, 233, 233, 233, 235, 235, 235, 235, 237, 237, 237, 237, 239, 239, 239, 239},
6746        {241, 241, 241, 241, 243, 243, 243, 243, 245, 245, 245, 245, 247, 247, 247, 247},
6747        {249, 249, 249, 249, 251, 251, 251, 251, 253, 253, 253, 253, 255, 255, 255, 255}},
6748       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6749        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6750        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6751        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
6752       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6753        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6754        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6755        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000}},
6756       kVectorCalculationsSource);
6757 
6758   TestNarrowingVectorInstruction(ExecVnclipuwx,
6759                                  ExecMaskedVnclipuwx,
6760                                  {{33, 33, 33, 33, 35, 35, 35, 35, 37, 37, 37, 37, 39, 39, 39, 39},
6761                                   {41, 41, 41, 41, 43, 43, 43, 43, 45, 45, 45, 45, 47, 47, 47, 47},
6762                                   {49, 49, 49, 49, 51, 51, 51, 51, 53, 53, 53, 53, 55, 55, 55, 55},
6763                                   {57, 57, 57, 57, 59, 59, 59, 59, 61, 61, 61, 61, 63, 63, 63, 63}},
6764                                  {{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6765                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6766                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff},
6767                                   {0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff}},
6768                                  {{0x0021'c1a1, 0x0023'c3a3, 0x0025'c5a5, 0x0027'c7a7},
6769                                   {0x0029'c9a9, 0x002b'cbab, 0x002d'cdad, 0x002f'cfaf},
6770                                   {0x0031'd1b1, 0x0033'd3b3, 0x0035'd5b5, 0x0037'd7b7},
6771                                   {0x0039'd9b9, 0x003b'dbbb, 0x003d'ddbd, 0x003f'dfbf}},
6772                                  kVectorCalculationsSource);
6773 
6774   TestNarrowingVectorInstruction(
6775       ExecVnclipwx,
6776       ExecMaskedVnclipwx,
6777       {{225, 225, 225, 225, 227, 227, 227, 227, 229, 229, 229, 229, 231, 231, 231, 231},
6778        {233, 233, 233, 233, 235, 235, 235, 235, 237, 237, 237, 237, 239, 239, 239, 239},
6779        {241, 241, 241, 241, 243, 243, 243, 243, 245, 245, 245, 245, 247, 247, 247, 247},
6780        {249, 249, 249, 249, 251, 251, 251, 251, 253, 253, 253, 253, 255, 255, 255, 255}},
6781       {{0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6782        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6783        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000},
6784        {0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0xdfbf}},
6785       {{0xffe1'c1a1, 0xffe3'c3a3, 0xffe5'c5a5, 0xffe7'c7a7},
6786        {0xffe9'c9a9, 0xffeb'cbab, 0xffed'cdad, 0xffef'cfaf},
6787        {0xfff1'd1b1, 0xfff3'd3b3, 0xfff5'd5b5, 0xfff7'd7b7},
6788        {0xfff9'd9b9, 0xfffb'dbbb, 0xfffd'ddbd, 0xffff'dfbf}},
6789       kVectorCalculationsSource);
6790 
6791   TestNarrowingVectorInstruction(
6792       ExecVnclipuwv,
6793       ExecMaskedVnclipuwv,
6794       {{255, 255, 255, 255, 69, 35, 9, 3, 255, 255, 255, 255, 153, 39, 9, 3},
6795        {255, 255, 255, 255, 85, 43, 11, 3, 255, 255, 255, 255, 185, 47, 11, 3},
6796        {255, 255, 255, 255, 101, 51, 13, 3, 255, 255, 255, 255, 217, 55, 13, 3},
6797        {255, 255, 255, 255, 117, 59, 15, 3, 255, 255, 255, 255, 249, 63, 15, 3}},
6798       {{0xffff, 0xffff, 0xffff, 0xffff, 0x4989, 0x0971, 0x009b, 0x0009},
6799        {0xffff, 0xffff, 0xffff, 0xffff, 0x5999, 0x0b73, 0x00bb, 0x000b},
6800        {0xffff, 0xffff, 0xffff, 0xffff, 0x69a9, 0x0d75, 0x00db, 0x000d},
6801        {0xffff, 0xffff, 0xffff, 0xffff, 0x79b9, 0x0f77, 0x00fb, 0x000f}},
6802       {{0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6803        {0xa726'a525, 0x0057'9757, 0x0000'5b9b, 0x0000'00bf},
6804        {0xffff'ffff, 0xffff'ffff, 0xffff'ffff, 0xffff'ffff},
6805        {0xe766'e565, 0x0077'b777, 0x0000'7bbb, 0x0000'00ff}},
6806       kVectorCalculationsSource);
6807 
6808   TestNarrowingVectorInstruction(
6809       ExecVnclipwv,
6810       ExecMaskedVnclipwv,
6811       {{128, 128, 128, 128, 197, 227, 249, 255, 128, 128, 128, 128, 153, 231, 249, 255},
6812        {128, 128, 128, 128, 213, 235, 251, 255, 128, 128, 128, 128, 185, 239, 251, 255},
6813        {128, 128, 128, 128, 229, 243, 253, 255, 128, 128, 128, 128, 217, 247, 253, 255},
6814        {128, 128, 128, 157, 245, 251, 255, 255, 128, 128, 128, 221, 249, 255, 255, 255}},
6815       {{0x8000, 0x8000, 0x8000, 0x8000, 0xc989, 0xf971, 0xff9b, 0xfff9},
6816        {0x8000, 0x8000, 0x8000, 0x8000, 0xd999, 0xfb73, 0xffbb, 0xfffb},
6817        {0x8000, 0x8000, 0x8000, 0x8000, 0xe9a9, 0xfd75, 0xffdb, 0xfffd},
6818        {0x8000, 0x8000, 0x8000, 0x8000, 0xf9b9, 0xff77, 0xfffb, 0xffff}},
6819       {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6820        {0xa726'a525, 0xffd7'9757, 0xffff'db9b, 0xffff'ffbf},
6821        {0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
6822        {0xe766'e565, 0xfff7'b777, 0xffff'fbbb, 0xffff'ffff}},
6823       kVectorCalculationsSource);
6824 
6825   TestVectorInstruction(
6826       ExecVsmulvv,
6827       ExecMaskedVsmulvv,
6828       {{0, 109, 1, 103, 1, 99, 1, 93, 1, 117, 1, 111, 3, 107, 3, 101},
6829        {4, 67, 5, 63, 7, 59, 7, 55, 9, 75, 11, 71, 13, 67, 15, 63},
6830        {16, 35, 19, 31, 21, 27, 23, 23, 25, 43, 27, 39, 31, 35, 33, 31},
6831        {36, 9, 39, 7, 43, 3, 45, 1, 49, 17, 53, 15, 57, 11, 61, 9},
6832        {192, 247, 193, 245, 193, 245, 193, 243, 193, 255, 193, 253, 195, 253, 195, 251},
6833        {196, 237, 197, 237, 199, 237, 199, 237, 201, 245, 203, 245, 205, 245, 207, 245},
6834        {208, 237, 211, 237, 213, 237, 215, 237, 217, 245, 219, 245, 223, 245, 225, 245},
6835        {228, 243, 231, 245, 235, 245, 237, 247, 241, 251, 245, 253, 249, 253, 253, 255}},
6836       {{0x6d24, 0x677f, 0x61f9, 0x5c95, 0x750d, 0x6f69, 0x69e3, 0x647f},
6837        {0x437f, 0x3edb, 0x3a57, 0x35f5, 0x4b6b, 0x46c9, 0x4245, 0x3de3},
6838        {0x21e9, 0x1e47, 0x1ac5, 0x1765, 0x29d9, 0x2639, 0x22b9, 0x1f57},
6839        {0x0863, 0x05c5, 0x0345, 0x00e5, 0x1059, 0x0db9, 0x0b3b, 0x08dd},
6840        {0xf6ef, 0xf551, 0xf3d3, 0xf277, 0xfee7, 0xfd4b, 0xfbcd, 0xfa71},
6841        {0xed89, 0xeced, 0xec71, 0xec17, 0xf585, 0xf4eb, 0xf471, 0xf415},
6842        {0xec33, 0xec9b, 0xed21, 0xedc7, 0xf435, 0xf49b, 0xf523, 0xf5cb},
6843        {0xf2ef, 0xf457, 0xf5df, 0xf789, 0xfaf3, 0xfc5d, 0xfde5, 0xff8f}},
6844       {{0x677d'76af, 0x5c93'1931, 0x6f67'3831, 0x647d'dbb7},
6845        {0x3eda'09c7, 0x35f3'b251, 0x46c7'cf51, 0x3de2'78dd},
6846        {0x1e46'b4fd, 0x1764'638f, 0x2638'7e8f, 0x1f57'2e25},
6847        {0x05c3'7855, 0x00e5'2cef, 0x0db9'45ef, 0x08db'fb8d},
6848        {0xf550'cd47, 0xf276'7fe1, 0xfd4a'8ed9, 0xfa71'4277},
6849        {0xeced'a0bf, 0xec17'5961, 0xf4eb'6659, 0xf416'1fff},
6850        {0xec9a'8c57, 0xedc8'4b01, 0xf49c'55f9, 0xf5cb'15a7},
6851        {0xf457'900d, 0xf789'54c1, 0xfc5d'5db9, 0xff90'236d}},
6852       {{0x5c93'192f'ccd4'7781, 0x647d'dbb5'bb66'23af},
6853        {0x35f3'b24f'43d0'aa39, 0x3de2'78dd'1a4e'4257},
6854        {0x1764'638e'e2fd'152f, 0x1f57'2e24'a166'993d},
6855        {0x00e5'2cee'aa59'b867, 0x08db'fb8c'50af'2865},
6856        {0xf276'7fe1'80cf'f441, 0xfa71'4276'eef1'1fff},
6857        {0xec17'5961'584c'a799, 0xf416'1ffe'ae59'bf47},
6858        {0xedc8'4b01'57f9'9331, 0xf5cb'15a6'95f2'96cf},
6859        {0xf789'54c1'7fd6'b709, 0xff90'236e'a5bb'a697}},
6860       kVectorCalculationsSource);
6861   TestVectorInstruction(ExecVsmulvx,
6862                         ExecMaskedVsmulvx,
6863                         {{0, 85, 255, 83, 253, 83, 251, 81, 251, 79, 249, 79, 247, 77, 247, 75},
6864                          {245, 75, 243, 73, 243, 71, 241, 71, 239, 69, 239, 67, 237, 67, 235, 65},
6865                          {235, 63, 233, 63, 231, 61, 231, 59, 229, 59, 227, 57, 227, 55, 225, 55},
6866                          {223, 53, 223, 51, 221, 51, 219, 49, 219, 47, 217, 47, 215, 45, 215, 43},
6867                          {213, 43, 211, 41, 211, 39, 209, 39, 207, 37, 207, 35, 205, 35, 203, 33},
6868                          {203, 31, 201, 31, 199, 29, 199, 27, 197, 27, 195, 25, 195, 23, 193, 23},
6869                          {191, 21, 191, 19, 189, 19, 187, 17, 187, 15, 185, 15, 183, 13, 183, 11},
6870                          {181, 11, 179, 9, 179, 7, 177, 7, 175, 5, 175, 3, 173, 3, 171, 1}},
6871                         {{0x54ab, 0x5355, 0x51fd, 0x50a7, 0x4f51, 0x4df9, 0x4ca3, 0x4b4d},
6872                          {0x49f5, 0x489f, 0x4749, 0x45f1, 0x449b, 0x4345, 0x41ed, 0x4097},
6873                          {0x3f41, 0x3de9, 0x3c93, 0x3b3d, 0x39e5, 0x388f, 0x3739, 0x35e1},
6874                          {0x348b, 0x3335, 0x31dd, 0x3087, 0x2f31, 0x2dd9, 0x2c83, 0x2b2d},
6875                          {0x29d5, 0x287f, 0x2729, 0x25d1, 0x247b, 0x2325, 0x21cd, 0x2077},
6876                          {0x1f21, 0x1dc9, 0x1c73, 0x1b1d, 0x19c5, 0x186f, 0x1719, 0x15c1},
6877                          {0x146b, 0x1315, 0x11bd, 0x1067, 0x0f11, 0x0db9, 0x0c63, 0x0b0d},
6878                          {0x09b5, 0x085f, 0x0709, 0x05b1, 0x045b, 0x0305, 0x01ad, 0x0057}},
6879                         {{0x5353'aa01, 0x50a6'51fd, 0x4df8'f9fb, 0x4b4b'a1f9},
6880                          {0x489e'49f5, 0x45f0'f1f3, 0x4343'99f1, 0x4096'41ed},
6881                          {0x3de8'e9eb, 0x3b3b'91e9, 0x388e'39e5, 0x35e0'e1e3},
6882                          {0x3333'89e1, 0x3086'31dd, 0x2dd8'd9db, 0x2b2b'81d9},
6883                          {0x287e'29d5, 0x25d0'd1d3, 0x2323'79d1, 0x2076'21cd},
6884                          {0x1dc8'c9cb, 0x1b1b'71c9, 0x186e'19c5, 0x15c0'c1c3},
6885                          {0x1313'69c1, 0x1066'11bd, 0x0db8'b9bb, 0x0b0b'61b9},
6886                          {0x085e'09b5, 0x05b0'b1b3, 0x0303'59b1, 0x0056'01ad}},
6887                         {{0x50a6'51fc'fdfe'54ab, 0x4b4b'a1f7'a34e'4f51},
6888                          {0x45f0'f1f2'489e'49f5, 0x4096'41ec'edee'449b},
6889                          {0x3b3b'91e7'933e'3f41, 0x35e0'e1e2'388e'39e5},
6890                          {0x3086'31dc'ddde'348b, 0x2b2b'81d7'832e'2f31},
6891                          {0x25d0'd1d2'287e'29d5, 0x2076'21cc'cdce'247b},
6892                          {0x1b1b'71c7'731e'1f21, 0x15c0'c1c2'186e'19c5},
6893                          {0x1066'11bc'bdbe'146b, 0x0b0b'61b7'630e'0f11},
6894                          {0x05b0'b1b2'085e'09b5, 0x0056'01ac'adae'045b}},
6895                         kVectorCalculationsSource);
6896 
6897   TestVectorInstruction(ExecVssrlvv,
6898                         ExecMaskedVssrlvv,
6899                         {{0, 33, 1, 3, 2, 33, 1, 3, 4, 35, 1, 3, 12, 35, 1, 3},
6900                          {16, 37, 1, 3, 10, 37, 1, 3, 12, 39, 1, 3, 28, 39, 1, 3},
6901                          {32, 41, 3, 3, 18, 41, 3, 3, 20, 43, 3, 3, 44, 43, 3, 3},
6902                          {48, 45, 3, 3, 26, 45, 3, 3, 28, 47, 3, 3, 60, 47, 3, 3},
6903                          {64, 49, 5, 3, 34, 49, 5, 3, 36, 51, 5, 3, 76, 51, 5, 3},
6904                          {80, 53, 5, 3, 42, 53, 5, 3, 44, 55, 5, 3, 92, 55, 5, 3},
6905                          {96, 57, 7, 3, 50, 57, 7, 3, 52, 59, 7, 3, 108, 59, 7, 3},
6906                          {112, 61, 7, 3, 58, 61, 7, 3, 60, 63, 7, 3, 124, 63, 7, 3}},
6907                         {{0x8100, 0x0831, 0x0043, 0x0009, 0x4484, 0x08b1, 0x008d, 0x0009},
6908                          {0x9110, 0x0931, 0x004b, 0x0009, 0x4c8c, 0x09b1, 0x009d, 0x0009},
6909                          {0xa120, 0x0a33, 0x0053, 0x000b, 0x5494, 0x0ab3, 0x00ad, 0x000b},
6910                          {0xb130, 0x0b33, 0x005b, 0x000b, 0x5c9c, 0x0bb3, 0x00bd, 0x000b},
6911                          {0xc140, 0x0c35, 0x0063, 0x000d, 0x64a4, 0x0cb5, 0x00cd, 0x000d},
6912                          {0xd150, 0x0d35, 0x006b, 0x000d, 0x6cac, 0x0db5, 0x00dd, 0x000d},
6913                          {0xe160, 0x0e37, 0x0073, 0x000f, 0x74b4, 0x0eb7, 0x00ed, 0x000f},
6914                          {0xf170, 0x0f37, 0x007b, 0x000f, 0x7cbc, 0x0fb7, 0x00fd, 0x000f}},
6915                         {{0x8302'8100, 0x0043'8343, 0x0000'4585, 0x0000'008f},
6916                          {0x9312'9110, 0x004b'8b4b, 0x0000'4d8d, 0x0000'009f},
6917                          {0xa322'a120, 0x0053'9353, 0x0000'5595, 0x0000'00af},
6918                          {0xb332'b130, 0x005b'9b5b, 0x0000'5d9d, 0x0000'00bf},
6919                          {0xc342'c140, 0x0063'a363, 0x0000'65a5, 0x0000'00cf},
6920                          {0xd352'd150, 0x006b'ab6b, 0x0000'6dad, 0x0000'00df},
6921                          {0xe362'e160, 0x0073'b373, 0x0000'75b5, 0x0000'00ef},
6922                          {0xf372'f170, 0x007b'bb7b, 0x0000'7dbd, 0x0000'00ff}},
6923                         {{0x8706'8504'8302'8100, 0x0000'4787'4686'4585},
6924                          {0x0000'0000'9716'9515, 0x0000'0000'0000'4f8f},
6925                          {0xa726'a524'a322'a120, 0x0000'5797'5696'5595},
6926                          {0x0000'0000'b736'b535, 0x0000'0000'0000'5f9f},
6927                          {0xc746'c544'c342'c140, 0x0000'67a7'66a6'65a5},
6928                          {0x0000'0000'd756'd555, 0x0000'0000'0000'6faf},
6929                          {0xe766'e564'e362'e160, 0x0000'77b7'76b6'75b5},
6930                          {0x0000'0000'f776'f575, 0x0000'0000'0000'7fbf}},
6931                         kVectorCalculationsSource);
6932 
6933   TestVectorInstruction(ExecVssrlvx,
6934                         ExecMaskedVssrlvx,
6935                         {{0, 33, 1, 33, 1, 33, 1, 33, 2, 35, 3, 35, 3, 35, 3, 35},
6936                          {4, 37, 5, 37, 5, 37, 5, 37, 6, 39, 7, 39, 7, 39, 7, 39},
6937                          {8, 41, 9, 41, 9, 41, 9, 41, 10, 43, 11, 43, 11, 43, 11, 43},
6938                          {12, 45, 13, 45, 13, 45, 13, 45, 14, 47, 15, 47, 15, 47, 15, 47},
6939                          {16, 49, 17, 49, 17, 49, 17, 49, 18, 51, 19, 51, 19, 51, 19, 51},
6940                          {20, 53, 21, 53, 21, 53, 21, 53, 22, 55, 23, 55, 23, 55, 23, 55},
6941                          {24, 57, 25, 57, 25, 57, 25, 57, 26, 59, 27, 59, 27, 59, 27, 59},
6942                          {28, 61, 29, 61, 29, 61, 29, 61, 30, 63, 31, 63, 31, 63, 31, 63}},
6943                         {{0x0021, 0x0021, 0x0021, 0x0021, 0x0023, 0x0023, 0x0023, 0x0023},
6944                          {0x0025, 0x0025, 0x0025, 0x0025, 0x0027, 0x0027, 0x0027, 0x0027},
6945                          {0x0029, 0x0029, 0x0029, 0x0029, 0x002b, 0x002b, 0x002b, 0x002b},
6946                          {0x002d, 0x002d, 0x002d, 0x002d, 0x002f, 0x002f, 0x002f, 0x002f},
6947                          {0x0031, 0x0031, 0x0031, 0x0031, 0x0033, 0x0033, 0x0033, 0x0033},
6948                          {0x0035, 0x0035, 0x0035, 0x0035, 0x0037, 0x0037, 0x0037, 0x0037},
6949                          {0x0039, 0x0039, 0x0039, 0x0039, 0x003b, 0x003b, 0x003b, 0x003b},
6950                          {0x003d, 0x003d, 0x003d, 0x003d, 0x003f, 0x003f, 0x003f, 0x003f}},
6951                         {{0x0020'c0a1, 0x0021'c1a1, 0x0022'c2a3, 0x0023'c3a3},
6952                          {0x0024'c4a5, 0x0025'c5a5, 0x0026'c6a7, 0x0027'c7a7},
6953                          {0x0028'c8a9, 0x0029'c9a9, 0x002a'caab, 0x002b'cbab},
6954                          {0x002c'ccad, 0x002d'cdad, 0x002e'ceaf, 0x002f'cfaf},
6955                          {0x0030'd0b1, 0x0031'd1b1, 0x0032'd2b3, 0x0033'd3b3},
6956                          {0x0034'd4b5, 0x0035'd5b5, 0x0036'd6b7, 0x0037'd7b7},
6957                          {0x0038'd8b9, 0x0039'd9b9, 0x003a'dabb, 0x003b'dbbb},
6958                          {0x003c'dcbd, 0x003d'ddbd, 0x003e'debf, 0x003f'dfbf}},
6959                         {{0x0000'0000'0021'c1a1, 0x0000'0000'0023'c3a3},
6960                          {0x0000'0000'0025'c5a5, 0x0000'0000'0027'c7a7},
6961                          {0x0000'0000'0029'c9a9, 0x0000'0000'002b'cbab},
6962                          {0x0000'0000'002d'cdad, 0x0000'0000'002f'cfaf},
6963                          {0x0000'0000'0031'd1b1, 0x0000'0000'0033'd3b3},
6964                          {0x0000'0000'0035'd5b5, 0x0000'0000'0037'd7b7},
6965                          {0x0000'0000'0039'd9b9, 0x0000'0000'003b'dbbb},
6966                          {0x0000'0000'003d'ddbd, 0x0000'0000'003f'dfbf}},
6967                         kVectorCalculationsSource);
6968 
6969   TestVectorInstruction(ExecVssrlvi,
6970                         ExecMaskedVssrlvi,
6971                         {{0, 33, 1, 33, 1, 33, 1, 33, 2, 35, 3, 35, 3, 35, 3, 35},
6972                          {4, 37, 5, 37, 5, 37, 5, 37, 6, 39, 7, 39, 7, 39, 7, 39},
6973                          {8, 41, 9, 41, 9, 41, 9, 41, 10, 43, 11, 43, 11, 43, 11, 43},
6974                          {12, 45, 13, 45, 13, 45, 13, 45, 14, 47, 15, 47, 15, 47, 15, 47},
6975                          {16, 49, 17, 49, 17, 49, 17, 49, 18, 51, 19, 51, 19, 51, 19, 51},
6976                          {20, 53, 21, 53, 21, 53, 21, 53, 22, 55, 23, 55, 23, 55, 23, 55},
6977                          {24, 57, 25, 57, 25, 57, 25, 57, 26, 59, 27, 59, 27, 59, 27, 59},
6978                          {28, 61, 29, 61, 29, 61, 29, 61, 30, 63, 31, 63, 31, 63, 31, 63}},
6979                         {{0x0021, 0x0021, 0x0021, 0x0021, 0x0023, 0x0023, 0x0023, 0x0023},
6980                          {0x0025, 0x0025, 0x0025, 0x0025, 0x0027, 0x0027, 0x0027, 0x0027},
6981                          {0x0029, 0x0029, 0x0029, 0x0029, 0x002b, 0x002b, 0x002b, 0x002b},
6982                          {0x002d, 0x002d, 0x002d, 0x002d, 0x002f, 0x002f, 0x002f, 0x002f},
6983                          {0x0031, 0x0031, 0x0031, 0x0031, 0x0033, 0x0033, 0x0033, 0x0033},
6984                          {0x0035, 0x0035, 0x0035, 0x0035, 0x0037, 0x0037, 0x0037, 0x0037},
6985                          {0x0039, 0x0039, 0x0039, 0x0039, 0x003b, 0x003b, 0x003b, 0x003b},
6986                          {0x003d, 0x003d, 0x003d, 0x003d, 0x003f, 0x003f, 0x003f, 0x003f}},
6987                         {{0x0020'c0a1, 0x0021'c1a1, 0x0022'c2a3, 0x0023'c3a3},
6988                          {0x0024'c4a5, 0x0025'c5a5, 0x0026'c6a7, 0x0027'c7a7},
6989                          {0x0028'c8a9, 0x0029'c9a9, 0x002a'caab, 0x002b'cbab},
6990                          {0x002c'ccad, 0x002d'cdad, 0x002e'ceaf, 0x002f'cfaf},
6991                          {0x0030'd0b1, 0x0031'd1b1, 0x0032'd2b3, 0x0033'd3b3},
6992                          {0x0034'd4b5, 0x0035'd5b5, 0x0036'd6b7, 0x0037'd7b7},
6993                          {0x0038'd8b9, 0x0039'd9b9, 0x003a'dabb, 0x003b'dbbb},
6994                          {0x003c'dcbd, 0x003d'ddbd, 0x003e'debf, 0x003f'dfbf}},
6995                         {{0x0021'c1a1'4120'c0a1, 0x0023'c3a3'4322'c2a3},
6996                          {0x0025'c5a5'4524'c4a5, 0x0027'c7a7'4726'c6a7},
6997                          {0x0029'c9a9'4928'c8a9, 0x002b'cbab'4b2a'caab},
6998                          {0x002d'cdad'4d2c'ccad, 0x002f'cfaf'4f2e'ceaf},
6999                          {0x0031'd1b1'5130'd0b1, 0x0033'd3b3'5332'd2b3},
7000                          {0x0035'd5b5'5534'd4b5, 0x0037'd7b7'5736'd6b7},
7001                          {0x0039'd9b9'5938'd8b9, 0x003b'dbbb'5b3a'dabb},
7002                          {0x003d'ddbd'5d3c'dcbd, 0x003f'dfbf'5f3e'debf}},
7003                         kVectorCalculationsSource);
7004 
7005   TestVectorInstruction(ExecVssravv,
7006                         ExecMaskedVssravv,
7007                         {{0, 225, 1, 255, 2, 225, 1, 255, 4, 227, 1, 255, 12, 227, 1, 255},
7008                          {16, 229, 1, 255, 10, 229, 1, 255, 12, 231, 1, 255, 28, 231, 1, 255},
7009                          {32, 233, 3, 255, 18, 233, 3, 255, 20, 235, 3, 255, 44, 235, 3, 255},
7010                          {48, 237, 3, 255, 26, 237, 3, 255, 28, 239, 3, 255, 60, 239, 3, 255},
7011                          {64, 241, 5, 255, 34, 241, 5, 255, 36, 243, 5, 255, 76, 243, 5, 255},
7012                          {80, 245, 5, 255, 42, 245, 5, 255, 44, 247, 5, 255, 92, 247, 5, 255},
7013                          {96, 249, 7, 255, 50, 249, 7, 255, 52, 251, 7, 255, 108, 251, 7, 255},
7014                          {112, 253, 7, 255, 58, 253, 7, 255, 60, 255, 7, 255, 124, 255, 7, 255}},
7015                         {{0x8100, 0xf831, 0xffc3, 0xfff9, 0xc484, 0xf8b1, 0xff8d, 0xfff9},
7016                          {0x9110, 0xf931, 0xffcb, 0xfff9, 0xcc8c, 0xf9b1, 0xff9d, 0xfff9},
7017                          {0xa120, 0xfa33, 0xffd3, 0xfffb, 0xd494, 0xfab3, 0xffad, 0xfffb},
7018                          {0xb130, 0xfb33, 0xffdb, 0xfffb, 0xdc9c, 0xfbb3, 0xffbd, 0xfffb},
7019                          {0xc140, 0xfc35, 0xffe3, 0xfffd, 0xe4a4, 0xfcb5, 0xffcd, 0xfffd},
7020                          {0xd150, 0xfd35, 0xffeb, 0xfffd, 0xecac, 0xfdb5, 0xffdd, 0xfffd},
7021                          {0xe160, 0xfe37, 0xfff3, 0xffff, 0xf4b4, 0xfeb7, 0xffed, 0xffff},
7022                          {0xf170, 0xff37, 0xfffb, 0xffff, 0xfcbc, 0xffb7, 0xfffd, 0xffff}},
7023                         {{0x8302'8100, 0xffc3'8343, 0xffff'c585, 0xffff'ff8f},
7024                          {0x9312'9110, 0xffcb'8b4b, 0xffff'cd8d, 0xffff'ff9f},
7025                          {0xa322'a120, 0xffd3'9353, 0xffff'd595, 0xffff'ffaf},
7026                          {0xb332'b130, 0xffdb'9b5b, 0xffff'dd9d, 0xffff'ffbf},
7027                          {0xc342'c140, 0xffe3'a363, 0xffff'e5a5, 0xffff'ffcf},
7028                          {0xd352'd150, 0xffeb'ab6b, 0xffff'edad, 0xffff'ffdf},
7029                          {0xe362'e160, 0xfff3'b373, 0xffff'f5b5, 0xffff'ffef},
7030                          {0xf372'f170, 0xfffb'bb7b, 0xffff'fdbd, 0xffff'ffff}},
7031                         {{0x8706'8504'8302'8100, 0xffff'c787'4686'4585},
7032                          {0xffff'ffff'9716'9515, 0xffff'ffff'ffff'cf8f},
7033                          {0xa726'a524'a322'a120, 0xffff'd797'5696'5595},
7034                          {0xffff'ffff'b736'b535, 0xffff'ffff'ffff'df9f},
7035                          {0xc746'c544'c342'c140, 0xffff'e7a7'66a6'65a5},
7036                          {0xffff'ffff'd756'd555, 0xffff'ffff'ffff'efaf},
7037                          {0xe766'e564'e362'e160, 0xffff'f7b7'76b6'75b5},
7038                          {0xffff'ffff'f776'f575, 0xffff'ffff'ffff'ffbf}},
7039                         kVectorCalculationsSource);
7040 
7041   TestVectorInstruction(ExecVssravx,
7042                         ExecMaskedVssravx,
7043                         {{0, 225, 1, 225, 1, 225, 1, 225, 2, 227, 3, 227, 3, 227, 3, 227},
7044                          {4, 229, 5, 229, 5, 229, 5, 229, 6, 231, 7, 231, 7, 231, 7, 231},
7045                          {8, 233, 9, 233, 9, 233, 9, 233, 10, 235, 11, 235, 11, 235, 11, 235},
7046                          {12, 237, 13, 237, 13, 237, 13, 237, 14, 239, 15, 239, 15, 239, 15, 239},
7047                          {16, 241, 17, 241, 17, 241, 17, 241, 18, 243, 19, 243, 19, 243, 19, 243},
7048                          {20, 245, 21, 245, 21, 245, 21, 245, 22, 247, 23, 247, 23, 247, 23, 247},
7049                          {24, 249, 25, 249, 25, 249, 25, 249, 26, 251, 27, 251, 27, 251, 27, 251},
7050                          {28, 253, 29, 253, 29, 253, 29, 253, 30, 255, 31, 255, 31, 255, 31, 255}},
7051                         {{0xffe1, 0xffe1, 0xffe1, 0xffe1, 0xffe3, 0xffe3, 0xffe3, 0xffe3},
7052                          {0xffe5, 0xffe5, 0xffe5, 0xffe5, 0xffe7, 0xffe7, 0xffe7, 0xffe7},
7053                          {0xffe9, 0xffe9, 0xffe9, 0xffe9, 0xffeb, 0xffeb, 0xffeb, 0xffeb},
7054                          {0xffed, 0xffed, 0xffed, 0xffed, 0xffef, 0xffef, 0xffef, 0xffef},
7055                          {0xfff1, 0xfff1, 0xfff1, 0xfff1, 0xfff3, 0xfff3, 0xfff3, 0xfff3},
7056                          {0xfff5, 0xfff5, 0xfff5, 0xfff5, 0xfff7, 0xfff7, 0xfff7, 0xfff7},
7057                          {0xfff9, 0xfff9, 0xfff9, 0xfff9, 0xfffb, 0xfffb, 0xfffb, 0xfffb},
7058                          {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xffff, 0xffff, 0xffff, 0xffff}},
7059                         {{0xffe0'c0a1, 0xffe1'c1a1, 0xffe2'c2a3, 0xffe3'c3a3},
7060                          {0xffe4'c4a5, 0xffe5'c5a5, 0xffe6'c6a7, 0xffe7'c7a7},
7061                          {0xffe8'c8a9, 0xffe9'c9a9, 0xffea'caab, 0xffeb'cbab},
7062                          {0xffec'ccad, 0xffed'cdad, 0xffee'ceaf, 0xffef'cfaf},
7063                          {0xfff0'd0b1, 0xfff1'd1b1, 0xfff2'd2b3, 0xfff3'd3b3},
7064                          {0xfff4'd4b5, 0xfff5'd5b5, 0xfff6'd6b7, 0xfff7'd7b7},
7065                          {0xfff8'd8b9, 0xfff9'd9b9, 0xfffa'dabb, 0xfffb'dbbb},
7066                          {0xfffc'dcbd, 0xfffd'ddbd, 0xfffe'debf, 0xffff'dfbf}},
7067                         {{0xffff'ffff'ffe1'c1a1, 0xffff'ffff'ffe3'c3a3},
7068                          {0xffff'ffff'ffe5'c5a5, 0xffff'ffff'ffe7'c7a7},
7069                          {0xffff'ffff'ffe9'c9a9, 0xffff'ffff'ffeb'cbab},
7070                          {0xffff'ffff'ffed'cdad, 0xffff'ffff'ffef'cfaf},
7071                          {0xffff'ffff'fff1'd1b1, 0xffff'ffff'fff3'd3b3},
7072                          {0xffff'ffff'fff5'd5b5, 0xffff'ffff'fff7'd7b7},
7073                          {0xffff'ffff'fff9'd9b9, 0xffff'ffff'fffb'dbbb},
7074                          {0xffff'ffff'fffd'ddbd, 0xffff'ffff'ffff'dfbf}},
7075                         kVectorCalculationsSource);
7076 
7077   TestVectorInstruction(ExecVssravi,
7078                         ExecMaskedVssravi,
7079                         {{0, 225, 1, 225, 1, 225, 1, 225, 2, 227, 3, 227, 3, 227, 3, 227},
7080                          {4, 229, 5, 229, 5, 229, 5, 229, 6, 231, 7, 231, 7, 231, 7, 231},
7081                          {8, 233, 9, 233, 9, 233, 9, 233, 10, 235, 11, 235, 11, 235, 11, 235},
7082                          {12, 237, 13, 237, 13, 237, 13, 237, 14, 239, 15, 239, 15, 239, 15, 239},
7083                          {16, 241, 17, 241, 17, 241, 17, 241, 18, 243, 19, 243, 19, 243, 19, 243},
7084                          {20, 245, 21, 245, 21, 245, 21, 245, 22, 247, 23, 247, 23, 247, 23, 247},
7085                          {24, 249, 25, 249, 25, 249, 25, 249, 26, 251, 27, 251, 27, 251, 27, 251},
7086                          {28, 253, 29, 253, 29, 253, 29, 253, 30, 255, 31, 255, 31, 255, 31, 255}},
7087                         {{0xffe1, 0xffe1, 0xffe1, 0xffe1, 0xffe3, 0xffe3, 0xffe3, 0xffe3},
7088                          {0xffe5, 0xffe5, 0xffe5, 0xffe5, 0xffe7, 0xffe7, 0xffe7, 0xffe7},
7089                          {0xffe9, 0xffe9, 0xffe9, 0xffe9, 0xffeb, 0xffeb, 0xffeb, 0xffeb},
7090                          {0xffed, 0xffed, 0xffed, 0xffed, 0xffef, 0xffef, 0xffef, 0xffef},
7091                          {0xfff1, 0xfff1, 0xfff1, 0xfff1, 0xfff3, 0xfff3, 0xfff3, 0xfff3},
7092                          {0xfff5, 0xfff5, 0xfff5, 0xfff5, 0xfff7, 0xfff7, 0xfff7, 0xfff7},
7093                          {0xfff9, 0xfff9, 0xfff9, 0xfff9, 0xfffb, 0xfffb, 0xfffb, 0xfffb},
7094                          {0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xffff, 0xffff, 0xffff, 0xffff}},
7095                         {{0xffe0'c0a1, 0xffe1'c1a1, 0xffe2'c2a3, 0xffe3'c3a3},
7096                          {0xffe4'c4a5, 0xffe5'c5a5, 0xffe6'c6a7, 0xffe7'c7a7},
7097                          {0xffe8'c8a9, 0xffe9'c9a9, 0xffea'caab, 0xffeb'cbab},
7098                          {0xffec'ccad, 0xffed'cdad, 0xffee'ceaf, 0xffef'cfaf},
7099                          {0xfff0'd0b1, 0xfff1'd1b1, 0xfff2'd2b3, 0xfff3'd3b3},
7100                          {0xfff4'd4b5, 0xfff5'd5b5, 0xfff6'd6b7, 0xfff7'd7b7},
7101                          {0xfff8'd8b9, 0xfff9'd9b9, 0xfffa'dabb, 0xfffb'dbbb},
7102                          {0xfffc'dcbd, 0xfffd'ddbd, 0xfffe'debf, 0xffff'dfbf}},
7103                         {{0xffe1'c1a1'4120'c0a1, 0xffe3'c3a3'4322'c2a3},
7104                          {0xffe5'c5a5'4524'c4a5, 0xffe7'c7a7'4726'c6a7},
7105                          {0xffe9'c9a9'4928'c8a9, 0xffeb'cbab'4b2a'caab},
7106                          {0xffed'cdad'4d2c'ccad, 0xffef'cfaf'4f2e'ceaf},
7107                          {0xfff1'd1b1'5130'd0b1, 0xfff3'd3b3'5332'd2b3},
7108                          {0xfff5'd5b5'5534'd4b5, 0xfff7'd7b7'5736'd6b7},
7109                          {0xfff9'd9b9'5938'd8b9, 0xfffb'dbbb'5b3a'dabb},
7110                          {0xfffd'ddbd'5d3c'dcbd, 0xffff'dfbf'5f3e'debf}},
7111                         kVectorCalculationsSource);
7112   asm volatile("csrw vxrm, %0\n\t" ::"r"(vxrm));
7113 }
7114 
ExecVfdivvv()7115 [[gnu::naked]] void ExecVfdivvv() {
7116   asm("vfdiv.vv  v8, v16, v24\n\t"
7117       "ret\n\t");
7118 }
7119 
ExecMaskedVfdivvv()7120 [[gnu::naked]] void ExecMaskedVfdivvv() {
7121   asm("vfdiv.vv  v8, v16, v24, v0.t\n\t"
7122       "ret\n\t");
7123 }
7124 
ExecVfdivvf()7125 [[gnu::naked]] void ExecVfdivvf() {
7126   asm("vfdiv.vf  v8, v16, ft0\n\t"
7127       "ret\n\t");
7128 }
7129 
ExecMaskedVfdivvf()7130 [[gnu::naked]] void ExecMaskedVfdivvf() {
7131   asm("vfdiv.vf  v8, v16, ft0, v0.t\n\t"
7132       "ret\n\t");
7133 }
7134 
ExecVfrdivvf()7135 [[gnu::naked]] void ExecVfrdivvf() {
7136   asm("vfrdiv.vf  v8, v16, ft0\n\t"
7137       "ret\n\t");
7138 }
7139 
ExecMaskedVfrdivvf()7140 [[gnu::naked]] void ExecMaskedVfrdivvf() {
7141   asm("vfrdiv.vf  v8, v16, ft0, v0.t\n\t"
7142       "ret\n\t");
7143 }
7144 
ExecVdivuvv()7145 [[gnu::naked]] void ExecVdivuvv() {
7146   asm("vdivu.vv  v8, v16, v24\n\t"
7147       "ret\n\t");
7148 }
7149 
ExecMaskedVdivuvv()7150 [[gnu::naked]] void ExecMaskedVdivuvv() {
7151   asm("vdivu.vv  v8, v16, v24, v0.t\n\t"
7152       "ret\n\t");
7153 }
7154 
ExecVdivvv()7155 [[gnu::naked]] void ExecVdivvv() {
7156   asm("vdiv.vv  v8, v16, v24\n\t"
7157       "ret\n\t");
7158 }
7159 
ExecMaskedVdivvv()7160 [[gnu::naked]] void ExecMaskedVdivvv() {
7161   asm("vdiv.vv  v8, v16, v24, v0.t\n\t"
7162       "ret\n\t");
7163 }
7164 
ExecVdivuvx()7165 [[gnu::naked]] void ExecVdivuvx() {
7166   asm("vdivu.vx  v8, v16, t0\n\t"
7167       "ret\n\t");
7168 }
7169 
ExecMaskedVdivuvx()7170 [[gnu::naked]] void ExecMaskedVdivuvx() {
7171   asm("vdivu.vx  v8, v16, t0, v0.t\n\t"
7172       "ret\n\t");
7173 }
7174 
ExecVdivvx()7175 [[gnu::naked]] void ExecVdivvx() {
7176   asm("vdiv.vx  v8, v16, t0\n\t"
7177       "ret\n\t");
7178 }
7179 
ExecMaskedVdivvx()7180 [[gnu::naked]] void ExecMaskedVdivvx() {
7181   asm("vdiv.vx  v8, v16, t0, v0.t\n\t"
7182       "ret\n\t");
7183 }
7184 
TEST(InlineAsmTestRiscv64,TestVdiv)7185 TEST(InlineAsmTestRiscv64, TestVdiv) {
7186   TestVectorFloatInstruction(ExecVfdivvv,
7187                              ExecMaskedVfdivvv,
7188                              {{0xbc7d'1561, 0xb875'e8eb, 0xb46f'83ae, 0xb069'c6ec},
7189                               {0xac64'99e5, 0xa85f'e87d, 0xa45b'a22e, 0xa057'b943},
7190                               {0x9c54'2241, 0x9850'd382, 0x944d'c4d2, 0x904a'ef31},
7191                               {0x8c48'4c98, 0x8845'd7d4, 0x8443'8c62, 0x8060'b328},
7192                               {0x7c3c'206f, 0x7835'0888, 0x742e'b4f5, 0x7029'0782},
7193                               {0x6c23'e7dc, 0x681f'423a, 0x641b'0659, 0x6017'26b8},
7194                               {0x5c13'980b, 0x5810'50ca, 0x540d'48e2, 0x500a'7968},
7195                               {0x4c07'dc6c, 0x4805'6ccb, 0x4403'260f, 0x4001'0454}},
7196                              {{0xb8e9'b361'617b'3332, 0xb0e1'64f5'e24e'7813},
7197                               {0xa8d9'a850'c33d'b3c7, 0xa0d1'5a44'cf64'f786},
7198                               {0x98c9'9d59'4646'6ce0, 0x90c1'4fab'f702'438e},
7199                               {0x88b9'927a'9559'd99b, 0x80b1'452b'0727'cc70},
7200                               {0x78a9'87b4'5cbc'33ee, 0x70a1'3ac1'af47'5dc7},
7201                               {0x6899'7d06'4a29'0e6f, 0x6091'306f'a03b'130b},
7202                               {0x5889'7270'0ccb'2650, 0x5081'2634'8c3d'81c9},
7203                               {0x4879'67f1'5534'6be6, 0x4071'1c10'26e2'17fd}},
7204                              kVectorCalculationsSourceLegacy);
7205   TestVectorFloatInstruction(ExecVfdivvf,
7206                              ExecMaskedVfdivvf,
7207                              {{0x81b9'9b06, 0x85bf'5117, 0x89c5'0728, 0x8dca'bd39},
7208                               {0x91d0'734a, 0x95d6'295b, 0x99db'df6c, 0x9de1'957d},
7209                               {0xa1e7'4b8e, 0xa5ed'019f, 0xa9f2'b7b0, 0xadf8'6dc1},
7210                               {0xb1fe'23d2, 0xb601'ecf2, 0xba04'c7fa, 0xbe07'a303},
7211                               {0xc20a'7e0b, 0xc60d'5914, 0xca10'341c, 0xce13'0f25},
7212                               {0xd215'ea2e, 0xd618'c536, 0xda1b'a03f, 0xde1e'7b47},
7213                               {0xe221'5650, 0xe624'3158, 0xea27'0c61, 0xee29'e769},
7214                               {0xf22c'c272, 0xf62f'9d7a, 0xfa32'7883, 0xfe35'538b}},
7215                              {{0x86e0'0391'6e3a'ab61, 0x8ee5'b9a2'8501'cd89},
7216                               {0x96f0'0efd'9068'39a5, 0x9ef5'c50e'a72f'5bcd},
7217                               {0xa700'1a69'b295'c7e9, 0xaf05'd07a'c95c'ea11},
7218                               {0xb710'25d5'd4c3'562e, 0xbf15'dbe6'eb8a'7855},
7219                               {0xc720'3141'f6f0'e472, 0xcf25'e753'0db8'069a},
7220                               {0xd730'3cae'191e'72b6, 0xdf35'f2bf'2fe5'94de},
7221                               {0xe740'481a'3b4c'00fa, 0xef45'fe2b'5213'2322},
7222                               {0xf750'5386'5d79'8f3f, 0xff56'0997'7440'b166}},
7223                              kVectorCalculationsSourceLegacy);
7224   TestVectorFloatInstruction(ExecVfrdivvf,
7225                              ExecMaskedVfrdivvf,
7226                              {{0xfd30'8be3, 0xf92b'46b3, 0xf526'4fba, 0xf121'a05c},
7227                               {0xed1d'32b7, 0xe919'0189, 0xe515'081b, 0xe111'4231},
7228                               {0xdd0d'abfb, 0xd90a'4206, 0xd507'0132, 0xd103'e6a8},
7229                               {0xcd00'efd5, 0xc8fc'34b9, 0xc4f6'c831, 0xc0f1'9620},
7230                               {0xbcec'9ae8, 0xb8e7'd337, 0xb4e3'3bfd, 0xb0de'd268},
7231                               {0xacda'93da, 0xa8d6'7deb, 0xa4d2'8e5f, 0xa0ce'c322},
7232                               {0x9ccb'1a46, 0x98c7'9200, 0x94c4'28a6, 0x90c0'dca6},
7233                               {0x8cbd'ac8d, 0x88ba'96ff, 0x84b7'9ab5, 0x80b4'b67d}},
7234                              {{0xf8ff'f8de'ba96'50ff, 0xf0f7'9132'204d'3f73},
7235                               {0xe8ef'e220'dbd5'38e4, 0xe0e7'84d4'8fe3'51e3},
7236                               {0xd8df'cb83'4048'7bb7, 0xd0d7'7883'f290'f6d8},
7237                               {0xc8cf'b505'a379'43a3, 0xc0c7'6c40'3409'4932},
7238                               {0xb8bf'9ea7'c1b1'e9b5, 0xb0b7'6009'4029'bc36},
7239                               {0xa8af'8869'57fb'4e5c, 0xa0a7'53df'02f9'ad62},
7240                               {0x989f'724a'241a'3d11, 0x9097'47c1'68a9'f793},
7241                               {0x888f'5c49'e48c'db01, 0x8087'3bb0'5d94'877b}},
7242                              kVectorCalculationsSourceLegacy);
7243 
7244   TestVectorInstruction(ExecVdivuvv,
7245                         ExecMaskedVdivuvv,
7246                         {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
7247                          {10, 3, 10, 3, 15, 15, 15, 15, 0, 0, 10, 3, 15, 15, 15, 15},
7248                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7249                          {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
7250                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
7251                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
7252                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7253                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
7254                         {{0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
7255                          {0x0003, 0x0003, 0x000f, 0x000f, 0x0000, 0x0003, 0x000f, 0x000f},
7256                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7257                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000},
7258                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
7259                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
7260                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7261                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
7262                         {{0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7263                          {0x0000'0003, 0x0000'000f, 0x0000'0003, 0x0000'000f},
7264                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7265                          {0x0000'0001, 0x0000'0001, 0x0000'0000, 0x0000'0000},
7266                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7267                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7268                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7269                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
7270                         {{0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7271                          {0x0000'0000'0000'000e, 0x0000'0000'0000'000e},
7272                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7273                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0000},
7274                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7275                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7276                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7277                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
7278                         kVectorComparisonSource);
7279 
7280   TestVectorInstruction(ExecVdivvv,
7281                         ExecMaskedVdivvv,
7282                         {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
7283                          {252, 3, 252, 3, 0, 0, 0, 0, 0, 0, 252, 3, 0, 0, 0, 0},
7284                          {255, 192, 255, 192, 255, 192, 255, 192, 0, 0, 0, 0, 0, 128, 255, 192},
7285                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7286                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7287                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7288                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2},
7289                          {2, 2, 3, 3, 3, 3, 4, 4, 5, 6, 7, 8, 10, 14, 21, 43}},
7290                         {{0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
7291                          {0x0003, 0x0003, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0x0000},
7292                          {0xfbbb, 0xfbbb, 0xfbbb, 0xfbbb, 0x0000, 0x0000, 0x0888, 0xfbbb},
7293                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7294                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7295                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7296                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0001, 0x0002},
7297                          {0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0009, 0x0011, 0x0055}},
7298                         {{0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7299                          {0x0000'0003, 0x0000'0000, 0x0000'0003, 0x0000'0000},
7300                          {0xffff'fb6d, 0xffff'fb6d, 0x0000'0000, 0xffff'fb6d},
7301                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7302                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7303                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7304                          {0x0000'0001, 0x0000'0001, 0x0000'0002, 0x0000'0002},
7305                          {0x0000'0003, 0x0000'0005, 0x0000'0009, 0x0000'0055}},
7306                         {{0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7307                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7308                          {0xffff'ffff'ffff'fb6d, 0xffff'ffff'ffff'fb6d},
7309                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7310                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7311                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7312                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0002},
7313                          {0x0000'0000'0000'0005, 0x0000'0000'0000'0055}},
7314                         kVectorComparisonSource);
7315 
7316   TestVectorInstruction(ExecVdivuvx,
7317                         ExecMaskedVdivuvx,
7318                         {{0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1},
7319                          {1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1},
7320                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7321                          {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
7322                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
7323                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
7324                          {1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0},
7325                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
7326                         {{0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0001},
7327                          {0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0x0000, 0x0001, 0x0001},
7328                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7329                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000},
7330                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
7331                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001},
7332                          {0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000},
7333                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
7334                         {{0x0000'0001, 0x0000'0001, 0x0000'0000, 0x0000'0001},
7335                          {0x0000'0000, 0x0000'0001, 0x0000'0000, 0x0000'0001},
7336                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7337                          {0x0000'0001, 0x0000'0001, 0x0000'0000, 0x0000'0000},
7338                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7339                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7340                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7341                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
7342                         {{0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7343                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7344                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7345                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0000},
7346                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7347                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7348                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7349                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
7350                         kVectorComparisonSource);
7351 
7352   TestVectorInstruction(ExecVdivvx,
7353                         ExecMaskedVdivvx,
7354                         {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7355                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7356                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
7357                          {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
7358                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7359                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
7360                          {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1},
7361                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
7362                         {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7363                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7364                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000},
7365                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000},
7366                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7367                          {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
7368                          {0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001},
7369                          {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001}},
7370                         {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7371                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7372                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7373                          {0x0000'0001, 0x0000'0001, 0x0000'0000, 0x0000'0000},
7374                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7375                          {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
7376                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001},
7377                          {0x0000'0001, 0x0000'0001, 0x0000'0001, 0x0000'0001}},
7378                         {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7379                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7380                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7381                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0000},
7382                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7383                          {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
7384                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001},
7385                          {0x0000'0000'0000'0001, 0x0000'0000'0000'0001}},
7386                         kVectorComparisonSource);
7387 }
7388 
ExecVmaccvv()7389 [[gnu::naked]] void ExecVmaccvv() {
7390   asm("vmacc.vv  v8, v16, v24\n\t"
7391       "ret\n\t");
7392 }
7393 
ExecMaskedVmaccvv()7394 [[gnu::naked]] void ExecMaskedVmaccvv() {
7395   asm("vmacc.vv  v8, v16, v24, v0.t\n\t"
7396       "ret\n\t");
7397 }
7398 
ExecVmaccvx()7399 [[gnu::naked]] void ExecVmaccvx() {
7400   asm("vmacc.vx  v8, t0, v16\n\t"
7401       "ret\n\t");
7402 }
7403 
ExecMaskedVmaccvx()7404 [[gnu::naked]] void ExecMaskedVmaccvx() {
7405   asm("vmacc.vx  v8, t0, v16, v0.t\n\t"
7406       "ret\n\t");
7407 }
7408 
ExecVwmaccuvv()7409 [[gnu::naked]] void ExecVwmaccuvv() {
7410   asm("vwmaccu.vv  v8, v16, v24\n\t"
7411       "ret\n\t");
7412 }
7413 
ExecMaskedVwmaccuvv()7414 [[gnu::naked]] void ExecMaskedVwmaccuvv() {
7415   asm("vwmaccu.vv  v8, v16, v24, v0.t\n\t"
7416       "ret\n\t");
7417 }
7418 
ExecVwmaccuvx()7419 [[gnu::naked]] void ExecVwmaccuvx() {
7420   asm("vwmaccu.vx  v8, t0, v16\n\t"
7421       "ret\n\t");
7422 }
7423 
ExecMaskedVwmaccuvx()7424 [[gnu::naked]] void ExecMaskedVwmaccuvx() {
7425   asm("vwmaccu.vx  v8, t0, v16, v0.t\n\t"
7426       "ret\n\t");
7427 }
7428 
ExecVwmaccvv()7429 [[gnu::naked]] void ExecVwmaccvv() {
7430   asm("vwmacc.vv  v8, v16, v24\n\t"
7431       "ret\n\t");
7432 }
7433 
ExecMaskedVwmaccvv()7434 [[gnu::naked]] void ExecMaskedVwmaccvv() {
7435   asm("vwmacc.vv  v8, v16, v24, v0.t\n\t"
7436       "ret\n\t");
7437 }
7438 
ExecVwmaccvx()7439 [[gnu::naked]] void ExecVwmaccvx() {
7440   asm("vwmacc.vx  v8, t0, v16\n\t"
7441       "ret\n\t");
7442 }
7443 
ExecMaskedVwmaccvx()7444 [[gnu::naked]] void ExecMaskedVwmaccvx() {
7445   asm("vwmacc.vx  v8, t0, v16, v0.t\n\t"
7446       "ret\n\t");
7447 }
7448 
ExecVwmaccusvx()7449 [[gnu::naked]] void ExecVwmaccusvx() {
7450   asm("vwmaccus.vx  v8, t0, v16\n\t"
7451       "ret\n\t");
7452 }
7453 
ExecMaskedVwmaccusvx()7454 [[gnu::naked]] void ExecMaskedVwmaccusvx() {
7455   asm("vwmaccus.vx  v8, t0, v16, v0.t\n\t"
7456       "ret\n\t");
7457 }
7458 
ExecVwmaccsuvv()7459 [[gnu::naked]] void ExecVwmaccsuvv() {
7460   asm("vwmaccsu.vv  v8, v16, v24\n\t"
7461       "ret\n\t");
7462 }
7463 
ExecMaskedVwmaccsuvv()7464 [[gnu::naked]] void ExecMaskedVwmaccsuvv() {
7465   asm("vwmaccsu.vv  v8, v16, v24, v0.t\n\t"
7466       "ret\n\t");
7467 }
7468 
ExecVwmaccsuvx()7469 [[gnu::naked]] void ExecVwmaccsuvx() {
7470   asm("vwmaccsu.vx  v8, t0, v16\n\t"
7471       "ret\n\t");
7472 }
7473 
ExecMaskedVwmaccsuvx()7474 [[gnu::naked]] void ExecMaskedVwmaccsuvx() {
7475   asm("vwmaccsu.vx  v8, t0, v16, v0.t\n\t"
7476       "ret\n\t");
7477 }
7478 
TEST(InlineAsmTestRiscv64,TestVmacc)7479 TEST(InlineAsmTestRiscv64, TestVmacc) {
7480   TestVectorInstruction(
7481       ExecVmaccvv,
7482       ExecMaskedVmaccvv,
7483       {{85, 231, 93, 23, 121, 87, 157, 167, 221, 231, 29, 23, 117, 87, 221, 167},
7484        {85, 39, 221, 215, 137, 151, 29, 103, 237, 39, 157, 215, 117, 151, 93, 103},
7485        {85, 103, 93, 151, 153, 215, 157, 39, 253, 103, 29, 151, 117, 215, 221, 39},
7486        {85, 167, 221, 87, 169, 23, 29, 231, 13, 167, 157, 87, 117, 23, 93, 231},
7487        {85, 231, 93, 23, 185, 87, 157, 167, 29, 231, 29, 23, 117, 87, 221, 167},
7488        {85, 39, 221, 215, 201, 151, 29, 103, 45, 39, 157, 215, 117, 151, 93, 103},
7489        {85, 103, 93, 151, 217, 215, 157, 39, 61, 103, 29, 151, 117, 215, 221, 39},
7490        {85, 167, 221, 87, 233, 23, 29, 231, 77, 167, 157, 87, 117, 23, 93, 231}},
7491       {{0x5555, 0x8d5d, 0x6a79, 0x5d9d, 0x7edd, 0x6e1d, 0x0675, 0xbedd},
7492        {0x9755, 0xcfdd, 0xbd89, 0xa11d, 0xd2ed, 0xb29d, 0x4b75, 0x045d},
7493        {0xdd55, 0x165d, 0x1499, 0xe89d, 0x2afd, 0xfb1d, 0x9475, 0x4ddd},
7494        {0x2755, 0x60dd, 0x6fa9, 0x341d, 0x870d, 0x479d, 0xe175, 0x9b5d},
7495        {0x7555, 0xaf5d, 0xceb9, 0x839d, 0xe71d, 0x981d, 0x3275, 0xecdd},
7496        {0xc755, 0x01dd, 0x31c9, 0xd71d, 0x4b2d, 0xec9d, 0x8775, 0x425d},
7497        {0x1d55, 0x585d, 0x98d9, 0x2e9d, 0xb33d, 0x451d, 0xe075, 0x9bdd},
7498        {0x7755, 0xb2dd, 0x03e9, 0x8a1d, 0x1f4d, 0xa19d, 0x3d75, 0xf95d}},
7499       {{0xc6e7'5555, 0xb4c4'6a79, 0xcf3e'7edd, 0xac0b'0675},
7500        {0x66c4'9755, 0x67b3'bd89, 0x832d'd2ed, 0x52ec'4b75},
7501        {0x12a9'dd55, 0x26ab'1499, 0x4325'2afd, 0x05d5'9475},
7502        {0xca97'2755, 0xf1aa'6fa9, 0x0f24'870d, 0xc4c6'e175},
7503        {0xcd4c'7555, 0x036d'ceb9, 0x1de3'e71d, 0xc274'3275},
7504        {0x8d39'c755, 0xd66d'31c9, 0xf1e3'4b2d, 0x8965'8775},
7505        {0x592f'1d55, 0xb574'98d9, 0xd1ea'b33d, 0x5c5e'e075},
7506        {0x312c'7755, 0xa084'03e9, 0xbdfa'1f4d, 0x3b60'3d75}},
7507       {{0xeeb7'f4ac'c6e7'5555, 0xf26a'9b12'cf3e'7edd},
7508        {0x5d63'0378'66c4'9755, 0x691b'afe2'832d'd2ed},
7509        {0xe826'2654'12a9'dd55, 0xfbe4'd8c2'4325'2afd},
7510        {0x8f01'5d3f'ca97'2755, 0xaac6'15b2'0f24'870d},
7511        {0x082d'23b8'cd4c'7555, 0x13df'd21f'1de3'e71d},
7512        {0xb708'62a4'8d39'c755, 0xcac1'170e'f1e3'4b2d},
7513        {0x81fb'b5a0'592f'1d55, 0x9dba'700e'd1ea'b33d},
7514        {0x6907'1cac'312c'7755, 0x8ccb'dd1e'bdfa'1f4d}},
7515       kVectorCalculationsSource);
7516   TestVectorInstruction(
7517       ExecVmaccvx,
7518       ExecMaskedVmaccvx,
7519       {{85, 255, 169, 83, 253, 167, 81, 251, 165, 79, 249, 163, 77, 247, 161, 75},
7520        {245, 159, 73, 243, 157, 71, 241, 155, 69, 239, 153, 67, 237, 151, 65, 235},
7521        {149, 63, 233, 147, 61, 231, 145, 59, 229, 143, 57, 227, 141, 55, 225, 139},
7522        {53, 223, 137, 51, 221, 135, 49, 219, 133, 47, 217, 131, 45, 215, 129, 43},
7523        {213, 127, 41, 211, 125, 39, 209, 123, 37, 207, 121, 35, 205, 119, 33, 203},
7524        {117, 31, 201, 115, 29, 199, 113, 27, 197, 111, 25, 195, 109, 23, 193, 107},
7525        {21, 191, 105, 19, 189, 103, 17, 187, 101, 15, 185, 99, 13, 183, 97, 11},
7526        {181, 95, 9, 179, 93, 7, 177, 91, 5, 175, 89, 3, 173, 87, 1, 171}},
7527       {{0xff55, 0xa8a9, 0x51fd, 0xfb51, 0xa4a5, 0x4df9, 0xf74d, 0xa0a1},
7528        {0x49f5, 0xf349, 0x9c9d, 0x45f1, 0xef45, 0x9899, 0x41ed, 0xeb41},
7529        {0x9495, 0x3de9, 0xe73d, 0x9091, 0x39e5, 0xe339, 0x8c8d, 0x35e1},
7530        {0xdf35, 0x8889, 0x31dd, 0xdb31, 0x8485, 0x2dd9, 0xd72d, 0x8081},
7531        {0x29d5, 0xd329, 0x7c7d, 0x25d1, 0xcf25, 0x7879, 0x21cd, 0xcb21},
7532        {0x7475, 0x1dc9, 0xc71d, 0x7071, 0x19c5, 0xc319, 0x6c6d, 0x15c1},
7533        {0xbf15, 0x6869, 0x11bd, 0xbb11, 0x6465, 0x0db9, 0xb70d, 0x6061},
7534        {0x09b5, 0xb309, 0x5c5d, 0x05b1, 0xaf05, 0x5859, 0x01ad, 0xab01}},
7535       {{0xa8a8'ff55, 0x50a6'51fd, 0xf8a3'a4a5, 0xa0a0'f74d},
7536        {0x489e'49f5, 0xf09b'9c9d, 0x9898'ef45, 0x4096'41ed},
7537        {0xe893'9495, 0x9090'e73d, 0x388e'39e5, 0xe08b'8c8d},
7538        {0x8888'df35, 0x3086'31dd, 0xd883'8485, 0x8080'd72d},
7539        {0x287e'29d5, 0xd07b'7c7d, 0x7878'cf25, 0x2076'21cd},
7540        {0xc873'7475, 0x7070'c71d, 0x186e'19c5, 0xc06b'6c6d},
7541        {0x6868'bf15, 0x1066'11bd, 0xb863'6465, 0x6060'b70d},
7542        {0x085e'09b5, 0xb05b'5c5d, 0x5858'af05, 0x0056'01ad}},
7543       {{0xfb50'fca7'a8a8'ff55, 0xa0a0'f74c'f8a3'a4a5},
7544        {0x45f0'f1f2'489e'49f5, 0xeb40'ec97'9898'ef45},
7545        {0x9090'e73c'e893'9495, 0x35e0'e1e2'388e'39e5},
7546        {0xdb30'dc87'8888'df35, 0x8080'd72c'd883'8485},
7547        {0x25d0'd1d2'287e'29d5, 0xcb20'cc77'7878'cf25},
7548        {0x7070'c71c'c873'7475, 0x15c0'c1c2'186e'19c5},
7549        {0xbb10'bc67'6868'bf15, 0x6060'b70c'b863'6465},
7550        {0x05b0'b1b2'085e'09b5, 0xab00'ac57'5858'af05}},
7551       kVectorCalculationsSource);
7552   TestWideningVectorInstruction(ExecVwmaccuvv,
7553                                 ExecMaskedVwmaccuvv,
7554                                 {{0x5555, 0x9ee7, 0x555d, 0xa217, 0x5579, 0xa557, 0x559d, 0xa8a7},
7555                                  {0x55dd, 0x9ae7, 0x561d, 0x9e17, 0x5675, 0xa157, 0x56dd, 0xa4a7},
7556                                  {0x5755, 0xba27, 0x57dd, 0xbdd7, 0x5889, 0xc197, 0x591d, 0xc567},
7557                                  {0x59ed, 0xb627, 0x5a9d, 0xb9d7, 0x5b75, 0xbd97, 0x5c5d, 0xc167},
7558                                  {0x5d55, 0xd967, 0x5e5d, 0xdd97, 0x5f99, 0xe1d7, 0x609d, 0xe627},
7559                                  {0x61fd, 0xd567, 0x631d, 0xd997, 0x6475, 0xddd7, 0x65dd, 0xe227},
7560                                  {0x6755, 0xfca7, 0x68dd, 0x0157, 0x6aa9, 0x0617, 0x6c1d, 0x0ae7},
7561                                  {0x6e0d, 0xf8a7, 0x6f9d, 0xfd57, 0x7175, 0x0217, 0x735d, 0x06e7}},
7562                                 {{0x9ee7'5555, 0xa21a'8d5d, 0xa55e'6a79, 0xa8b1'5d9d},
7563                                  {0x9af4'7edd, 0x9e27'6e1d, 0xa16b'0675, 0xa4be'bedd},
7564                                  {0xba44'9755, 0xbdf8'cfdd, 0xc1bd'bd89, 0xc591'a11d},
7565                                  {0xb653'd2ed, 0xba07'b29d, 0xbdcc'4b75, 0xc1a1'045d},
7566                                  {0xd9a9'dd55, 0xdddf'165d, 0xe225'1499, 0xe679'e89d},
7567                                  {0xd5bb'2afd, 0xd9ef'fb1d, 0xde35'9475, 0xe28b'4ddd},
7568                                  {0xfd17'2755, 0x01cd'60dd, 0x0694'6fa9, 0x0b6a'341d},
7569                                  {0xf92a'870d, 0xfde0'479d, 0x02a6'e175, 0x077d'9b5d}},
7570                                 {{0xa21b'23ac'c6e7'5555, 0xa8b2'00fa'b4c4'6a79},
7571                                  {0x9e27'fc86'cf3e'7edd, 0xa4bf'5a54'ac0b'0675},
7572                                  {0xbdf9'9d68'66c4'9755, 0xc592'7dba'67b3'bd89},
7573                                  {0xba08'7846'832d'd2ed, 0xc1a1'd918'52ec'4b75},
7574                                  {0xdde0'2334'12a9'dd55, 0xe67b'068a'26ab'1499},
7575                                  {0xd9f1'0016'4325'2afd, 0xe28c'63ec'05d5'9475},
7576                                  {0x01ce'b50f'ca97'2755, 0x0b6b'9b69'f1aa'6fa9},
7577                                  {0xfde1'93f6'0f24'870d, 0x077e'facf'c4c6'e175}},
7578                                 kVectorCalculationsSource);
7579   TestWideningVectorInstruction(ExecVwmaccuvx,
7580                                 ExecMaskedVwmaccuvx,
7581                                 {{0x5555, 0xaaff, 0x56a9, 0xac53, 0x57fd, 0xada7, 0x5951, 0xaefb},
7582                                  {0x5aa5, 0xb04f, 0x5bf9, 0xb1a3, 0x5d4d, 0xb2f7, 0x5ea1, 0xb44b},
7583                                  {0x5ff5, 0xb59f, 0x6149, 0xb6f3, 0x629d, 0xb847, 0x63f1, 0xb99b},
7584                                  {0x6545, 0xbaef, 0x6699, 0xbc43, 0x67ed, 0xbd97, 0x6941, 0xbeeb},
7585                                  {0x6a95, 0xc03f, 0x6be9, 0xc193, 0x6d3d, 0xc2e7, 0x6e91, 0xc43b},
7586                                  {0x6fe5, 0xc58f, 0x7139, 0xc6e3, 0x728d, 0xc837, 0x73e1, 0xc98b},
7587                                  {0x7535, 0xcadf, 0x7689, 0xcc33, 0x77dd, 0xcd87, 0x7931, 0xcedb},
7588                                  {0x7a85, 0xd02f, 0x7bd9, 0xd183, 0x7d2d, 0xd2d7, 0x7e81, 0xd42b}},
7589                                 {{0xab54'ff55, 0xacab'a8a9, 0xae02'51fd, 0xaf58'fb51},
7590                                  {0xb0af'a4a5, 0xb206'4df9, 0xb35c'f74d, 0xb4b3'a0a1},
7591                                  {0xb60a'49f5, 0xb760'f349, 0xb8b7'9c9d, 0xba0e'45f1},
7592                                  {0xbb64'ef45, 0xbcbb'9899, 0xbe12'41ed, 0xbf68'eb41},
7593                                  {0xc0bf'9495, 0xc216'3de9, 0xc36c'e73d, 0xc4c3'9091},
7594                                  {0xc61a'39e5, 0xc770'e339, 0xc8c7'8c8d, 0xca1e'35e1},
7595                                  {0xcb74'df35, 0xcccb'8889, 0xce22'31dd, 0xcf78'db31},
7596                                  {0xd0cf'8485, 0xd226'2dd9, 0xd37c'd72d, 0xd4d3'8081}},
7597                                 {{0xacac'55ff'a8a8'ff55, 0xaf59'ae02'50a6'51fd},
7598                                  {0xb207'0604'f8a3'a4a5, 0xb4b4'5e07'a0a0'f74d},
7599                                  {0xb761'b60a'489e'49f5, 0xba0f'0e0c'f09b'9c9d},
7600                                  {0xbcbc'660f'9898'ef45, 0xbf69'be12'4096'41ed},
7601                                  {0xc217'1614'e893'9495, 0xc4c4'6e17'9090'e73d},
7602                                  {0xc771'c61a'388e'39e5, 0xca1f'1e1c'e08b'8c8d},
7603                                  {0xcccc'761f'8888'df35, 0xcf79'ce22'3086'31dd},
7604                                  {0xd227'2624'd883'8485, 0xd4d4'7e27'8080'd72d}},
7605                                 kVectorCalculationsSource);
7606   TestWideningVectorInstruction(ExecVwmaccvv,
7607                                 ExecMaskedVwmaccvv,
7608                                 {{0x5555, 0x8be7, 0x555d, 0x8917, 0x5579, 0x8657, 0x559d, 0x83a7},
7609                                  {0x55dd, 0x8fe7, 0x561d, 0x8d17, 0x5675, 0x8a57, 0x56dd, 0x87a7},
7610                                  {0x5755, 0x7727, 0x57dd, 0x74d7, 0x5889, 0x7297, 0x591d, 0x7067},
7611                                  {0x59ed, 0x7b27, 0x5a9d, 0x78d7, 0x5b75, 0x7697, 0x5c5d, 0x7467},
7612                                  {0x5d55, 0x6667, 0x5e5d, 0x6497, 0x5f99, 0x62d7, 0x609d, 0x6127},
7613                                  {0x61fd, 0x6a67, 0x631d, 0x6897, 0x6475, 0x66d7, 0x65dd, 0x6527},
7614                                  {0x6755, 0x59a7, 0x68dd, 0x5857, 0x6aa9, 0x5717, 0x6c1d, 0x55e7},
7615                                  {0x6e0d, 0x5da7, 0x6f9d, 0x5c57, 0x7175, 0x5b17, 0x735d, 0x59e7}},
7616                                 {{0x8be7'5555, 0x8914'8d5d, 0x8651'6a79, 0x839f'5d9d},
7617                                  {0x8fdb'7edd, 0x8d09'6e1d, 0x8a47'0675, 0x8794'bedd},
7618                                  {0x7714'9755, 0x74c2'cfdd, 0x7280'bd89, 0x704f'a11d},
7619                                  {0x7b0a'd2ed, 0x78b9'b29d, 0x7678'4b75, 0x7447'045d},
7620                                  {0x6649'dd55, 0x6479'165d, 0x62b8'1499, 0x6107'e89d},
7621                                  {0x6a42'2afd, 0x6871'fb1d, 0x66b1'9475, 0x6501'4ddd},
7622                                  {0x5987'2755, 0x5837'60dd, 0x56f7'6fa9, 0x55c8'341d},
7623                                  {0x5d81'870d, 0x5c32'479d, 0x5af2'e175, 0x59c3'9b5d}},
7624                                 {{0x8914'10ac'c6e7'5555, 0x839e'e1ed'b4c4'6a79},
7625                                  {0x8d08'f16d'cf3e'7edd, 0x8794'4330'ac0b'0675},
7626                                  {0x74c2'5a38'66c4'9755, 0x704f'2e7d'67b3'bd89},
7627                                  {0x78b9'3cfd'832d'd2ed, 0x7446'91c4'52ec'4b75},
7628                                  {0x6478'afd4'12a9'dd55, 0x6107'871d'26ab'1499},
7629                                  {0x6871'949d'4325'2afd, 0x6500'ec68'05d5'9475},
7630                                  {0x5837'117f'ca97'2755, 0x55c7'ebcc'f1aa'6fa9},
7631                                  {0x5c31'f84d'0f24'870d, 0x59c3'531b'c4c6'e175}},
7632                                 kVectorCalculationsSource);
7633   TestWideningVectorInstruction(ExecVwmaccvx,
7634                                 ExecMaskedVwmaccvx,
7635                                 {{0x5555, 0x7fff, 0x54a9, 0x7f53, 0x53fd, 0x7ea7, 0x5351, 0x7dfb},
7636                                  {0x52a5, 0x7d4f, 0x51f9, 0x7ca3, 0x514d, 0x7bf7, 0x50a1, 0x7b4b},
7637                                  {0x4ff5, 0x7a9f, 0x4f49, 0x79f3, 0x4e9d, 0x7947, 0x4df1, 0x789b},
7638                                  {0x4d45, 0x77ef, 0x4c99, 0x7743, 0x4bed, 0x7697, 0x4b41, 0x75eb},
7639                                  {0x4a95, 0x753f, 0x49e9, 0x7493, 0x493d, 0x73e7, 0x4891, 0x733b},
7640                                  {0x47e5, 0x728f, 0x4739, 0x71e3, 0x468d, 0x7137, 0x45e1, 0x708b},
7641                                  {0x4535, 0x6fdf, 0x4489, 0x6f33, 0x43dd, 0x6e87, 0x4331, 0x6ddb},
7642                                  {0x4285, 0x6d2f, 0x41d9, 0x6c83, 0x412d, 0x6bd7, 0x4081, 0x6b2b}},
7643                                 {{0x7faa'ff55, 0x7eff'a8a9, 0x7e54'51fd, 0x7da8'fb51},
7644                                  {0x7cfd'a4a5, 0x7c52'4df9, 0x7ba6'f74d, 0x7afb'a0a1},
7645                                  {0x7a50'49f5, 0x79a4'f349, 0x78f9'9c9d, 0x784e'45f1},
7646                                  {0x77a2'ef45, 0x76f7'9899, 0x764c'41ed, 0x75a0'eb41},
7647                                  {0x74f5'9495, 0x744a'3de9, 0x739e'e73d, 0x72f3'9091},
7648                                  {0x7248'39e5, 0x719c'e339, 0x70f1'8c8d, 0x7046'35e1},
7649                                  {0x6f9a'df35, 0x6eef'8889, 0x6e44'31dd, 0x6d98'db31},
7650                                  {0x6ced'8485, 0x6c42'2dd9, 0x6b96'd72d, 0x6aeb'8081}},
7651                                 {{0x7eff'2a55'a8a8'ff55, 0x7da8'7e54'50a6'51fd},
7652                                  {0x7c51'd252'f8a3'a4a5, 0x7afb'2651'a0a0'f74d},
7653                                  {0x79a4'7a50'489e'49f5, 0x784d'ce4e'f09b'9c9d},
7654                                  {0x76f7'224d'9898'ef45, 0x75a0'764c'4096'41ed},
7655                                  {0x7449'ca4a'e893'9495, 0x72f3'1e49'9090'e73d},
7656                                  {0x719c'7248'388e'39e5, 0x7045'c646'e08b'8c8d},
7657                                  {0x6eef'1a45'8888'df35, 0x6d98'6e44'3086'31dd},
7658                                  {0x6c41'c242'd883'8485, 0x6aeb'1641'8080'd72d}},
7659                                 kVectorCalculationsSource);
7660   TestWideningVectorInstruction(ExecVwmaccusvx,
7661                                 ExecMaskedVwmaccusvx,
7662                                 {{0x5555, 0x00ff, 0x56a9, 0x0253, 0x57fd, 0x03a7, 0x5951, 0x04fb},
7663                                  {0x5aa5, 0x064f, 0x5bf9, 0x07a3, 0x5d4d, 0x08f7, 0x5ea1, 0x0a4b},
7664                                  {0x5ff5, 0x0b9f, 0x6149, 0x0cf3, 0x629d, 0x0e47, 0x63f1, 0x0f9b},
7665                                  {0x6545, 0x10ef, 0x6699, 0x1243, 0x67ed, 0x1397, 0x6941, 0x14eb},
7666                                  {0x6a95, 0x163f, 0x6be9, 0x1793, 0x6d3d, 0x18e7, 0x6e91, 0x1a3b},
7667                                  {0x6fe5, 0x1b8f, 0x7139, 0x1ce3, 0x728d, 0x1e37, 0x73e1, 0x1f8b},
7668                                  {0x7535, 0x20df, 0x7689, 0x2233, 0x77dd, 0x2387, 0x7931, 0x24db},
7669                                  {0x7a85, 0x262f, 0x7bd9, 0x2783, 0x7d2d, 0x28d7, 0x7e81, 0x2a2b}},
7670                                 {{0x00aa'ff55, 0x0201'a8a9, 0x0358'51fd, 0x04ae'fb51},
7671                                  {0x0605'a4a5, 0x075c'4df9, 0x08b2'f74d, 0x0a09'a0a1},
7672                                  {0x0b60'49f5, 0x0cb6'f349, 0x0e0d'9c9d, 0x0f64'45f1},
7673                                  {0x10ba'ef45, 0x1211'9899, 0x1368'41ed, 0x14be'eb41},
7674                                  {0x1615'9495, 0x176c'3de9, 0x18c2'e73d, 0x1a19'9091},
7675                                  {0x1b70'39e5, 0x1cc6'e339, 0x1e1d'8c8d, 0x1f74'35e1},
7676                                  {0x20ca'df35, 0x2221'8889, 0x2378'31dd, 0x24ce'db31},
7677                                  {0x2625'8485, 0x277c'2dd9, 0x28d2'd72d, 0x2a29'8081}},
7678                                 {{0x0201'ab55'a8a8'ff55, 0x04af'0358'50a6'51fd},
7679                                  {0x075c'5b5a'f8a3'a4a5, 0x0a09'b35d'a0a0'f74d},
7680                                  {0x0cb7'0b60'489e'49f5, 0x0f64'6362'f09b'9c9d},
7681                                  {0x1211'bb65'9898'ef45, 0x14bf'1368'4096'41ed},
7682                                  {0x176c'6b6a'e893'9495, 0x1a19'c36d'9090'e73d},
7683                                  {0x1cc7'1b70'388e'39e5, 0x1f74'7372'e08b'8c8d},
7684                                  {0x2221'cb75'8888'df35, 0x24cf'2378'3086'31dd},
7685                                  {0x277c'7b7a'd883'8485, 0x2a29'd37d'8080'd72d}},
7686                                 kVectorCalculationsSource);
7687   TestWideningVectorInstruction(ExecVwmaccsuvv,
7688                                 ExecMaskedVwmaccsuvv,
7689                                 {{0x5555, 0x0ce7, 0x555d, 0x0c17, 0x5579, 0x0b57, 0x559d, 0x0aa7},
7690                                  {0x55dd, 0x18e7, 0x561d, 0x1817, 0x5675, 0x1757, 0x56dd, 0x16a7},
7691                                  {0x5755, 0x0827, 0x57dd, 0x07d7, 0x5889, 0x0797, 0x591d, 0x0767},
7692                                  {0x59ed, 0x1427, 0x5a9d, 0x13d7, 0x5b75, 0x1397, 0x5c5d, 0x1367},
7693                                  {0x5d55, 0x0767, 0x5e5d, 0x0797, 0x5f99, 0x07d7, 0x609d, 0x0827},
7694                                  {0x61fd, 0x1367, 0x631d, 0x1397, 0x6475, 0x13d7, 0x65dd, 0x1427},
7695                                  {0x6755, 0x0aa7, 0x68dd, 0x0b57, 0x6aa9, 0x0c17, 0x6c1d, 0x0ce7},
7696                                  {0x6e0d, 0x16a7, 0x6f9d, 0x1757, 0x7175, 0x1817, 0x735d, 0x18e7}},
7697                                 {{0x0ce7'5555, 0x0c16'8d5d, 0x0b55'6a79, 0x0aa5'5d9d},
7698                                  {0x18e3'7edd, 0x1813'6e1d, 0x1753'0675, 0x16a2'bedd},
7699                                  {0x0824'9755, 0x07d4'cfdd, 0x0794'bd89, 0x0765'a11d},
7700                                  {0x1422'd2ed, 0x13d3'b29d, 0x1394'4b75, 0x1365'045d},
7701                                  {0x0769'dd55, 0x079b'165d, 0x07dc'1499, 0x082d'e89d},
7702                                  {0x136a'2afd, 0x139b'fb1d, 0x13dd'9475, 0x142f'4ddd},
7703                                  {0x0ab7'2755, 0x0b69'60dd, 0x0c2b'6fa9, 0x0cfe'341d},
7704                                  {0x16b9'870d, 0x176c'479d, 0x182e'e175, 0x1901'9b5d}},
7705                                 {{0x0c16'91ac'c6e7'5555, 0x0aa5'66f1'b4c4'6a79},
7706                                  {0x1813'7a75'cf3e'7edd, 0x16a2'd03c'ac0b'0675},
7707                                  {0x07d4'eb48'66c4'9755, 0x0765'c391'67b3'bd89},
7708                                  {0x13d3'd615'832d'd2ed, 0x1365'2ee0'52ec'4b75},
7709                                  {0x079b'50f4'12a9'dd55, 0x082e'2c41'26ab'1499},
7710                                  {0x139c'3dc5'4325'2afd, 0x142f'9994'05d5'9475},
7711                                  {0x0b69'c2af'ca97'2755, 0x0cfe'a100'f1aa'6fa9},
7712                                  {0x176c'b185'0f24'870d, 0x1902'1057'c4c6'e175}},
7713                                 kVectorCalculationsSource);
7714   TestWideningVectorInstruction(ExecVwmaccsuvx,
7715                                 ExecMaskedVwmaccsuvx,
7716                                 {{0x5555, 0x29ff, 0x54a9, 0x2953, 0x53fd, 0x28a7, 0x5351, 0x27fb},
7717                                  {0x52a5, 0x274f, 0x51f9, 0x26a3, 0x514d, 0x25f7, 0x50a1, 0x254b},
7718                                  {0x4ff5, 0x249f, 0x4f49, 0x23f3, 0x4e9d, 0x2347, 0x4df1, 0x229b},
7719                                  {0x4d45, 0x21ef, 0x4c99, 0x2143, 0x4bed, 0x2097, 0x4b41, 0x1feb},
7720                                  {0x4a95, 0x1f3f, 0x49e9, 0x1e93, 0x493d, 0x1de7, 0x4891, 0x1d3b},
7721                                  {0x47e5, 0x1c8f, 0x4739, 0x1be3, 0x468d, 0x1b37, 0x45e1, 0x1a8b},
7722                                  {0x4535, 0x19df, 0x4489, 0x1933, 0x43dd, 0x1887, 0x4331, 0x17db},
7723                                  {0x4285, 0x172f, 0x41d9, 0x1683, 0x412d, 0x15d7, 0x4081, 0x152b}},
7724                                 {{0x2a54'ff55, 0x29a9'a8a9, 0x28fe'51fd, 0x2852'fb51},
7725                                  {0x27a7'a4a5, 0x26fc'4df9, 0x2650'f74d, 0x25a5'a0a1},
7726                                  {0x24fa'49f5, 0x244e'f349, 0x23a3'9c9d, 0x22f8'45f1},
7727                                  {0x224c'ef45, 0x21a1'9899, 0x20f6'41ed, 0x204a'eb41},
7728                                  {0x1f9f'9495, 0x1ef4'3de9, 0x1e48'e73d, 0x1d9d'9091},
7729                                  {0x1cf2'39e5, 0x1c46'e339, 0x1b9b'8c8d, 0x1af0'35e1},
7730                                  {0x1a44'df35, 0x1999'8889, 0x18ee'31dd, 0x1842'db31},
7731                                  {0x1797'8485, 0x16ec'2dd9, 0x1640'd72d, 0x1595'8081}},
7732                                 {{0x29a9'd4ff'a8a8'ff55, 0x2853'28fe'50a6'51fd},
7733                                  {0x26fc'7cfc'f8a3'a4a5, 0x25a5'd0fb'a0a0'f74d},
7734                                  {0x244f'24fa'489e'49f5, 0x22f8'78f8'f09b'9c9d},
7735                                  {0x21a1'ccf7'9898'ef45, 0x204b'20f6'4096'41ed},
7736                                  {0x1ef4'74f4'e893'9495, 0x1d9d'c8f3'9090'e73d},
7737                                  {0x1c47'1cf2'388e'39e5, 0x1af0'70f0'e08b'8c8d},
7738                                  {0x1999'c4ef'8888'df35, 0x1843'18ee'3086'31dd},
7739                                  {0x16ec'6cec'd883'8485, 0x1595'c0eb'8080'd72d}},
7740                                 kVectorCalculationsSource);
7741 }
7742 
ExecVmaddvv()7743 [[gnu::naked]] void ExecVmaddvv() {
7744   asm("vmadd.vv  v8, v16, v24\n\t"
7745       "ret\n\t");
7746 }
7747 
ExecMaskedVmaddvv()7748 [[gnu::naked]] void ExecMaskedVmaddvv() {
7749   asm("vmadd.vv  v8, v16, v24, v0.t\n\t"
7750       "ret\n\t");
7751 }
7752 
ExecVmaddvx()7753 [[gnu::naked]] void ExecVmaddvx() {
7754   asm("vmadd.vx  v8, t0, v16\n\t"
7755       "ret\n\t");
7756 }
7757 
ExecMaskedVmaddvx()7758 [[gnu::naked]] void ExecMaskedVmaddvx() {
7759   asm("vmadd.vx  v8, t0, v16, v0.t\n\t"
7760       "ret\n\t");
7761 }
7762 
TEST(InlineAsmTestRiscv64,TestVmadd)7763 TEST(InlineAsmTestRiscv64, TestVmadd) {
7764   TestVectorInstruction(
7765       ExecVmaddvv,
7766       ExecMaskedVmaddvv,
7767       {{0, 103, 174, 21, 93, 195, 10, 113, 185, 255, 102, 173, 20, 91, 194, 9},
7768        {112, 215, 30, 133, 205, 51, 122, 225, 41, 111, 214, 29, 132, 203, 50, 121},
7769        {224, 71, 142, 245, 61, 163, 234, 81, 153, 223, 70, 141, 244, 59, 162, 233},
7770        {80, 183, 254, 101, 173, 19, 90, 193, 9, 79, 182, 253, 100, 171, 18, 89},
7771        {192, 39, 110, 213, 29, 131, 202, 49, 121, 191, 38, 109, 212, 27, 130, 201},
7772        {48, 151, 222, 69, 141, 243, 58, 161, 233, 47, 150, 221, 68, 139, 242, 57},
7773        {160, 7, 78, 181, 253, 99, 170, 17, 89, 159, 6, 77, 180, 251, 98, 169},
7774        {16, 119, 190, 37, 109, 211, 26, 129, 201, 15, 118, 189, 36, 107, 210, 25}},
7775       {{0x6700, 0xbfae, 0x185d, 0x710a, 0xa9b9, 0x0266, 0x5b14, 0xb3c2},
7776        {0x2c70, 0x851e, 0xddcd, 0x367a, 0x6f29, 0xc7d6, 0x2084, 0x7932},
7777        {0xf1e0, 0x4a8e, 0xa33d, 0xfbea, 0x3499, 0x8d46, 0xe5f4, 0x3ea2},
7778        {0xb750, 0x0ffe, 0x68ad, 0xc15a, 0xfa09, 0x52b6, 0xab64, 0x0412},
7779        {0x7cc0, 0xd56e, 0x2e1d, 0x86ca, 0xbf79, 0x1826, 0x70d4, 0xc982},
7780        {0x4230, 0x9ade, 0xf38d, 0x4c3a, 0x84e9, 0xdd96, 0x3644, 0x8ef2},
7781        {0x07a0, 0x604e, 0xb8fd, 0x11aa, 0x4a59, 0xa306, 0xfbb4, 0x5462},
7782        {0xcd10, 0x25be, 0x7e6d, 0xd71a, 0x0fc9, 0x6876, 0xc124, 0x19d2}},
7783       {{0xbfae'6700, 0x1bb5'185d, 0x57bb'a9b9, 0xb3c2'5b14},
7784        {0x2fc9'2c70, 0x8bcf'ddcd, 0xc7d6'6f29, 0x23dd'2084},
7785        {0x9fe3'f1e0, 0xfbea'a33d, 0x37f1'3499, 0x93f7'e5f4},
7786        {0x0ffe'b750, 0x6c05'68ad, 0xa80b'fa09, 0x0412'ab64},
7787        {0x8018'7cc0, 0xdc1f'2e1d, 0x1825'bf79, 0x742c'70d4},
7788        {0xf033'4230, 0x4c39'f38d, 0x8840'84e9, 0xe447'3644},
7789        {0x604e'07a0, 0xbc54'b8fd, 0xf85b'4a59, 0x5461'fbb4},
7790        {0xd068'cd10, 0x2c6f'7e6d, 0x6876'0fc9, 0xc47c'c124}},
7791       {{0x710a'6db2'bfae'6700, 0xb3c2'5b14'57bb'a9b9},
7792        {0x367a'8878'2fc9'2c70, 0x7932'75d9'c7d6'6f29},
7793        {0xfbea'a33d'9fe3'f1e0, 0x3ea2'909f'37f1'3499},
7794        {0xc15a'be03'0ffe'b750, 0x0412'ab64'a80b'fa09},
7795        {0x86c9'd8c7'8018'7cc0, 0xc981'c629'1825'bf79},
7796        {0x4c39'f38c'f033'4230, 0x8ef1'e0ee'8840'84e9},
7797        {0x11aa'0e52'604e'07a0, 0x5461'fbb3'f85b'4a59},
7798        {0xd71a'2917'd068'cd10, 0x19d2'1679'6876'0fc9}},
7799       kVectorCalculationsSource);
7800   TestVectorInstruction(
7801       ExecVmaddvx,
7802       ExecMaskedVmaddvx,
7803       {{114, 243, 116, 245, 118, 247, 120, 249, 122, 251, 124, 253, 126, 255, 128, 1},
7804        {130, 3, 132, 5, 134, 7, 136, 9, 138, 11, 140, 13, 142, 15, 144, 17},
7805        {146, 19, 148, 21, 150, 23, 152, 25, 154, 27, 156, 29, 158, 31, 160, 33},
7806        {162, 35, 164, 37, 166, 39, 168, 41, 170, 43, 172, 45, 174, 47, 176, 49},
7807        {178, 51, 180, 53, 182, 55, 184, 57, 186, 59, 188, 61, 190, 63, 192, 65},
7808        {194, 67, 196, 69, 198, 71, 200, 73, 202, 75, 204, 77, 206, 79, 208, 81},
7809        {210, 83, 212, 85, 214, 87, 216, 89, 218, 91, 220, 93, 222, 95, 224, 97},
7810        {226, 99, 228, 101, 230, 103, 232, 105, 234, 107, 236, 109, 238, 111, 240, 113}},
7811       {{0x9d72, 0x9f74, 0xa176, 0xa378, 0xa57a, 0xa77c, 0xa97e, 0xab80},
7812        {0xad82, 0xaf84, 0xb186, 0xb388, 0xb58a, 0xb78c, 0xb98e, 0xbb90},
7813        {0xbd92, 0xbf94, 0xc196, 0xc398, 0xc59a, 0xc79c, 0xc99e, 0xcba0},
7814        {0xcda2, 0xcfa4, 0xd1a6, 0xd3a8, 0xd5aa, 0xd7ac, 0xd9ae, 0xdbb0},
7815        {0xddb2, 0xdfb4, 0xe1b6, 0xe3b8, 0xe5ba, 0xe7bc, 0xe9be, 0xebc0},
7816        {0xedc2, 0xefc4, 0xf1c6, 0xf3c8, 0xf5ca, 0xf7cc, 0xf9ce, 0xfbd0},
7817        {0xfdd2, 0xffd4, 0x01d6, 0x03d8, 0x05da, 0x07dc, 0x09de, 0x0be0},
7818        {0x0de2, 0x0fe4, 0x11e6, 0x13e8, 0x15ea, 0x17ec, 0x19ee, 0x1bf0}},
7819       {{0xf4c9'9d72, 0xf8cd'a176, 0xfcd1'a57a, 0x00d5'a97e},
7820        {0x04d9'ad82, 0x08dd'b186, 0x0ce1'b58a, 0x10e5'b98e},
7821        {0x14e9'bd92, 0x18ed'c196, 0x1cf1'c59a, 0x20f5'c99e},
7822        {0x24f9'cda2, 0x28fd'd1a6, 0x2d01'd5aa, 0x3105'd9ae},
7823        {0x3509'ddb2, 0x390d'e1b6, 0x3d11'e5ba, 0x4115'e9be},
7824        {0x4519'edc2, 0x491d'f1c6, 0x4d21'f5ca, 0x5125'f9ce},
7825        {0x5529'fdd2, 0x592e'01d6, 0x5d32'05da, 0x6136'09de},
7826        {0x653a'0de2, 0x693e'11e6, 0x6d42'15ea, 0x7146'19ee}},
7827       {{0xa378'4c20'f4c9'9d72, 0xab80'5428'fcd1'a57a},
7828        {0xb388'5c31'04d9'ad82, 0xbb90'6439'0ce1'b58a},
7829        {0xc398'6c41'14e9'bd92, 0xcba0'7449'1cf1'c59a},
7830        {0xd3a8'7c51'24f9'cda2, 0xdbb0'8459'2d01'd5aa},
7831        {0xe3b8'8c61'3509'ddb2, 0xebc0'9469'3d11'e5ba},
7832        {0xf3c8'9c71'4519'edc2, 0xfbd0'a479'4d21'f5ca},
7833        {0x03d8'ac81'5529'fdd2, 0x0be0'b489'5d32'05da},
7834        {0x13e8'bc91'653a'0de2, 0x1bf0'c499'6d42'15ea}},
7835       kVectorCalculationsSource);
7836 }
7837 
ExecVmaxvv()7838 [[gnu::naked]] void ExecVmaxvv() {
7839   asm("vmax.vv  v8, v16, v24\n\t"
7840       "ret\n\t");
7841 }
7842 
ExecMaskedVmaxvv()7843 [[gnu::naked]] void ExecMaskedVmaxvv() {
7844   asm("vmax.vv  v8, v16, v24, v0.t\n\t"
7845       "ret\n\t");
7846 }
7847 
ExecVmaxvx()7848 [[gnu::naked]] void ExecVmaxvx() {
7849   asm("vmax.vx  v8, v16, t0\n\t"
7850       "ret\n\t");
7851 }
7852 
ExecMaskedVmaxvx()7853 [[gnu::naked]] void ExecMaskedVmaxvx() {
7854   asm("vmax.vx  v8, v16, t0, v0.t\n\t"
7855       "ret\n\t");
7856 }
7857 
TEST(InlineAsmTestRiscv64,TestVmax)7858 TEST(InlineAsmTestRiscv64, TestVmax) {
7859   TestVectorInstruction(
7860       ExecVmaxvv,
7861       ExecMaskedVmaxvv,
7862       {{0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30},
7863        {32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60, 62},
7864        {64, 66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92, 94},
7865        {96, 98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124, 126},
7866        {64, 193, 66, 195, 68, 197, 70, 199, 72, 201, 74, 203, 76, 205, 78, 207},
7867        {80, 209, 82, 211, 84, 213, 86, 215, 88, 217, 90, 219, 92, 221, 94, 223},
7868        {96, 225, 98, 227, 100, 229, 102, 231, 104, 233, 106, 235, 108, 237, 110, 239},
7869        {112, 241, 114, 243, 116, 245, 118, 247, 120, 249, 122, 251, 124, 253, 126, 255}},
7870       {{0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
7871        {0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
7872        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
7873        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
7874        {0xc140, 0xc342, 0xc544, 0xc746, 0xc948, 0xcb4a, 0xcd4c, 0xcf4e},
7875        {0xd150, 0xd352, 0xd554, 0xd756, 0xd958, 0xdb5a, 0xdd5c, 0xdf5e},
7876        {0xe160, 0xe362, 0xe564, 0xe766, 0xe968, 0xeb6a, 0xed6c, 0xef6e},
7877        {0xf170, 0xf372, 0xf574, 0xf776, 0xf978, 0xfb7a, 0xfd7c, 0xff7e}},
7878       {{0x0604'0200, 0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18},
7879        {0x2624'2220, 0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38},
7880        {0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
7881        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
7882        {0xc342'c140, 0xc746'c544, 0xcb4a'c948, 0xcf4e'cd4c},
7883        {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
7884        {0xe362'e160, 0xe766'e564, 0xeb6a'e968, 0xef6e'ed6c},
7885        {0xf372'f170, 0xf776'f574, 0xfb7a'f978, 0xff7e'fd7c}},
7886       {{0x0e0c'0a09'0604'0200, 0x1e1c'1a18'1614'1211},
7887        {0x2e2c'2a29'2624'2220, 0x3e3c'3a38'3634'3231},
7888        {0x4e4c'4a49'4644'4240, 0x5e5c'5a58'5654'5251},
7889        {0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271},
7890        {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
7891        {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
7892        {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
7893        {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
7894       kVectorCalculationsSourceLegacy);
7895   TestVectorInstruction(
7896       ExecVmaxvx,
7897       ExecMaskedVmaxvx,
7898       {{0, 170, 2, 170, 4, 170, 6, 170, 8, 170, 10, 170, 12, 170, 14, 170},
7899        {16, 170, 18, 170, 20, 170, 22, 170, 24, 170, 26, 170, 28, 170, 30, 170},
7900        {32, 170, 34, 170, 36, 170, 38, 170, 40, 170, 42, 171, 44, 173, 46, 175},
7901        {48, 177, 50, 179, 52, 181, 54, 183, 56, 185, 58, 187, 60, 189, 62, 191},
7902        {64, 193, 66, 195, 68, 197, 70, 199, 72, 201, 74, 203, 76, 205, 78, 207},
7903        {80, 209, 82, 211, 84, 213, 86, 215, 88, 217, 90, 219, 92, 221, 94, 223},
7904        {96, 225, 98, 227, 100, 229, 102, 231, 104, 233, 106, 235, 108, 237, 110, 239},
7905        {112, 241, 114, 243, 116, 245, 118, 247, 120, 249, 122, 251, 124, 253, 126, 255}},
7906       {{0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
7907        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
7908        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xab2a, 0xad2c, 0xaf2e},
7909        {0xb130, 0xb332, 0xb534, 0xb736, 0xb938, 0xbb3a, 0xbd3c, 0xbf3e},
7910        {0xc140, 0xc342, 0xc544, 0xc746, 0xc948, 0xcb4a, 0xcd4c, 0xcf4e},
7911        {0xd150, 0xd352, 0xd554, 0xd756, 0xd958, 0xdb5a, 0xdd5c, 0xdf5e},
7912        {0xe160, 0xe362, 0xe564, 0xe766, 0xe968, 0xeb6a, 0xed6c, 0xef6e},
7913        {0xf170, 0xf372, 0xf574, 0xf776, 0xf978, 0xfb7a, 0xfd7c, 0xff7e}},
7914       {{0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
7915        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
7916        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xab2a'a928, 0xaf2e'ad2c},
7917        {0xb332'b130, 0xb736'b534, 0xbb3a'b938, 0xbf3e'bd3c},
7918        {0xc342'c140, 0xc746'c544, 0xcb4a'c948, 0xcf4e'cd4c},
7919        {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
7920        {0xe362'e160, 0xe766'e564, 0xeb6a'e968, 0xef6e'ed6c},
7921        {0xf372'f170, 0xf776'f574, 0xfb7a'f978, 0xff7e'fd7c}},
7922       {{0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
7923        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
7924        {0xaaaa'aaaa'aaaa'aaaa, 0xaf2e'ad2c'ab2a'a928},
7925        {0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b938},
7926        {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
7927        {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
7928        {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
7929        {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
7930       kVectorCalculationsSourceLegacy);
7931 }
7932 
ExecVmaxuvv()7933 [[gnu::naked]] void ExecVmaxuvv() {
7934   asm("vmaxu.vv  v8, v16, v24\n\t"
7935       "ret\n\t");
7936 }
7937 
ExecMaskedVmaxuvv()7938 [[gnu::naked]] void ExecMaskedVmaxuvv() {
7939   asm("vmaxu.vv  v8, v16, v24, v0.t\n\t"
7940       "ret\n\t");
7941 }
7942 
ExecVmaxuvx()7943 [[gnu::naked]] void ExecVmaxuvx() {
7944   asm("vmaxu.vx  v8, v16, t0\n\t"
7945       "ret\n\t");
7946 }
7947 
ExecMaskedVmaxuvx()7948 [[gnu::naked]] void ExecMaskedVmaxuvx() {
7949   asm("vmaxu.vx  v8, v16, t0, v0.t\n\t"
7950       "ret\n\t");
7951 }
7952 
TEST(InlineAsmTestRiscv64,TestVmaxu)7953 TEST(InlineAsmTestRiscv64, TestVmaxu) {
7954   TestVectorInstruction(
7955       ExecVmaxuvv,
7956       ExecMaskedVmaxuvv,
7957       {{0, 129, 4, 131, 9, 133, 12, 135, 17, 137, 20, 139, 24, 141, 28, 143},
7958        {32, 145, 36, 147, 41, 149, 44, 151, 49, 153, 52, 155, 56, 157, 60, 159},
7959        {64, 161, 68, 163, 73, 165, 76, 167, 81, 169, 84, 171, 88, 173, 92, 175},
7960        {96, 177, 100, 179, 105, 181, 108, 183, 113, 185, 116, 187, 120, 189, 124, 191},
7961        {128, 193, 132, 195, 137, 197, 140, 199, 145, 201, 148, 203, 152, 205, 156, 207},
7962        {160, 209, 164, 211, 169, 213, 172, 215, 177, 217, 180, 219, 184, 221, 188, 223},
7963        {192, 225, 196, 227, 201, 229, 204, 231, 209, 233, 212, 235, 216, 237, 220, 239},
7964        {224, 241, 228, 243, 233, 245, 236, 247, 241, 249, 244, 251, 248, 253, 252, 255}},
7965       {{0x8100, 0x8302, 0x8504, 0x8706, 0x8908, 0x8b0a, 0x8d0c, 0x8f0e},
7966        {0x9110, 0x9312, 0x9514, 0x9716, 0x9918, 0x9b1a, 0x9d1c, 0x9f1e},
7967        {0xa120, 0xa322, 0xa524, 0xa726, 0xa928, 0xab2a, 0xad2c, 0xaf2e},
7968        {0xb130, 0xb332, 0xb534, 0xb736, 0xb938, 0xbb3a, 0xbd3c, 0xbf3e},
7969        {0xc140, 0xc342, 0xc544, 0xc746, 0xc948, 0xcb4a, 0xcd4c, 0xcf4e},
7970        {0xd150, 0xd352, 0xd554, 0xd756, 0xd958, 0xdb5a, 0xdd5c, 0xdf5e},
7971        {0xe160, 0xe362, 0xe564, 0xe766, 0xe968, 0xeb6a, 0xed6c, 0xef6e},
7972        {0xf170, 0xf372, 0xf574, 0xf776, 0xf978, 0xfb7a, 0xfd7c, 0xff7e}},
7973       {{0x8302'8100, 0x8706'8504, 0x8b0a'8908, 0x8f0e'8d0c},
7974        {0x9312'9110, 0x9716'9514, 0x9b1a'9918, 0x9f1e'9d1c},
7975        {0xa322'a120, 0xa726'a524, 0xab2a'a928, 0xaf2e'ad2c},
7976        {0xb332'b130, 0xb736'b534, 0xbb3a'b938, 0xbf3e'bd3c},
7977        {0xc342'c140, 0xc746'c544, 0xcb4a'c948, 0xcf4e'cd4c},
7978        {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
7979        {0xe362'e160, 0xe766'e564, 0xeb6a'e968, 0xef6e'ed6c},
7980        {0xf372'f170, 0xf776'f574, 0xfb7a'f978, 0xff7e'fd7c}},
7981       {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8908},
7982        {0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9918},
7983        {0xa726'a524'a322'a120, 0xaf2e'ad2c'ab2a'a928},
7984        {0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b938},
7985        {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
7986        {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
7987        {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
7988        {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
7989       kVectorCalculationsSourceLegacy);
7990   TestVectorInstruction(
7991       ExecVmaxuvx,
7992       ExecMaskedVmaxuvx,
7993       {{170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},
7994        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},
7995        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 170, 173, 170, 175},
7996        {170, 177, 170, 179, 170, 181, 170, 183, 170, 185, 170, 187, 170, 189, 170, 191},
7997        {170, 193, 170, 195, 170, 197, 170, 199, 170, 201, 170, 203, 170, 205, 170, 207},
7998        {170, 209, 170, 211, 170, 213, 170, 215, 170, 217, 170, 219, 170, 221, 170, 223},
7999        {170, 225, 170, 227, 170, 229, 170, 231, 170, 233, 170, 235, 170, 237, 170, 239},
8000        {170, 241, 170, 243, 170, 245, 170, 247, 170, 249, 170, 251, 170, 253, 170, 255}},
8001       {{0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8002        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8003        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xab2a, 0xad2c, 0xaf2e},
8004        {0xb130, 0xb332, 0xb534, 0xb736, 0xb938, 0xbb3a, 0xbd3c, 0xbf3e},
8005        {0xc140, 0xc342, 0xc544, 0xc746, 0xc948, 0xcb4a, 0xcd4c, 0xcf4e},
8006        {0xd150, 0xd352, 0xd554, 0xd756, 0xd958, 0xdb5a, 0xdd5c, 0xdf5e},
8007        {0xe160, 0xe362, 0xe564, 0xe766, 0xe968, 0xeb6a, 0xed6c, 0xef6e},
8008        {0xf170, 0xf372, 0xf574, 0xf776, 0xf978, 0xfb7a, 0xfd7c, 0xff7e}},
8009       {{0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8010        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8011        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xab2a'a928, 0xaf2e'ad2c},
8012        {0xb332'b130, 0xb736'b534, 0xbb3a'b938, 0xbf3e'bd3c},
8013        {0xc342'c140, 0xc746'c544, 0xcb4a'c948, 0xcf4e'cd4c},
8014        {0xd352'd150, 0xd756'd554, 0xdb5a'd958, 0xdf5e'dd5c},
8015        {0xe362'e160, 0xe766'e564, 0xeb6a'e968, 0xef6e'ed6c},
8016        {0xf372'f170, 0xf776'f574, 0xfb7a'f978, 0xff7e'fd7c}},
8017       {{0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8018        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8019        {0xaaaa'aaaa'aaaa'aaaa, 0xaf2e'ad2c'ab2a'a928},
8020        {0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b938},
8021        {0xc746'c544'c342'c140, 0xcf4e'cd4c'cb4a'c948},
8022        {0xd756'd554'd352'd150, 0xdf5e'dd5c'db5a'd958},
8023        {0xe766'e564'e362'e160, 0xef6e'ed6c'eb6a'e968},
8024        {0xf776'f574'f372'f170, 0xff7e'fd7c'fb7a'f978}},
8025       kVectorCalculationsSourceLegacy);
8026 }
8027 
ExecVminvv()8028 [[gnu::naked]] void ExecVminvv() {
8029   asm("vmin.vv  v8, v16, v24\n\t"
8030       "ret\n\t");
8031 }
8032 
ExecMaskedVminvv()8033 [[gnu::naked]] void ExecMaskedVminvv() {
8034   asm("vmin.vv  v8, v16, v24, v0.t\n\t"
8035       "ret\n\t");
8036 }
8037 
ExecVminvx()8038 [[gnu::naked]] void ExecVminvx() {
8039   asm("vmin.vx  v8, v16, t0\n\t"
8040       "ret\n\t");
8041 }
8042 
ExecMaskedVminvx()8043 [[gnu::naked]] void ExecMaskedVminvx() {
8044   asm("vmin.vx  v8, v16, t0, v0.t\n\t"
8045       "ret\n\t");
8046 }
8047 
TEST(InlineAsmTestRiscv64,TestVmin)8048 TEST(InlineAsmTestRiscv64, TestVmin) {
8049   TestVectorInstruction(
8050       ExecVminvv,
8051       ExecMaskedVminvv,
8052       {{0, 129, 2, 131, 4, 133, 6, 135, 8, 137, 10, 139, 12, 141, 14, 143},
8053        {16, 145, 18, 147, 20, 149, 22, 151, 24, 153, 26, 155, 28, 157, 30, 159},
8054        {32, 161, 34, 163, 36, 165, 38, 167, 40, 169, 42, 171, 44, 173, 46, 175},
8055        {48, 177, 50, 179, 52, 181, 54, 183, 56, 185, 58, 187, 60, 189, 62, 191},
8056        {128, 130, 132, 134, 137, 138, 140, 142, 145, 146, 148, 150, 152, 154, 156, 158},
8057        {160, 162, 164, 166, 169, 170, 172, 174, 177, 178, 180, 182, 184, 186, 188, 190},
8058        {192, 194, 196, 198, 201, 202, 204, 206, 209, 210, 212, 214, 216, 218, 220, 222},
8059        {224, 226, 228, 230, 233, 234, 236, 238, 241, 242, 244, 246, 248, 250, 252, 254}},
8060       {{0x8100, 0x8302, 0x8504, 0x8706, 0x8908, 0x8b0a, 0x8d0c, 0x8f0e},
8061        {0x9110, 0x9312, 0x9514, 0x9716, 0x9918, 0x9b1a, 0x9d1c, 0x9f1e},
8062        {0xa120, 0xa322, 0xa524, 0xa726, 0xa928, 0xab2a, 0xad2c, 0xaf2e},
8063        {0xb130, 0xb332, 0xb534, 0xb736, 0xb938, 0xbb3a, 0xbd3c, 0xbf3e},
8064        {0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c},
8065        {0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc},
8066        {0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc},
8067        {0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8, 0xfefc}},
8068       {{0x8302'8100, 0x8706'8504, 0x8b0a'8908, 0x8f0e'8d0c},
8069        {0x9312'9110, 0x9716'9514, 0x9b1a'9918, 0x9f1e'9d1c},
8070        {0xa322'a120, 0xa726'a524, 0xab2a'a928, 0xaf2e'ad2c},
8071        {0xb332'b130, 0xb736'b534, 0xbb3a'b938, 0xbf3e'bd3c},
8072        {0x8684'8280, 0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98},
8073        {0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8},
8074        {0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1, 0xdedc'dad8},
8075        {0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1, 0xfefc'faf8}},
8076       {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8908},
8077        {0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9918},
8078        {0xa726'a524'a322'a120, 0xaf2e'ad2c'ab2a'a928},
8079        {0xb736'b534'b332'b130, 0xbf3e'bd3c'bb3a'b938},
8080        {0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291},
8081        {0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1},
8082        {0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1},
8083        {0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1}},
8084       kVectorCalculationsSourceLegacy);
8085   TestVectorInstruction(
8086       ExecVminvx,
8087       ExecMaskedVminvx,
8088       {{170, 129, 170, 131, 170, 133, 170, 135, 170, 137, 170, 139, 170, 141, 170, 143},
8089        {170, 145, 170, 147, 170, 149, 170, 151, 170, 153, 170, 155, 170, 157, 170, 159},
8090        {170, 161, 170, 163, 170, 165, 170, 167, 170, 169, 170, 170, 170, 170, 170, 170},
8091        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},
8092        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},
8093        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},
8094        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170},
8095        {170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170}},
8096       {{0x8100, 0x8302, 0x8504, 0x8706, 0x8908, 0x8b0a, 0x8d0c, 0x8f0e},
8097        {0x9110, 0x9312, 0x9514, 0x9716, 0x9918, 0x9b1a, 0x9d1c, 0x9f1e},
8098        {0xa120, 0xa322, 0xa524, 0xa726, 0xa928, 0xaaaa, 0xaaaa, 0xaaaa},
8099        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8100        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8101        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8102        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8103        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa}},
8104       {{0x8302'8100, 0x8706'8504, 0x8b0a'8908, 0x8f0e'8d0c},
8105        {0x9312'9110, 0x9716'9514, 0x9b1a'9918, 0x9f1e'9d1c},
8106        {0xa322'a120, 0xa726'a524, 0xaaaa'aaaa, 0xaaaa'aaaa},
8107        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8108        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8109        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8110        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8111        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa}},
8112       {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8908},
8113        {0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9918},
8114        {0xa726'a524'a322'a120, 0xaaaa'aaaa'aaaa'aaaa},
8115        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8116        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8117        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8118        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8119        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa}},
8120       kVectorCalculationsSourceLegacy);
8121 }
8122 
ExecVminuvv()8123 [[gnu::naked]] void ExecVminuvv() {
8124   asm("vminu.vv  v8, v16, v24\n\t"
8125       "ret\n\t");
8126 }
8127 
ExecMaskedVminuvv()8128 [[gnu::naked]] void ExecMaskedVminuvv() {
8129   asm("vminu.vv  v8, v16, v24, v0.t\n\t"
8130       "ret\n\t");
8131 }
8132 
ExecVminuvx()8133 [[gnu::naked]] void ExecVminuvx() {
8134   asm("vminu.vx  v8, v16, t0\n\t"
8135       "ret\n\t");
8136 }
8137 
ExecMaskedVminuvx()8138 [[gnu::naked]] void ExecMaskedVminuvx() {
8139   asm("vminu.vx  v8, v16, t0, v0.t\n\t"
8140       "ret\n\t");
8141 }
8142 
TEST(InlineAsmTestRiscv64,TestVminu)8143 TEST(InlineAsmTestRiscv64, TestVminu) {
8144   TestVectorInstruction(
8145       ExecVminuvv,
8146       ExecMaskedVminuvv,
8147       {{0, 2, 2, 6, 4, 10, 6, 14, 8, 18, 10, 22, 12, 26, 14, 30},
8148        {16, 34, 18, 38, 20, 42, 22, 46, 24, 50, 26, 54, 28, 58, 30, 62},
8149        {32, 66, 34, 70, 36, 74, 38, 78, 40, 82, 42, 86, 44, 90, 46, 94},
8150        {48, 98, 50, 102, 52, 106, 54, 110, 56, 114, 58, 118, 60, 122, 62, 126},
8151        {64, 130, 66, 134, 68, 138, 70, 142, 72, 146, 74, 150, 76, 154, 78, 158},
8152        {80, 162, 82, 166, 84, 170, 86, 174, 88, 178, 90, 182, 92, 186, 94, 190},
8153        {96, 194, 98, 198, 100, 202, 102, 206, 104, 210, 106, 214, 108, 218, 110, 222},
8154        {112, 226, 114, 230, 116, 234, 118, 238, 120, 242, 122, 246, 124, 250, 126, 254}},
8155       {{0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
8156        {0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
8157        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
8158        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
8159        {0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c},
8160        {0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc},
8161        {0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc},
8162        {0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8, 0xfefc}},
8163       {{0x0604'0200, 0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18},
8164        {0x2624'2220, 0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38},
8165        {0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
8166        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
8167        {0x8684'8280, 0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98},
8168        {0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8},
8169        {0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1, 0xdedc'dad8},
8170        {0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1, 0xfefc'faf8}},
8171       {{0x0e0c'0a09'0604'0200, 0x1e1c'1a18'1614'1211},
8172        {0x2e2c'2a29'2624'2220, 0x3e3c'3a38'3634'3231},
8173        {0x4e4c'4a49'4644'4240, 0x5e5c'5a58'5654'5251},
8174        {0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271},
8175        {0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291},
8176        {0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1},
8177        {0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1},
8178        {0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1}},
8179       kVectorCalculationsSourceLegacy);
8180   TestVectorInstruction(
8181       ExecVminuvx,
8182       ExecMaskedVminuvx,
8183       {{0, 129, 2, 131, 4, 133, 6, 135, 8, 137, 10, 139, 12, 141, 14, 143},
8184        {16, 145, 18, 147, 20, 149, 22, 151, 24, 153, 26, 155, 28, 157, 30, 159},
8185        {32, 161, 34, 163, 36, 165, 38, 167, 40, 169, 42, 170, 44, 170, 46, 170},
8186        {48, 170, 50, 170, 52, 170, 54, 170, 56, 170, 58, 170, 60, 170, 62, 170},
8187        {64, 170, 66, 170, 68, 170, 70, 170, 72, 170, 74, 170, 76, 170, 78, 170},
8188        {80, 170, 82, 170, 84, 170, 86, 170, 88, 170, 90, 170, 92, 170, 94, 170},
8189        {96, 170, 98, 170, 100, 170, 102, 170, 104, 170, 106, 170, 108, 170, 110, 170},
8190        {112, 170, 114, 170, 116, 170, 118, 170, 120, 170, 122, 170, 124, 170, 126, 170}},
8191       {{0x8100, 0x8302, 0x8504, 0x8706, 0x8908, 0x8b0a, 0x8d0c, 0x8f0e},
8192        {0x9110, 0x9312, 0x9514, 0x9716, 0x9918, 0x9b1a, 0x9d1c, 0x9f1e},
8193        {0xa120, 0xa322, 0xa524, 0xa726, 0xa928, 0xaaaa, 0xaaaa, 0xaaaa},
8194        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8195        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8196        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8197        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa},
8198        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa}},
8199       {{0x8302'8100, 0x8706'8504, 0x8b0a'8908, 0x8f0e'8d0c},
8200        {0x9312'9110, 0x9716'9514, 0x9b1a'9918, 0x9f1e'9d1c},
8201        {0xa322'a120, 0xa726'a524, 0xaaaa'aaaa, 0xaaaa'aaaa},
8202        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8203        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8204        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8205        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa},
8206        {0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa, 0xaaaa'aaaa}},
8207       {{0x8706'8504'8302'8100, 0x8f0e'8d0c'8b0a'8908},
8208        {0x9716'9514'9312'9110, 0x9f1e'9d1c'9b1a'9918},
8209        {0xa726'a524'a322'a120, 0xaaaa'aaaa'aaaa'aaaa},
8210        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8211        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8212        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8213        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa},
8214        {0xaaaa'aaaa'aaaa'aaaa, 0xaaaa'aaaa'aaaa'aaaa}},
8215       kVectorCalculationsSourceLegacy);
8216 }
8217 
ExecVmulvv()8218 [[gnu::naked]] void ExecVmulvv() {
8219   asm("vmul.vv  v8, v16, v24\n\t"
8220       "ret\n\t");
8221 }
8222 
ExecMaskedVmulvv()8223 [[gnu::naked]] void ExecMaskedVmulvv() {
8224   asm("vmul.vv  v8, v16, v24, v0.t\n\t"
8225       "ret\n\t");
8226 }
8227 
ExecVmulvx()8228 [[gnu::naked]] void ExecVmulvx() {
8229   asm("vmul.vx  v8, v16, t0\n\t"
8230       "ret\n\t");
8231 }
8232 
ExecMaskedVmulvx()8233 [[gnu::naked]] void ExecMaskedVmulvx() {
8234   asm("vmul.vx  v8, v16, t0, v0.t\n\t"
8235       "ret\n\t");
8236 }
8237 
ExecVfmulvv()8238 [[gnu::naked]] void ExecVfmulvv() {
8239   asm("vfmul.vv  v8, v16, v24\n\t"
8240       "ret\n\t");
8241 }
8242 
ExecMaskedVfmulvv()8243 [[gnu::naked]] void ExecMaskedVfmulvv() {
8244   asm("vfmul.vv  v8, v16, v24, v0.t\n\t"
8245       "ret\n\t");
8246 }
8247 
ExecVfmulvf()8248 [[gnu::naked]] void ExecVfmulvf() {
8249   asm("vfmul.vf  v8, v16, ft0\n\t"
8250       "ret\n\t");
8251 }
8252 
ExecMaskedVfmulvf()8253 [[gnu::naked]] void ExecMaskedVfmulvf() {
8254   asm("vfmul.vf  v8, v16, ft0, v0.t\n\t"
8255       "ret\n\t");
8256 }
8257 
ExecVfwmulvv()8258 [[gnu::naked]] void ExecVfwmulvv() {
8259   asm("vfwmul.vv  v8, v16, v24\n\t"
8260       "ret\n\t");
8261 }
8262 
ExecMaskedVfwmulvv()8263 [[gnu::naked]] void ExecMaskedVfwmulvv() {
8264   asm("vfwmul.vv  v8, v16, v24, v0.t\n\t"
8265       "ret\n\t");
8266 }
8267 
ExecVfwmulvf()8268 [[gnu::naked]] void ExecVfwmulvf() {
8269   asm("vfwmul.vf  v8, v16, ft0\n\t"
8270       "ret\n\t");
8271 }
8272 
ExecMaskedVfwmulvf()8273 [[gnu::naked]] void ExecMaskedVfwmulvf() {
8274   asm("vfwmul.vf  v8, v16, ft0, v0.t\n\t"
8275       "ret\n\t");
8276 }
8277 
TEST(InlineAsmTestRiscv64,TestVmul)8278 TEST(InlineAsmTestRiscv64, TestVmul) {
8279   TestVectorInstruction(ExecVmulvv,
8280                         ExecMaskedVmulvv,
8281                         {{0, 2, 8, 18, 36, 50, 72, 98, 136, 162, 200, 242, 32, 82, 136, 194},
8282                          {0, 66, 136, 210, 52, 114, 200, 34, 152, 226, 72, 178, 32, 146, 8, 130},
8283                          {0, 130, 8, 146, 68, 178, 72, 226, 168, 34, 200, 114, 32, 210, 136, 66},
8284                          {0, 194, 136, 82, 84, 242, 200, 162, 184, 98, 72, 50, 32, 18, 8, 2},
8285                          {0, 2, 8, 18, 100, 50, 72, 98, 200, 162, 200, 242, 32, 82, 136, 194},
8286                          {0, 66, 136, 210, 116, 114, 200, 34, 216, 226, 72, 178, 32, 146, 8, 130},
8287                          {0, 130, 8, 146, 132, 178, 72, 226, 232, 34, 200, 114, 32, 210, 136, 66},
8288                          {0, 194, 136, 82, 148, 242, 200, 162, 248, 98, 72, 50, 32, 18, 8, 2}},
8289                         {{0x0000, 0x1808, 0xd524, 0xa848, 0xa988, 0xb8c8, 0x7120, 0x4988},
8290                          {0x4200, 0x5a88, 0x2834, 0xebc8, 0xfd98, 0xfd48, 0xb620, 0x8f08},
8291                          {0x8800, 0xa108, 0x7f44, 0x3348, 0x55a8, 0x45c8, 0xff20, 0xd888},
8292                          {0xd200, 0xeb88, 0xda54, 0x7ec8, 0xb1b8, 0x9248, 0x4c20, 0x2608},
8293                          {0x2000, 0x3a08, 0x3964, 0xce48, 0x11c8, 0xe2c8, 0x9d20, 0x7788},
8294                          {0x7200, 0x8c88, 0x9c74, 0x21c8, 0x75d8, 0x3748, 0xf220, 0xcd08},
8295                          {0xc800, 0xe308, 0x0384, 0x7948, 0xdde8, 0x8fc8, 0x4b20, 0x2688},
8296                          {0x2200, 0x3d88, 0x6e94, 0xd4c8, 0x49f8, 0xec48, 0xa820, 0x8408}},
8297                         {{0x0902'0000, 0x749c'd524, 0x5df5'a988, 0xb900'7120},
8298                          {0x9fd6'4200, 0x1e83'2834, 0x0add'fd98, 0x58da'b620},
8299                          {0x42b2'8800, 0xd471'7f44, 0xc3ce'55a8, 0x04bc'ff20},
8300                          {0xf196'd200, 0x9667'da54, 0x88c6'b1b8, 0xbca7'4c20},
8301                          {0xac83'2000, 0x6466'3964, 0x59c7'11c8, 0x8099'9d20},
8302                          {0x7377'7200, 0x3e6c'9c74, 0x36cf'75d8, 0x5093'f220},
8303                          {0x4673'c800, 0x247b'0384, 0x1fdf'dde8, 0x2c96'4b20},
8304                          {0x2578'2200, 0x1691'6e94, 0x14f8'49f8, 0x14a0'a820}},
8305                         {{0xfc4e'ad16'0902'0000, 0xa697'acf5'5df5'a988},
8306                          {0x4fde'a9cf'9fd6'4200, 0x0833'b3b7'0add'fd98},
8307                          {0xbf86'ba99'42b2'8800, 0x85e7'ce88'c3ce'55a8},
8308                          {0x4b46'df72'f196'd200, 0x1fb3'fd6a'88c6'b1b8},
8309                          {0xf31f'185c'ac83'2000, 0xd598'405c'59c7'11c8},
8310                          {0xb70f'6556'7377'7200, 0xa794'975e'36cf'75d8},
8311                          {0x9717'c660'4673'c800, 0x95a9'0270'1fdf'dde8},
8312                          {0x9338'3b7a'2578'2200, 0x9fd5'8192'14f8'49f8}},
8313                         kVectorCalculationsSourceLegacy);
8314   TestVectorInstruction(
8315       ExecVmulvx,
8316       ExecMaskedVmulvx,
8317       {{0, 170, 84, 254, 168, 82, 252, 166, 80, 250, 164, 78, 248, 162, 76, 246},
8318        {160, 74, 244, 158, 72, 242, 156, 70, 240, 154, 68, 238, 152, 66, 236, 150},
8319        {64, 234, 148, 62, 232, 146, 60, 230, 144, 58, 228, 142, 56, 226, 140, 54},
8320        {224, 138, 52, 222, 136, 50, 220, 134, 48, 218, 132, 46, 216, 130, 44, 214},
8321        {128, 42, 212, 126, 40, 210, 124, 38, 208, 122, 36, 206, 120, 34, 204, 118},
8322        {32, 202, 116, 30, 200, 114, 28, 198, 112, 26, 196, 110, 24, 194, 108, 22},
8323        {192, 106, 20, 190, 104, 18, 188, 102, 16, 186, 100, 14, 184, 98, 12, 182},
8324        {96, 10, 180, 94, 8, 178, 92, 6, 176, 90, 4, 174, 88, 2, 172, 86}},
8325       {{0xaa00, 0x5354, 0xfca8, 0xa5fc, 0x4f50, 0xf8a4, 0xa1f8, 0x4b4c},
8326        {0xf4a0, 0x9df4, 0x4748, 0xf09c, 0x99f0, 0x4344, 0xec98, 0x95ec},
8327        {0x3f40, 0xe894, 0x91e8, 0x3b3c, 0xe490, 0x8de4, 0x3738, 0xe08c},
8328        {0x89e0, 0x3334, 0xdc88, 0x85dc, 0x2f30, 0xd884, 0x81d8, 0x2b2c},
8329        {0xd480, 0x7dd4, 0x2728, 0xd07c, 0x79d0, 0x2324, 0xcc78, 0x75cc},
8330        {0x1f20, 0xc874, 0x71c8, 0x1b1c, 0xc470, 0x6dc4, 0x1718, 0xc06c},
8331        {0x69c0, 0x1314, 0xbc68, 0x65bc, 0x0f10, 0xb864, 0x61b8, 0x0b0c},
8332        {0xb460, 0x5db4, 0x0708, 0xb05c, 0x59b0, 0x0304, 0xac58, 0x55ac}},
8333       {{0x5353'aa00, 0xfb50'fca8, 0xa34e'4f50, 0x4b4b'a1f8},
8334        {0xf348'f4a0, 0x9b46'4748, 0x4343'99f0, 0xeb40'ec98},
8335        {0x933e'3f40, 0x3b3b'91e8, 0xe338'e490, 0x8b36'3738},
8336        {0x3333'89e0, 0xdb30'dc88, 0x832e'2f30, 0x2b2b'81d8},
8337        {0xd328'd480, 0x7b26'2728, 0x2323'79d0, 0xcb20'cc78},
8338        {0x731e'1f20, 0x1b1b'71c8, 0xc318'c470, 0x6b16'1718},
8339        {0x1313'69c0, 0xbb10'bc68, 0x630e'0f10, 0x0b0b'61b8},
8340        {0xb308'b460, 0x5b06'0708, 0x0303'59b0, 0xab00'ac58}},
8341       {{0xa5fb'a752'5353'aa00, 0x4b4b'a1f7'a34e'4f50},
8342        {0xf09b'9c9c'f348'f4a0, 0x95eb'9742'4343'99f0},
8343        {0x3b3b'91e7'933e'3f40, 0xe08b'8c8c'e338'e490},
8344        {0x85db'8732'3333'89e0, 0x2b2b'81d7'832e'2f30},
8345        {0xd07b'7c7c'd328'd480, 0x75cb'7722'2323'79d0},
8346        {0x1b1b'71c7'731e'1f20, 0xc06b'6c6c'c318'c470},
8347        {0x65bb'6712'1313'69c0, 0x0b0b'61b7'630e'0f10},
8348        {0xb05b'5c5c'b308'b460, 0x55ab'5702'0303'59b0}},
8349       kVectorCalculationsSourceLegacy);
8350   TestVectorFloatInstruction(ExecVfmulvv,
8351                              ExecMaskedVfmulvv,
8352                              {{0x8000'0000, 0x8000'0000, 0x8000'0000, 0x8000'0000},
8353                               {0x8000'02f0, 0x85ca'89ec, 0x91d9'a3e9, 0x9de9'3ee6},
8354                               {0xa9f9'5ae5, 0xb604'fbf4, 0xc20d'8af5, 0xce16'5a77},
8355                               {0xda1f'6a7a, 0xe628'bafe, 0xf232'4c02, 0xfe3c'1d87},
8356                               {0x0a49'9dd9, 0x165a'3ee4, 0x226b'60ef, 0x2e7d'03f9},
8357                               {0x3a87'9403, 0x4690'e68c, 0x529a'7994, 0x5ea4'4d1d},
8358                               {0x6aae'6126, 0x76b8'b5b2, 0x7f80'0000, 0x7f80'0000},
8359                               {0x7f80'0000, 0x7f80'0000, 0x7f80'0000, 0x7f80'0000}},
8360                              {{0x8000'0000'0000'0000, 0x8000'0000'0000'0000},
8361                               {0x8553'e032'b59e'2bf7, 0x9d6b'012b'925d'8532},
8362                               {0xb584'0511'cdec'af2c, 0xcd9b'2e22'd263'd03f},
8363                               {0xe5b4'2a11'269b'b302, 0xfdcb'5b3a'52ca'9bed},
8364                               {0x15e4'4f30'bfab'3779, 0x2dfb'8872'1391'e83b},
8365                               {0x4614'7470'991b'3c90, 0x5e2b'b5ca'14b9'b52b},
8366                               {0x7644'99d0'b2eb'c249, 0x7ff0'0000'0000'0000},
8367                               {0x7ff0'0000'0000'0000, 0x7ff0'0000'0000'0000}},
8368                              kVectorCalculationsSourceLegacy);
8369   TestVectorFloatInstruction(ExecVfmulvf,
8370                              ExecMaskedVfmulvf,
8371                              {{0x8437'8568, 0x883d'2b0e, 0x8c42'd0b3, 0x9048'7659},
8372                               {0x944e'1bfe, 0x9853'c1a4, 0x9c59'674a, 0xa05f'0cef},
8373                               {0xa464'b295, 0xa86a'583b, 0xac6f'fde0, 0xb075'a386},
8374                               {0xb47b'492c, 0xb880'7769, 0xbc83'4a3b, 0xc086'1d0e},
8375                               {0xc488'efe1, 0xc88b'c2b4, 0xcc8e'9587, 0xd091'6859},
8376                               {0xd494'3b2c, 0xd897'0dff, 0xdc99'e0d2, 0xe09c'b3a5},
8377                               {0xe49f'8678, 0xe8a2'594a, 0xeca5'2c1d, 0xf0a7'fef0},
8378                               {0xf4aa'd1c3, 0xf8ad'a496, 0xfcb0'7768, 0xff80'0000}},
8379                              {{0x872f'ab0e'583b'8568, 0x8f35'7b2c'd1c3'685a},
8380                               {0x973f'c1a4'eed2'1bfe, 0x9f45'8678'1d0e'b3a5},
8381                               {0xa74f'd83b'8568'b295, 0xaf55'91c3'6859'fef0},
8382                               {0xb75f'eed2'1bff'492c, 0xbf65'9d0e'b3a5'4a3b},
8383                               {0xc770'02b4'594a'efe1, 0xcf75'a859'fef0'9587},
8384                               {0xd780'0dff'a496'3b2c, 0xdf85'b3a5'4a3b'e0d2},
8385                               {0xe790'194a'efe1'8678, 0xef95'bef0'9587'2c1d},
8386                               {0xf7a0'2496'3b2c'd1c3, 0xffa5'ca3b'e0d2'7768}},
8387                              kVectorCalculationsSourceLegacy);
8388   TestWideningVectorFloatInstruction(ExecVfwmulvv,
8389                                      ExecMaskedVfwmulvv,
8390                                      {{0x3330'e53c'6480'0000, 0x34b2'786b'bbc5'4900},
8391                                       {0x3234'1766'da4a'6200, 0x33b5'cab6'2d6c'4800},
8392                                       {0x3937'92ba'5bd0'8000, 0x3ab9'666a'779a'0d00},
8393                                       {0x383b'4565'd61f'6600, 0x39bd'3935'e5bd'8800},
8394                                       {0x3f3f'423b'5522'0000, 0x40c0'ab36'1ab7'e880},
8395                                       {0x3e41'bab3'e9fa'b500, 0x3fc2'd4dc'5007'e400},
8396                                       {0x4543'f9df'a83a'4000, 0x46c5'2438'7aa3'4a80},
8397                                       {0x4446'53b6'69e6'3700, 0x45c7'8e1f'2e31'8400}},
8398                                      kVectorCalculationsSource);
8399   TestWideningVectorFloatInstruction(ExecVfwmulvf,
8400                                      ExecMaskedVfwmulvf,
8401                                      {{0xb886'f0ad'0000'0000, 0xb907'a561'b400'0000},
8402                                       {0xb988'5a16'6800'0000, 0xba09'0ecb'1c00'0000},
8403                                       {0xba89'c37f'd000'0000, 0xbb0a'7834'8400'0000},
8404                                       {0xbb8b'2ce9'3800'0000, 0xbc0b'e19d'ec00'0000},
8405                                       {0xbc8c'9652'a000'0000, 0xbd0d'4b07'5400'0000},
8406                                       {0xbd8d'ffbc'0800'0000, 0xbe0e'b470'bc00'0000},
8407                                       {0xbe8f'6925'7000'0000, 0xbf10'0eed'1200'0000},
8408                                       {0xbf90'6947'6c00'0000, 0xc010'c3a1'c600'0000}},
8409                                      kVectorCalculationsSource);
8410 }
8411 
ExecVmulhvv()8412 [[gnu::naked]] void ExecVmulhvv() {
8413   asm("vmulh.vv  v8, v16, v24\n\t"
8414       "ret\n\t");
8415 }
8416 
ExecMaskedVmulhvv()8417 [[gnu::naked]] void ExecMaskedVmulhvv() {
8418   asm("vmulh.vv  v8, v16, v24, v0.t\n\t"
8419       "ret\n\t");
8420 }
8421 
ExecVmulhvx()8422 [[gnu::naked]] void ExecVmulhvx() {
8423   asm("vmulh.vx  v8, v16, t0\n\t"
8424       "ret\n\t");
8425 }
8426 
ExecMaskedVmulhvx()8427 [[gnu::naked]] void ExecMaskedVmulhvx() {
8428   asm("vmulh.vx  v8, v16, t0, v0.t\n\t"
8429       "ret\n\t");
8430 }
8431 
TEST(InlineAsmTestRiscv64,TestVmulh)8432 TEST(InlineAsmTestRiscv64, TestVmulh) {
8433   TestVectorInstruction(ExecVmulhvv,
8434                         ExecMaskedVmulhvv,
8435                         {{0, 255, 0, 253, 0, 251, 0, 249, 0, 247, 0, 245, 1, 244, 1, 242},
8436                          {2, 241, 2, 239, 3, 238, 3, 237, 4, 235, 5, 234, 6, 233, 7, 232},
8437                          {8, 231, 9, 230, 10, 229, 11, 228, 12, 228, 13, 227, 15, 226, 16, 226},
8438                          {18, 225, 19, 225, 21, 224, 22, 224, 24, 224, 26, 224, 28, 224, 30, 224},
8439                          {224, 31, 224, 29, 224, 27, 224, 25, 224, 23, 224, 21, 225, 20, 225, 18},
8440                          {226, 17, 226, 15, 227, 14, 227, 13, 228, 11, 229, 10, 230, 9, 231, 8},
8441                          {232, 7, 233, 6, 234, 5, 235, 4, 236, 4, 237, 3, 239, 2, 240, 2},
8442                          {242, 1, 243, 1, 245, 0, 246, 0, 248, 0, 250, 0, 252, 0, 254, 0}},
8443                         {{0xff02, 0xfd10, 0xfb2d, 0xf95c, 0xf79a, 0xf5e9, 0xf448, 0xf2b7},
8444                          {0xf136, 0xefc5, 0xee64, 0xed13, 0xebd2, 0xeaa2, 0xe982, 0xe872},
8445                          {0xe772, 0xe682, 0xe5a2, 0xe4d3, 0xe413, 0xe364, 0xe2c4, 0xe235},
8446                          {0xe1b6, 0xe147, 0xe0e8, 0xe09a, 0xe05b, 0xe02d, 0xe00f, 0xe001},
8447                          {0x1ec3, 0x1cd3, 0x1af3, 0x1923, 0x1764, 0x15b4, 0x1415, 0x1286},
8448                          {0x1107, 0x0f98, 0x0e39, 0x0ceb, 0x0bac, 0x0a7e, 0x095f, 0x0851},
8449                          {0x0753, 0x0665, 0x0588, 0x04ba, 0x03fc, 0x034f, 0x02b2, 0x0225},
8450                          {0x01a8, 0x013b, 0x00de, 0x0091, 0x0055, 0x0028, 0x000c, 0x0000}},
8451                         {{0xfd10'1a16, 0xf95c'aad6, 0xf5e9'bc58, 0xf2b7'4e9b},
8452                          {0xefc5'619f, 0xed13'f564, 0xeaa3'09ea, 0xe872'9f31},
8453                          {0xe682'b539, 0xe4d3'4c01, 0xe364'638b, 0xe235'fbd7},
8454                          {0xe148'14e2, 0xe09a'aeaf, 0xe02d'c93d, 0xe001'648c},
8455                          {0x1cd2'bf5c, 0x1923'5829, 0x15b4'71b7, 0x1286'0c06},
8456                          {0x0f98'2716, 0x0cea'c2e7, 0x0a7d'df79, 0x0851'7ccc},
8457                          {0x0665'9ae0, 0x04ba'39b5, 0x034f'594b, 0x0224'f9a2},
8458                          {0x013b'1aba, 0x0091'bc93, 0x0028'df2d, 0x0000'8288}},
8459                         {{0xf95c'aad6'78f5'63b8, 0xf2b7'4e9b'bf9d'55cb},
8460                          {0xed13'f564'2968'6900, 0xe872'9f31'6a0c'5913},
8461                          {0xe4d3'4c01'edf3'8a67, 0xe235'fbd7'2893'787a},
8462                          {0xe09a'aeaf'c696'c7ef, 0xe001'648c'fb32'b402},
8463                          {0x1923'5828'f00f'6056, 0x1286'0c06'169f'4261},
8464                          {0x0cea'c2e6'e0d2'c60e, 0x0851'7ccc'015e'a619},
8465                          {0x04ba'39b4'e5ae'47e6, 0x0224'f9a2'0036'25f1},
8466                          {0x0091'bc92'fea1'e5de, 0x0000'8288'1325'c1e9}},
8467                         kVectorCalculationsSourceLegacy);
8468   TestVectorInstruction(
8469       ExecVmulhvx,
8470       ExecMaskedVmulhvx,
8471       {{0, 42, 255, 41, 254, 41, 253, 40, 253, 39, 252, 39, 251, 38, 251, 37},
8472        {250, 37, 249, 36, 249, 35, 248, 35, 247, 34, 247, 33, 246, 33, 245, 32},
8473        {245, 31, 244, 31, 243, 30, 243, 29, 242, 29, 241, 28, 241, 27, 240, 27},
8474        {239, 26, 239, 25, 238, 25, 237, 24, 237, 23, 236, 23, 235, 22, 235, 21},
8475        {234, 21, 233, 20, 233, 19, 232, 19, 231, 18, 231, 17, 230, 17, 229, 16},
8476        {229, 15, 228, 15, 227, 14, 227, 13, 226, 13, 225, 12, 225, 11, 224, 11},
8477        {223, 10, 223, 9, 222, 9, 221, 8, 221, 7, 220, 7, 219, 6, 219, 5},
8478        {218, 5, 217, 4, 217, 3, 216, 3, 215, 2, 215, 1, 214, 1, 213, 0}},
8479       {{0x2a55, 0x29aa, 0x28fe, 0x2853, 0x27a8, 0x26fc, 0x2651, 0x25a6},
8480        {0x24fa, 0x244f, 0x23a4, 0x22f8, 0x224d, 0x21a2, 0x20f6, 0x204b},
8481        {0x1fa0, 0x1ef4, 0x1e49, 0x1d9e, 0x1cf2, 0x1c47, 0x1b9c, 0x1af0},
8482        {0x1a45, 0x199a, 0x18ee, 0x1843, 0x1798, 0x16ec, 0x1641, 0x1596},
8483        {0x14ea, 0x143f, 0x1394, 0x12e8, 0x123d, 0x1192, 0x10e6, 0x103b},  // NOTYPO
8484        {0x0f90, 0x0ee4, 0x0e39, 0x0d8e, 0x0ce2, 0x0c37, 0x0b8c, 0x0ae0},
8485        {0x0a35, 0x098a, 0x08de, 0x0833, 0x0788, 0x06dc, 0x0631, 0x0586},
8486        {0x04da, 0x042f, 0x0384, 0x02d8, 0x022d, 0x0182, 0x00d6, 0x002b}},
8487       {{0x29a9'd500, 0x2853'28fe, 0x26fc'7cfd, 0x25a5'd0fc},
8488        {0x244f'24fa, 0x22f8'78f9, 0x21a1'ccf8, 0x204b'20f6},
8489        {0x1ef4'74f5, 0x1d9d'c8f4, 0x1c47'1cf2, 0x1af0'70f1},
8490        {0x1999'c4f0, 0x1843'18ee, 0x16ec'6ced, 0x1595'c0ec},
8491        {0x143f'14ea, 0x12e8'68e9, 0x1191'bce8, 0x103b'10e6},  // NOTYPO
8492        {0x0ee4'64e5, 0x0d8d'b8e4, 0x0c37'0ce2, 0x0ae0'60e1},
8493        {0x0989'b4e0, 0x0833'08de, 0x06dc'5cdd, 0x0585'b0dc},
8494        {0x042f'04da, 0x02d8'58d9, 0x0181'acd8, 0x002b'00d6}},
8495       {{0x2853'28fe'7eff'2a55, 0x25a5'd0fb'd1a7'27a8},
8496        {0x22f8'78f9'244f'24fa, 0x204b'20f6'76f7'224d},
8497        {0x1d9d'c8f3'c99f'1fa0, 0x1af0'70f1'1c47'1cf2},
8498        {0x1843'18ee'6eef'1a45, 0x1595'c0eb'c197'1798},
8499        {0x12e8'68e9'143f'14ea, 0x103b'10e6'66e7'123d},  // NOTYPO
8500        {0x0d8d'b8e3'b98f'0f90, 0x0ae0'60e1'0c37'0ce2},
8501        {0x0833'08de'5edf'0a35, 0x0585'b0db'b187'0788},
8502        {0x02d8'58d9'042f'04da, 0x002b'00d6'56d7'022d}},
8503       kVectorCalculationsSourceLegacy);
8504 }
8505 
ExecVmulhuvv()8506 [[gnu::naked]] void ExecVmulhuvv() {
8507   asm("vmulhu.vv  v8, v16, v24\n\t"
8508       "ret\n\t");
8509 }
8510 
ExecMaskedVmulhuvv()8511 [[gnu::naked]] void ExecMaskedVmulhuvv() {
8512   asm("vmulhu.vv  v8, v16, v24, v0.t\n\t"
8513       "ret\n\t");
8514 }
8515 
ExecVmulhuvx()8516 [[gnu::naked]] void ExecVmulhuvx() {
8517   asm("vmulhu.vx  v8, v16, t0\n\t"
8518       "ret\n\t");
8519 }
8520 
ExecMaskedVmulhuvx()8521 [[gnu::naked]] void ExecMaskedVmulhuvx() {
8522   asm("vmulhu.vx  v8, v16, t0, v0.t\n\t"
8523       "ret\n\t");
8524 }
8525 
TEST(InlineAsmTestRiscv64,TestVmulhu)8526 TEST(InlineAsmTestRiscv64, TestVmulhu) {
8527   TestVectorInstruction(
8528       ExecVmulhuvv,
8529       ExecMaskedVmulhuvv,
8530       {{0, 1, 0, 3, 0, 5, 0, 7, 0, 9, 0, 11, 1, 14, 1, 16},
8531        {2, 19, 2, 21, 3, 24, 3, 27, 4, 29, 5, 32, 6, 35, 7, 38},
8532        {8, 41, 9, 44, 10, 47, 11, 50, 12, 54, 13, 57, 15, 60, 16, 64},
8533        {18, 67, 19, 71, 21, 74, 22, 78, 24, 82, 26, 86, 28, 90, 30, 94},
8534        {32, 98, 34, 102, 36, 106, 38, 110, 40, 114, 42, 118, 45, 123, 47, 127},
8535        {50, 132, 52, 136, 55, 141, 57, 146, 60, 150, 63, 155, 66, 160, 69, 165},
8536        {72, 170, 75, 175, 78, 180, 81, 185, 84, 191, 87, 196, 91, 201, 94, 207},
8537        {98, 212, 101, 218, 105, 223, 108, 229, 112, 235, 116, 241, 120, 247, 124, 253}},
8538       {{0x0102, 0x0314, 0x0536, 0x0768, 0x09ab, 0x0bfd, 0x0e60, 0x10d3},
8539        {0x1356, 0x15e9, 0x188d, 0x1b3f, 0x1e03, 0x20d6, 0x23ba, 0x26ae},
8540        {0x29b2, 0x2cc6, 0x2feb, 0x331f, 0x3664, 0x39b8, 0x3d1c, 0x4091},
8541        {0x4416, 0x47ab, 0x4b51, 0x4f06, 0x52cc, 0x56a1, 0x5a87, 0x5e7d},
8542        {0x6283, 0x6699, 0x6ac0, 0x6ef5, 0x733d, 0x7792, 0x7bf9, 0x8070},
8543        {0x84f7, 0x898e, 0x8e36, 0x92ed, 0x97b5, 0x9c8c, 0xa173, 0xa66b},
8544        {0xab73, 0xb08b, 0xb5b5, 0xbaec, 0xc035, 0xc58d, 0xcaf6, 0xd06f},
8545        {0xd5f8, 0xdb91, 0xe13b, 0xe6f3, 0xecbe, 0xf296, 0xf880, 0xfe7a}},
8546       {{0x0314'1c16, 0x0768'b4df, 0x0bfd'ce69, 0x10d3'68b3},
8547        {0x15e9'83bf, 0x1b40'1f8d, 0x20d7'3c1b, 0x26ae'd969},
8548        {0x2cc6'f779, 0x331f'964a, 0x39b8'b5dc, 0x4092'562f},
8549        {0x47ac'7742, 0x4f07'1918, 0x56a2'3bae, 0x5e7d'df04},
8550        {0x669a'031c, 0x6ef6'a7f6, 0x7793'cd90, 0x8071'73ea},
8551        {0x898f'9b06, 0x92ee'42e4, 0x9c8d'6b82, 0xa66d'14e0},
8552        {0xb08d'3f00, 0xbaed'e9e2, 0xc58f'1584, 0xd070'c1e6},
8553        {0xdb92'ef0a, 0xe6f5'9cf0, 0xf298'cb96, 0xfe7c'7afc}},
8554       {{0x0768'b4df'7ef9'65b8, 0x10d3'68b3'd5b1'67dc},
8555        {0x1b40'1f8d'4f8c'8b20, 0x26ae'd969'a040'8b44},
8556        {0x331f'964b'3437'cca7, 0x4092'562f'7ee7'cacb},
8557        {0x4f07'1919'2cfb'2a4f, 0x5e7d'df05'71a7'2673},
8558        {0x6ef6'a7f7'39d6'a416, 0x8071'73eb'787e'9e3a},
8559        {0x92ee'42e5'5aca'39fe, 0xa66d'14e1'936e'3222},
8560        {0xbaed'e9e3'8fd5'ec06, 0xd070'c1e7'c275'e22a},
8561        {0xe6f5'9cf1'd8f9'ba2e, 0xfe7c'7afe'0595'ae52}},
8562       kVectorCalculationsSourceLegacy);
8563   TestVectorInstruction(ExecVmulhuvx,
8564                         ExecMaskedVmulhuvx,
8565                         {{0, 85, 1, 86, 2, 88, 3, 89, 5, 90, 6, 92, 7, 93, 9, 94},
8566                          {10, 96, 11, 97, 13, 98, 14, 100, 15, 101, 17, 102, 18, 104, 19, 105},
8567                          {21, 106, 22, 108, 23, 109, 25, 110, 26, 112, 27, 113, 29, 114, 30, 116},
8568                          {31, 117, 33, 118, 34, 120, 35, 121, 37, 122, 38, 124, 39, 125, 41, 126},
8569                          {42, 128, 43, 129, 45, 130, 46, 132, 47, 133, 49, 134, 50, 136, 51, 137},
8570                          {53, 138, 54, 140, 55, 141, 57, 142, 58, 144, 59, 145, 61, 146, 62, 148},
8571                          {63, 149, 65, 150, 66, 152, 67, 153, 69, 154, 70, 156, 71, 157, 73, 158},
8572                          {74, 160, 75, 161, 77, 162, 78, 164, 79, 165, 81, 166, 82, 168, 83, 169}},
8573                         {{0x55ff, 0x5756, 0x58ac, 0x5a03, 0x5b5a, 0x5cb0, 0x5e07, 0x5f5e},
8574                          {0x60b4, 0x620b, 0x6362, 0x64b8, 0x660f, 0x6766, 0x68bc, 0x6a13},
8575                          {0x6b6a, 0x6cc0, 0x6e17, 0x6f6e, 0x70c4, 0x721b, 0x7372, 0x74c8},
8576                          {0x761f, 0x7776, 0x78cc, 0x7a23, 0x7b7a, 0x7cd0, 0x7e27, 0x7f7e},
8577                          {0x80d4, 0x822b, 0x8382, 0x84d8, 0x862f, 0x8786, 0x88dc, 0x8a33},
8578                          {0x8b8a, 0x8ce0, 0x8e37, 0x8f8e, 0x90e4, 0x923b, 0x9392, 0x94e8},
8579                          {0x963f, 0x9796, 0x98ec, 0x9a43, 0x9b9a, 0x9cf0, 0x9e47, 0x9f9e},
8580                          {0xa0f4, 0xa24b, 0xa3a2, 0xa4f8, 0xa64f, 0xa7a6, 0xa8fc, 0xaa53}},
8581                         {{0x5757'00aa, 0x5a04'58ac, 0x5cb1'b0af, 0x5f5f'08b2},
8582                          {0x620c'60b4, 0x64b9'b8b7, 0x6767'10ba, 0x6a14'68bc},
8583                          {0x6cc1'c0bf, 0x6f6f'18c2, 0x721c'70c4, 0x74c9'c8c7},
8584                          {0x7777'20ca, 0x7a24'78cc, 0x7cd1'd0cf, 0x7f7f'28d2},
8585                          {0x822c'80d4, 0x84d9'd8d7, 0x8787'30da, 0x8a34'88dc},
8586                          {0x8ce1'e0df, 0x8f8f'38e2, 0x923c'90e4, 0x94e9'e8e7},
8587                          {0x9797'40ea, 0x9a44'98ec, 0x9cf1'f0ef, 0x9f9f'48f2},
8588                          {0xa24c'a0f4, 0xa4f9'f8f7, 0xa7a7'50fa, 0xaa54'a8fc}},
8589                         {{0x5a04'58ad'acac'55ff, 0x5f5f'08b3'075c'5b5a},
8590                          {0x64b9'b8b8'620c'60b4, 0x6a14'68bd'bcbc'660f},
8591                          {0x6f6f'18c3'176c'6b6a, 0x74c9'c8c8'721c'70c4},
8592                          {0x7a24'78cd'cccc'761f, 0x7f7f'28d3'277c'7b7a},
8593                          {0x84d9'd8d8'822c'80d4, 0x8a34'88dd'dcdc'862f},
8594                          {0x8f8f'38e3'378c'8b8a, 0x94e9'e8e8'923c'90e4},
8595                          {0x9a44'98ed'ecec'963f, 0x9f9f'48f3'479c'9b9a},
8596                          {0xa4f9'f8f8'a24c'a0f4, 0xaa54'a8fd'fcfc'a64f}},
8597                         kVectorCalculationsSourceLegacy);
8598 }
8599 
ExecVnmsacvv()8600 [[gnu::naked]] void ExecVnmsacvv() {
8601   asm("vnmsac.vv  v8, v16, v24\n\t"
8602       "ret\n\t");
8603 }
8604 
ExecMaskedVnmsacvv()8605 [[gnu::naked]] void ExecMaskedVnmsacvv() {
8606   asm("vnmsac.vv  v8, v16, v24, v0.t\n\t"
8607       "ret\n\t");
8608 }
8609 
ExecVnmsacvx()8610 [[gnu::naked]] void ExecVnmsacvx() {
8611   asm("vnmsac.vx  v8, t0, v16\n\t"
8612       "ret\n\t");
8613 }
8614 
ExecMaskedVnmsacvx()8615 [[gnu::naked]] void ExecMaskedVnmsacvx() {
8616   asm("vnmsac.vx  v8, t0, v16, v0.t\n\t"
8617       "ret\n\t");
8618 }
8619 
TEST(InlineAsmTestRiscv64,TestVnmsac)8620 TEST(InlineAsmTestRiscv64, TestVnmsac) {
8621   TestVectorInstruction(ExecVnmsacvv,
8622                         ExecMaskedVnmsacvv,
8623                         {{85, 195, 77, 147, 49, 83, 13, 3, 205, 195, 141, 147, 53, 83, 205, 3},
8624                          {85, 131, 205, 211, 33, 19, 141, 67, 189, 131, 13, 211, 53, 19, 77, 67},
8625                          {85, 67, 77, 19, 17, 211, 13, 131, 173, 67, 141, 19, 53, 211, 205, 131},
8626                          {85, 3, 205, 83, 1, 147, 141, 195, 157, 3, 13, 83, 53, 147, 77, 195},
8627                          {85, 195, 77, 147, 241, 83, 13, 3, 141, 195, 141, 147, 53, 83, 205, 3},
8628                          {85, 131, 205, 211, 225, 19, 141, 67, 125, 131, 13, 211, 53, 19, 77, 67},
8629                          {85, 67, 77, 19, 209, 211, 13, 131, 109, 67, 141, 19, 53, 211, 205, 131},
8630                          {85, 3, 205, 83, 193, 147, 141, 195, 93, 3, 13, 83, 53, 147, 77, 195}},
8631                         {{0x5555, 0x1d4d, 0x4031, 0x4d0d, 0x2bcd, 0x3c8d, 0xa435, 0xebcd},
8632                          {0x1355, 0xdacd, 0xed21, 0x098d, 0xd7bd, 0xf80d, 0x5f35, 0xa64d},
8633                          {0xcd55, 0x944d, 0x9611, 0xc20d, 0x7fad, 0xaf8d, 0x1635, 0x5ccd},
8634                          {0x8355, 0x49cd, 0x3b01, 0x768d, 0x239d, 0x630d, 0xc935, 0x0f4d},
8635                          {0x3555, 0xfb4d, 0xdbf1, 0x270d, 0xc38d, 0x128d, 0x7835, 0xbdcd},
8636                          {0xe355, 0xa8cd, 0x78e1, 0xd38d, 0x5f7d, 0xbe0d, 0x2335, 0x684d},
8637                          {0x8d55, 0x524d, 0x11d1, 0x7c0d, 0xf76d, 0x658d, 0xca35, 0x0ecd},
8638                          {0x3355, 0xf7cd, 0xa6c1, 0x208d, 0x8b5d, 0x090d, 0x6d35, 0xb14d}},
8639                         {{0xe3c3'5555, 0xf5e6'4031, 0xdb6c'2bcd, 0xfe9f'a435},
8640                          {0x43e6'1355, 0x42f6'ed21, 0x277c'd7bd, 0x57be'5f35},
8641                          {0x9800'cd55, 0x83ff'9611, 0x6785'7fad, 0xa4d5'1635},
8642                          {0xe013'8355, 0xb900'3b01, 0x9b86'239d, 0xe5e3'c935},
8643                          {0xdd5e'3555, 0xa73c'dbf1, 0x8cc6'c38d, 0xe836'7835},
8644                          {0x1d70'e355, 0xd43d'78e1, 0xb8c7'5f7d, 0x2145'2335},
8645                          {0x517b'8d55, 0xf536'11d1, 0xd8bf'f76d, 0x4e4b'ca35},
8646                          {0x797e'3355, 0x0a26'a6c1, 0xecb0'8b5d, 0x6f4a'6d35}},
8647                         {{0xbbf2'b5fd'e3c3'5555, 0xb840'0f97'db6c'2bcd},
8648                          {0x4d47'a732'43e6'1355, 0x418e'fac8'277c'd7bd},
8649                          {0xc284'8456'9800'cd55, 0xaec5'd1e8'6785'7fad},
8650                          {0x1ba9'4d6a'e013'8355, 0xffe4'94f8'9b86'239d},
8651                          {0xa27d'86f1'dd5e'3555, 0x96ca'd88b'8cc6'c38d},
8652                          {0xf3a2'4806'1d70'e355, 0xdfe9'939b'b8c7'5f7d},
8653                          {0x28ae'f50a'517b'8d55, 0x0cf0'3a9b'd8bf'f76d},
8654                          {0x41a3'8dfe'797e'3355, 0x1dde'cd8b'ecb0'8b5d}},
8655                         kVectorCalculationsSource);
8656   TestVectorInstruction(
8657       ExecVnmsacvx,
8658       ExecMaskedVnmsacvx,
8659       {{85, 171, 1, 87, 173, 3, 89, 175, 5, 91, 177, 7, 93, 179, 9, 95},
8660        {181, 11, 97, 183, 13, 99, 185, 15, 101, 187, 17, 103, 189, 19, 105, 191},
8661        {21, 107, 193, 23, 109, 195, 25, 111, 197, 27, 113, 199, 29, 115, 201, 31},
8662        {117, 203, 33, 119, 205, 35, 121, 207, 37, 123, 209, 39, 125, 211, 41, 127},
8663        {213, 43, 129, 215, 45, 131, 217, 47, 133, 219, 49, 135, 221, 51, 137, 223},
8664        {53, 139, 225, 55, 141, 227, 57, 143, 229, 59, 145, 231, 61, 147, 233, 63},
8665        {149, 235, 65, 151, 237, 67, 153, 239, 69, 155, 241, 71, 157, 243, 73, 159},
8666        {245, 75, 161, 247, 77, 163, 249, 79, 165, 251, 81, 167, 253, 83, 169, 255}},
8667       {{0xab55, 0x0201, 0x58ad, 0xaf59, 0x0605, 0x5cb1, 0xb35d, 0x0a09},
8668        {0x60b5, 0xb761, 0x0e0d, 0x64b9, 0xbb65, 0x1211, 0x68bd, 0xbf69},
8669        {0x1615, 0x6cc1, 0xc36d, 0x1a19, 0x70c5, 0xc771, 0x1e1d, 0x74c9},
8670        {0xcb75, 0x2221, 0x78cd, 0xcf79, 0x2625, 0x7cd1, 0xd37d, 0x2a29},
8671        {0x80d5, 0xd781, 0x2e2d, 0x84d9, 0xdb85, 0x3231, 0x88dd, 0xdf89},
8672        {0x3635, 0x8ce1, 0xe38d, 0x3a39, 0x90e5, 0xe791, 0x3e3d, 0x94e9},
8673        {0xeb95, 0x4241, 0x98ed, 0xef99, 0x4645, 0x9cf1, 0xf39d, 0x4a49},
8674        {0xa0f5, 0xf7a1, 0x4e4d, 0xa4f9, 0xfba5, 0x5251, 0xa8fd, 0xffa9}},
8675       {{0x0201'ab55, 0x5a04'58ad, 0xb207'0605, 0x0a09'b35d},
8676        {0x620c'60b5, 0xba0f'0e0d, 0x1211'bb65, 0x6a14'68bd},
8677        {0xc217'1615, 0x1a19'c36d, 0x721c'70c5, 0xca1f'1e1d},
8678        {0x2221'cb75, 0x7a24'78cd, 0xd227'2625, 0x2a29'd37d},
8679        {0x822c'80d5, 0xda2f'2e2d, 0x3231'db85, 0x8a34'88dd},
8680        {0xe237'3635, 0x3a39'e38d, 0x923c'90e5, 0xea3f'3e3d},
8681        {0x4241'eb95, 0x9a44'98ed, 0xf247'4645, 0x4a49'f39d},
8682        {0xa24c'a0f5, 0xfa4f'4e4d, 0x5251'fba5, 0xaa54'a8fd}},
8683       {{0xaf59'ae03'0201'ab55, 0x0a09'b35d'b207'0605},
8684        {0x64b9'b8b8'620c'60b5, 0xbf69'be13'1211'bb65},
8685        {0x1a19'c36d'c217'1615, 0x74c9'c8c8'721c'70c5},
8686        {0xcf79'ce23'2221'cb75, 0x2a29'd37d'd227'2625},
8687        {0x84d9'd8d8'822c'80d5, 0xdf89'de33'3231'db85},
8688        {0x3a39'e38d'e237'3635, 0x94e9'e8e8'923c'90e5},
8689        {0xef99'ee43'4241'eb95, 0x4a49'f39d'f247'4645},
8690        {0xa4f9'f8f8'a24c'a0f5, 0xffa9'fe53'5251'fba5}},
8691       kVectorCalculationsSource);
8692 }
8693 
ExecVnmsubvv()8694 [[gnu::naked]] void ExecVnmsubvv() {
8695   asm("vnmsub.vv  v8, v16, v24\n\t"
8696       "ret\n\t");
8697 }
8698 
ExecMaskedVnmsubvv()8699 [[gnu::naked]] void ExecMaskedVnmsubvv() {
8700   asm("vnmsub.vv  v8, v16, v24, v0.t\n\t"
8701       "ret\n\t");
8702 }
8703 
ExecVnmsubvx()8704 [[gnu::naked]] void ExecVnmsubvx() {
8705   asm("vnmsub.vx  v8, t0, v16\n\t"
8706       "ret\n\t");
8707 }
8708 
ExecMaskedVnmsubvx()8709 [[gnu::naked]] void ExecMaskedVnmsubvx() {
8710   asm("vnmsub.vx  v8, t0, v16, v0.t\n\t"
8711       "ret\n\t");
8712 }
8713 
TEST(InlineAsmTestRiscv64,TestVnmsub)8714 TEST(InlineAsmTestRiscv64, TestVnmsub) {
8715   TestVectorInstruction(
8716       ExecVnmsubvv,
8717       ExecMaskedVnmsubvv,
8718       {{0, 189, 90, 23, 181, 113, 14, 203, 105, 5, 194, 95, 28, 185, 118, 19},
8719        {208, 141, 42, 231, 133, 65, 222, 155, 57, 213, 146, 47, 236, 137, 70, 227},
8720        {160, 93, 250, 183, 85, 17, 174, 107, 9, 165, 98, 255, 188, 89, 22, 179},
8721        {112, 45, 202, 135, 37, 225, 126, 59, 217, 117, 50, 207, 140, 41, 230, 131},
8722        {64, 253, 154, 87, 245, 177, 78, 11, 169, 69, 2, 159, 92, 249, 182, 83},
8723        {16, 205, 106, 39, 197, 129, 30, 219, 121, 21, 210, 111, 44, 201, 134, 35},
8724        {224, 157, 58, 247, 149, 81, 238, 171, 73, 229, 162, 63, 252, 153, 86, 243},
8725        {176, 109, 10, 199, 101, 33, 190, 123, 25, 181, 114, 15, 204, 105, 38, 195}},
8726       {{0xbd00, 0x6c5a, 0x1bb5, 0xcb0e, 0x5a69, 0x09c2, 0xb91c, 0x6876},
8727        {0x37d0, 0xe72a, 0x9685, 0x45de, 0xd539, 0x8492, 0x33ec, 0xe346},
8728        {0xb2a0, 0x61fa, 0x1155, 0xc0ae, 0x5009, 0xff62, 0xaebc, 0x5e16},
8729        {0x2d70, 0xdcca, 0x8c25, 0x3b7e, 0xcad9, 0x7a32, 0x298c, 0xd8e6},
8730        {0xa840, 0x579a, 0x06f5, 0xb64e, 0x45a9, 0xf502, 0xa45c, 0x53b6},
8731        {0x2310, 0xd26a, 0x81c5, 0x311e, 0xc079, 0x6fd2, 0x1f2c, 0xce86},
8732        {0x9de0, 0x4d3a, 0xfc95, 0xabee, 0x3b49, 0xeaa2, 0x99fc, 0x4956},
8733        {0x18b0, 0xc80a, 0x7765, 0x26be, 0xb619, 0x6572, 0x14cc, 0xc426}},
8734       {{0x6c5a'bd00, 0x2064'1bb5, 0xb46d'5a69, 0x6876'b91c},
8735        {0x3c80'37d0, 0xf089'9685, 0x8492'd539, 0x389c'33ec},
8736        {0x0ca5'b2a0, 0xc0af'1155, 0x54b8'5009, 0x08c1'aebc},
8737        {0xdccb'2d70, 0x90d4'8c25, 0x24dd'cad9, 0xd8e7'298c},
8738        {0xacef'a840, 0x60f9'06f5, 0xf502'45a9, 0xa90b'a45c},
8739        {0x7d15'2310, 0x311e'81c5, 0xc527'c079, 0x7931'1f2c},
8740        {0x4d3a'9de0, 0x0143'fc95, 0x954d'3b49, 0x4956'99fc},
8741        {0x1d60'18b0, 0xd169'7765, 0x6572'b619, 0x197c'14cc}},
8742       {{0xcb0e'c660'6c5a'bd00, 0x6876'b91c'b46d'5a69},
8743        {0x45de'ebdb'3c80'37d0, 0xe346'de97'8492'd539},
8744        {0xc0af'1156'0ca5'b2a0, 0x5e17'0412'54b8'5009},
8745        {0x3b7f'36d0'dccb'2d70, 0xd8e7'298d'24dd'cad9},
8746        {0xb64e'5c4a'acef'a840, 0x53b6'4f06'f502'45a9},
8747        {0x311e'81c5'7d15'2310, 0xce86'7481'c527'c079},
8748        {0xabee'a740'4d3a'9de0, 0x4956'99fc'954d'3b49},
8749        {0x26be'ccbb'1d60'18b0, 0xc426'bf77'6572'b619}},
8750       kVectorCalculationsSource);
8751   TestVectorInstruction(
8752       ExecVnmsubvx,
8753       ExecMaskedVnmsubvx,
8754       {{142, 15, 144, 17, 146, 19, 148, 21, 150, 23, 152, 25, 154, 27, 156, 29},
8755        {158, 31, 160, 33, 162, 35, 164, 37, 166, 39, 168, 41, 170, 43, 172, 45},
8756        {174, 47, 176, 49, 178, 51, 180, 53, 182, 55, 184, 57, 186, 59, 188, 61},
8757        {190, 63, 192, 65, 194, 67, 196, 69, 198, 71, 200, 73, 202, 75, 204, 77},
8758        {206, 79, 208, 81, 210, 83, 212, 85, 214, 87, 216, 89, 218, 91, 220, 93},
8759        {222, 95, 224, 97, 226, 99, 228, 101, 230, 103, 232, 105, 234, 107, 236, 109},
8760        {238, 111, 240, 113, 242, 115, 244, 117, 246, 119, 248, 121, 250, 123, 252, 125},
8761        {254, 127, 0, 129, 2, 131, 4, 133, 6, 135, 8, 137, 10, 139, 12, 141}},
8762       {{0x648e, 0x6690, 0x6892, 0x6a94, 0x6c96, 0x6e98, 0x709a, 0x729c},
8763        {0x749e, 0x76a0, 0x78a2, 0x7aa4, 0x7ca6, 0x7ea8, 0x80aa, 0x82ac},
8764        {0x84ae, 0x86b0, 0x88b2, 0x8ab4, 0x8cb6, 0x8eb8, 0x90ba, 0x92bc},
8765        {0x94be, 0x96c0, 0x98c2, 0x9ac4, 0x9cc6, 0x9ec8, 0xa0ca, 0xa2cc},
8766        {0xa4ce, 0xa6d0, 0xa8d2, 0xaad4, 0xacd6, 0xaed8, 0xb0da, 0xb2dc},
8767        {0xb4de, 0xb6e0, 0xb8e2, 0xbae4, 0xbce6, 0xbee8, 0xc0ea, 0xc2ec},
8768        {0xc4ee, 0xc6f0, 0xc8f2, 0xcaf4, 0xccf6, 0xcef8, 0xd0fa, 0xd2fc},
8769        {0xd4fe, 0xd700, 0xd902, 0xdb04, 0xdd06, 0xdf08, 0xe10a, 0xe30c}},
8770       {{0x113b'648e, 0x153f'6892, 0x1943'6c96, 0x1d47'709a},
8771        {0x214b'749e, 0x254f'78a2, 0x2953'7ca6, 0x2d57'80aa},
8772        {0x315b'84ae, 0x355f'88b2, 0x3963'8cb6, 0x3d67'90ba},
8773        {0x416b'94be, 0x456f'98c2, 0x4973'9cc6, 0x4d77'a0ca},
8774        {0x517b'a4ce, 0x557f'a8d2, 0x5983'acd6, 0x5d87'b0da},
8775        {0x618b'b4de, 0x658f'b8e2, 0x6993'bce6, 0x6d97'c0ea},
8776        {0x719b'c4ee, 0x759f'c8f2, 0x79a3'ccf6, 0x7da7'd0fa},
8777        {0x81ab'd4fe, 0x85af'd902, 0x89b3'dd06, 0x8db7'e10a}},
8778       {{0x6a94'bde8'113b'648e, 0x729c'c5f0'1943'6c96},
8779        {0x7aa4'cdf8'214b'749e, 0x82ac'd600'2953'7ca6},
8780        {0x8ab4'de08'315b'84ae, 0x92bc'e610'3963'8cb6},
8781        {0x9ac4'ee18'416b'94be, 0xa2cc'f620'4973'9cc6},
8782        {0xaad4'fe28'517b'a4ce, 0xb2dd'0630'5983'acd6},
8783        {0xbae5'0e38'618b'b4de, 0xc2ed'1640'6993'bce6},
8784        {0xcaf5'1e48'719b'c4ee, 0xd2fd'2650'79a3'ccf6},
8785        {0xdb05'2e58'81ab'd4fe, 0xe30d'3660'89b3'dd06}},
8786       kVectorCalculationsSource);
8787 }
8788 
ExecVnsrawi()8789 [[gnu::naked]] void ExecVnsrawi() {
8790   asm("vnsra.wi  v8, v16, 3\n\t"
8791       "ret\n\t");
8792 }
8793 
ExecMaskedVnsrawi()8794 [[gnu::naked]] void ExecMaskedVnsrawi() {
8795   asm("vnsra.wi  v8, v16, 3, v0.t\n\t"
8796       "ret\n\t");
8797 }
8798 
ExecVnsrawx()8799 [[gnu::naked]] void ExecVnsrawx() {
8800   asm("vnsra.wx  v8, v16, t0\n\t"
8801       "ret\n\t");
8802 }
8803 
ExecMaskedVnsrawx()8804 [[gnu::naked]] void ExecMaskedVnsrawx() {
8805   asm("vnsra.wx  v8, v16, t0, v0.t\n\t"
8806       "ret\n\t");
8807 }
8808 
ExecVnsrawv()8809 [[gnu::naked]] void ExecVnsrawv() {
8810   asm("vnsra.wv  v8, v16, v24\n\t"
8811       "ret\n\t");
8812 }
8813 
ExecMaskedVnsrawv()8814 [[gnu::naked]] void ExecMaskedVnsrawv() {
8815   asm("vnsra.wv  v8, v16, v24, v0.t\n\t"
8816       "ret\n\t");
8817 }
8818 
TEST(InlineAsmTestRiscv64,TestVnsra)8819 TEST(InlineAsmTestRiscv64, TestVnsra) {
8820   TestNarrowingVectorInstruction(
8821       ExecVnsrawi,
8822       ExecMaskedVnsrawi,
8823       {{32, 96, 160, 224, 33, 97, 161, 225, 34, 98, 162, 226, 35, 99, 163, 227},
8824        {36, 100, 164, 228, 37, 101, 165, 229, 38, 102, 166, 230, 39, 103, 167, 231},
8825        {40, 104, 168, 232, 41, 105, 169, 233, 42, 106, 170, 234, 43, 107, 171, 235},
8826        {44, 108, 172, 236, 45, 109, 173, 237, 46, 110, 174, 238, 47, 111, 175, 239}},
8827       {{0x5020, 0xd0a0, 0x5121, 0xd1a1, 0x5222, 0xd2a2, 0x5323, 0xd3a3},
8828        {0x5424, 0xd4a4, 0x5525, 0xd5a5, 0x5626, 0xd6a6, 0x5727, 0xd7a7},
8829        {0x5828, 0xd8a8, 0x5929, 0xd9a9, 0x5a2a, 0xdaaa, 0x5b2b, 0xdbab},
8830        {0x5c2c, 0xdcac, 0x5d2d, 0xddad, 0x5e2e, 0xdeae, 0x5f2f, 0xdfaf}},
8831       {{0x9060'5020, 0x9161'5121, 0x9262'5222, 0x9363'5323},
8832        {0x9464'5424, 0x9565'5525, 0x9666'5626, 0x9767'5727},
8833        {0x9868'5828, 0x9969'5929, 0x9a6a'5a2a, 0x9b6b'5b2b},
8834        {0x9c6c'5c2c, 0x9d6d'5d2d, 0x9e6e'5e2e, 0x9f6f'5f2f}},
8835       kVectorCalculationsSourceLegacy);
8836   TestNarrowingVectorInstruction(
8837       ExecVnsrawx,
8838       ExecMaskedVnsrawx,
8839       {{224, 224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231},
8840        {232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239},
8841        {240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247},
8842        {248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255}},
8843       {{0xc0a0, 0xc1a1, 0xc2a2, 0xc3a3, 0xc4a4, 0xc5a5, 0xc6a6, 0xc7a7},
8844        {0xc8a8, 0xc9a9, 0xcaaa, 0xcbab, 0xccac, 0xcdad, 0xceae, 0xcfaf},
8845        {0xd0b0, 0xd1b1, 0xd2b2, 0xd3b3, 0xd4b4, 0xd5b5, 0xd6b6, 0xd7b7},
8846        {0xd8b8, 0xd9b9, 0xdaba, 0xdbbb, 0xdcbc, 0xddbd, 0xdebe, 0xdfbf}},
8847       {{0xffe1'c1a1, 0xffe3'c3a3, 0xffe5'c5a5, 0xffe7'c7a7},
8848        {0xffe9'c9a9, 0xffeb'cbab, 0xffed'cdad, 0xffef'cfaf},
8849        {0xfff1'd1b1, 0xfff3'd3b3, 0xfff5'd5b5, 0xfff7'd7b7},
8850        {0xfff9'd9b9, 0xfffb'dbbb, 0xfffd'ddbd, 0xffff'dfbf}},
8851       kVectorCalculationsSourceLegacy);
8852   TestNarrowingVectorInstruction(
8853       ExecVnsrawv,
8854       ExecMaskedVnsrawv,
8855       {{0, 192, 80, 28, 196, 226, 248, 254, 136, 196, 81, 92, 153, 230, 249, 254},
8856        {32, 200, 82, 156, 212, 234, 250, 254, 152, 204, 83, 220, 185, 238, 251, 254},
8857        {64, 208, 84, 29, 228, 242, 252, 255, 168, 212, 85, 93, 217, 246, 253, 255},
8858        {96, 216, 86, 157, 244, 250, 254, 255, 184, 220, 87, 221, 249, 254, 255, 255}},
8859       {{0x8100, 0x6850, 0x8544, 0xf0e8, 0xc989, 0xf971, 0xff9b, 0xfff9},
8860        {0xa120, 0x6a52, 0x9554, 0xf2ea, 0xd999, 0xfb73, 0xffbb, 0xfffb},
8861        {0xc140, 0x6c54, 0xa564, 0xf4ec, 0xe9a9, 0xfd75, 0xffdb, 0xfffd},
8862        {0xe160, 0x6e56, 0xb574, 0xf6ee, 0xf9b9, 0xff77, 0xfffb, 0xffff}},
8863       {{0x8302'8100, 0x8645'8544, 0x4a8a'4989, 0x1e9d'1c9b},
8864        {0xa726'a524, 0xffd7'9756, 0xffff'db9b, 0xffff'ffbf},
8865        {0xc342'c140, 0xa665'a564, 0x6aaa'69a9, 0x5edd'5cdb},
8866        {0xe766'e564, 0xfff7'b776, 0xffff'fbbb, 0xffff'ffff}},
8867       kVectorCalculationsSourceLegacy);
8868 }
8869 
ExecVnsrlwi()8870 [[gnu::naked]] void ExecVnsrlwi() {
8871   asm("vnsrl.wi  v8, v16, 3\n\t"
8872       "ret\n\t");
8873 }
8874 
ExecMaskedVnsrlwi()8875 [[gnu::naked]] void ExecMaskedVnsrlwi() {
8876   asm("vnsrl.wi  v8, v16, 3, v0.t\n\t"
8877       "ret\n\t");
8878 }
8879 
ExecVnsrlwx()8880 [[gnu::naked]] void ExecVnsrlwx() {
8881   asm("vnsrl.wx  v8, v16, t0\n\t"
8882       "ret\n\t");
8883 }
8884 
ExecMaskedVnsrlwx()8885 [[gnu::naked]] void ExecMaskedVnsrlwx() {
8886   asm("vnsrl.wx  v8, v16, t0, v0.t\n\t"
8887       "ret\n\t");
8888 }
8889 
ExecVnsrlwv()8890 [[gnu::naked]] void ExecVnsrlwv() {
8891   asm("vnsrl.wv  v8, v16, v24\n\t"
8892       "ret\n\t");
8893 }
8894 
ExecMaskedVnsrlwv()8895 [[gnu::naked]] void ExecMaskedVnsrlwv() {
8896   asm("vnsrl.wv  v8, v16, v24, v0.t\n\t"
8897       "ret\n\t");
8898 }
8899 
TEST(InlineAsmTestRiscv64,TestVnsrl)8900 TEST(InlineAsmTestRiscv64, TestVnsrl) {
8901   TestNarrowingVectorInstruction(
8902       ExecVnsrlwi,
8903       ExecMaskedVnsrlwi,
8904       {{32, 96, 160, 224, 33, 97, 161, 225, 34, 98, 162, 226, 35, 99, 163, 227},
8905        {36, 100, 164, 228, 37, 101, 165, 229, 38, 102, 166, 230, 39, 103, 167, 231},
8906        {40, 104, 168, 232, 41, 105, 169, 233, 42, 106, 170, 234, 43, 107, 171, 235},
8907        {44, 108, 172, 236, 45, 109, 173, 237, 46, 110, 174, 238, 47, 111, 175, 239}},
8908       {{0x5020, 0xd0a0, 0x5121, 0xd1a1, 0x5222, 0xd2a2, 0x5323, 0xd3a3},
8909        {0x5424, 0xd4a4, 0x5525, 0xd5a5, 0x5626, 0xd6a6, 0x5727, 0xd7a7},
8910        {0x5828, 0xd8a8, 0x5929, 0xd9a9, 0x5a2a, 0xdaaa, 0x5b2b, 0xdbab},
8911        {0x5c2c, 0xdcac, 0x5d2d, 0xddad, 0x5e2e, 0xdeae, 0x5f2f, 0xdfaf}},
8912       {{0x9060'5020, 0x9161'5121, 0x9262'5222, 0x9363'5323},
8913        {0x9464'5424, 0x9565'5525, 0x9666'5626, 0x9767'5727},
8914        {0x9868'5828, 0x9969'5929, 0x9a6a'5a2a, 0x9b6b'5b2b},
8915        {0x9c6c'5c2c, 0x9d6d'5d2d, 0x9e6e'5e2e, 0x9f6f'5f2f}},
8916       kVectorCalculationsSourceLegacy);
8917   TestNarrowingVectorInstruction(ExecVnsrlwx,
8918                                  ExecMaskedVnsrlwx,
8919                                  {{32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39},
8920                                   {40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47},
8921                                   {48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55},
8922                                   {56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63}},
8923                                  {{0xc0a0, 0xc1a1, 0xc2a2, 0xc3a3, 0xc4a4, 0xc5a5, 0xc6a6, 0xc7a7},
8924                                   {0xc8a8, 0xc9a9, 0xcaaa, 0xcbab, 0xccac, 0xcdad, 0xceae, 0xcfaf},
8925                                   {0xd0b0, 0xd1b1, 0xd2b2, 0xd3b3, 0xd4b4, 0xd5b5, 0xd6b6, 0xd7b7},
8926                                   {0xd8b8, 0xd9b9, 0xdaba, 0xdbbb, 0xdcbc, 0xddbd, 0xdebe, 0xdfbf}},
8927                                  {{0x0021'c1a1, 0x0023'c3a3, 0x0025'c5a5, 0x0027'c7a7},
8928                                   {0x0029'c9a9, 0x002b'cbab, 0x002d'cdad, 0x002f'cfaf},
8929                                   {0x0031'd1b1, 0x0033'd3b3, 0x0035'd5b5, 0x0037'd7b7},
8930                                   {0x0039'd9b9, 0x003b'dbbb, 0x003d'ddbd, 0x003f'dfbf}},
8931                                  kVectorCalculationsSourceLegacy);
8932   TestNarrowingVectorInstruction(
8933       ExecVnsrlwv,
8934       ExecMaskedVnsrlwv,
8935       {{0, 192, 80, 28, 68, 34, 8, 2, 136, 196, 81, 92, 153, 38, 9, 2},
8936        {32, 200, 82, 156, 84, 42, 10, 2, 152, 204, 83, 220, 185, 46, 11, 2},
8937        {64, 208, 84, 29, 100, 50, 12, 3, 168, 212, 85, 93, 217, 54, 13, 3},
8938        {96, 216, 86, 157, 116, 58, 14, 3, 184, 220, 87, 221, 249, 62, 15, 3}},
8939       {{0x8100, 0x6850, 0x8544, 0xf0e8, 0x4989, 0x0971, 0x009b, 0x0009},
8940        {0xa120, 0x6a52, 0x9554, 0xf2ea, 0x5999, 0x0b73, 0x00bb, 0x000b},
8941        {0xc140, 0x6c54, 0xa564, 0xf4ec, 0x69a9, 0x0d75, 0x00db, 0x000d},
8942        {0xe160, 0x6e56, 0xb574, 0xf6ee, 0x79b9, 0x0f77, 0x00fb, 0x000f}},
8943       {{0x8302'8100, 0x8645'8544, 0x4a8a'4989, 0x1e9d'1c9b},
8944        {0xa726'a524, 0x0057'9756, 0x0000'5b9b, 0x0000'00bf},
8945        {0xc342'c140, 0xa665'a564, 0x6aaa'69a9, 0x5edd'5cdb},
8946        {0xe766'e564, 0x0077'b776, 0x0000'7bbb, 0x0000'00ff}},
8947       kVectorCalculationsSourceLegacy);
8948 }
8949 
ExecVremuvv()8950 [[gnu::naked]] void ExecVremuvv() {
8951   asm("vremu.vv  v8, v16, v24\n\t"
8952       "ret\n\t");
8953 }
8954 
ExecMaskedVremuvv()8955 [[gnu::naked]] void ExecMaskedVremuvv() {
8956   asm("vremu.vv  v8, v16, v24, v0.t\n\t"
8957       "ret\n\t");
8958 }
8959 
ExecVremuvx()8960 [[gnu::naked]] void ExecVremuvx() {
8961   asm("vremu.vx  v8, v16, t0\n\t"
8962       "ret\n\t");
8963 }
8964 
ExecMaskedVremuvx()8965 [[gnu::naked]] void ExecMaskedVremuvx() {
8966   asm("vremu.vx  v8, v16, t0, v0.t\n\t"
8967       "ret\n\t");
8968 }
8969 
ExecVremvv()8970 [[gnu::naked]] void ExecVremvv() {
8971   asm("vrem.vv  v8, v16, v24\n\t"
8972       "ret\n\t");
8973 }
8974 
ExecMaskedVremvv()8975 [[gnu::naked]] void ExecMaskedVremvv() {
8976   asm("vrem.vv  v8, v16, v24, v0.t\n\t"
8977       "ret\n\t");
8978 }
8979 
ExecVremvx()8980 [[gnu::naked]] void ExecVremvx() {
8981   asm("vrem.vx  v8, v16, t0\n\t"
8982       "ret\n\t");
8983 }
8984 
ExecMaskedVremvx()8985 [[gnu::naked]] void ExecMaskedVremvx() {
8986   asm("vrem.vx  v8, v16, t0, v0.t\n\t"
8987       "ret\n\t");
8988 }
8989 
TEST(InlineAsmTestRiscv64,TestVrem)8990 TEST(InlineAsmTestRiscv64, TestVrem) {
8991   TestVectorInstruction(
8992       ExecVremuvv,
8993       ExecMaskedVremuvv,
8994       {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
8995        {10, 13, 10, 13, 0, 0, 0, 0, 0, 0, 10, 13, 0, 0, 0, 0},
8996        {22, 64, 22, 64, 22, 64, 22, 64, 0, 0, 0, 0, 0, 128, 22, 64},
8997        {74, 72, 70, 68, 65, 64, 62, 60, 17, 17, 17, 17, 17, 17, 17, 17},
8998        {116, 125, 112, 121, 107, 117, 104, 113, 101, 109, 98, 105, 94, 101, 90, 97},
8999        {84, 93, 80, 89, 79, 85, 76, 81, 68, 77, 65, 73, 61, 69, 57, 65},
9000        {187, 187, 187, 169, 187, 187, 187, 169, 187, 187, 187, 169, 187, 187, 187, 169},
9001        {169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169}},
9002       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
9003        {0x0d81, 0x0d81, 0x0000, 0x0000, 0x0000, 0x0d81, 0x0000, 0x0000},
9004        {0x4016, 0x4016, 0x4016, 0x4016, 0x0000, 0x0000, 0x8000, 0x4016},
9005        {0x484a, 0x4446, 0x4041, 0x3c3e, 0x1111, 0x1111, 0x1111, 0x1111},
9006        {0x7d74, 0x7970, 0x756b, 0x7168, 0x6d65, 0x6962, 0x655e, 0x615a},
9007        {0x5d54, 0x5950, 0x554f, 0x514c, 0x4d44, 0x4941, 0x453d, 0x4139},
9008        {0xbbbb, 0xa9bb, 0xbbbb, 0xa9bb, 0xbbbb, 0xa9bb, 0xbbbb, 0xa9bb},
9009        {0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9}},
9010       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
9011        {0x0d81'0d81, 0x0000'0000, 0x0d80'cccd, 0x0000'0000},
9012        {0x4016'4016, 0x4016'4016, 0x0000'0000, 0x4016'8000},
9013        {0x4446'484a, 0x3c3e'4041, 0x1111'1111, 0x1111'1111},
9014        {0x7970'7d74, 0x7168'756b, 0x6962'6d65, 0x615a'655e},
9015        {0x5950'5d54, 0x514c'554f, 0x4941'4d44, 0x4139'453d},
9016        {0xa9bb'bbbb, 0xa9bb'bbbb, 0xa9bb'bbbb, 0xa9bb'bbbb},
9017        {0xa9a9'a9a9, 0xa9a9'a9a9, 0xa9a9'a9a9, 0xa9a9'a9a9}},
9018       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
9019        {0x1111'1110'51c5'51c6, 0x1111'1110'51c5'1112},
9020        {0x4016'4016'4016'4016, 0x4016'8000'0000'0000},
9021        {0x3c3e'4041'4446'484a, 0x1111'1111'1111'1111},
9022        {0x7168'756b'7970'7d74, 0x615a'655e'6962'6d65},
9023        {0x514c'554f'5950'5d54, 0x4139'453d'4941'4d44},
9024        {0xa9bb'bbbb'a9bb'bbbb, 0xa9bb'bbbb'a9bb'bbbb},
9025        {0xa9a9'a9a9'a9a9'a9a9, 0xa9a9'a9a9'a9a9'a9a9}},
9026       kVectorComparisonSource);
9027 
9028   TestVectorInstruction(
9029       ExecVremuvx,
9030       ExecMaskedVremuvx,
9031       {{5, 70, 5, 70, 5, 70, 5, 70, 64, 64, 64, 64, 85, 85, 85, 85},
9032        {10, 64, 10, 64, 85, 85, 85, 85, 0, 0, 10, 64, 85, 85, 85, 85},
9033        {22, 64, 22, 64, 22, 64, 22, 64, 0, 0, 0, 0, 0, 128, 22, 64},
9034        {0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17},
9035        {74, 85, 74, 85, 74, 85, 74, 85, 76, 85, 76, 85, 76, 85, 76, 85},
9036        {74, 85, 74, 85, 78, 85, 78, 85, 75, 85, 75, 85, 75, 85, 75, 85},
9037        {17, 17, 17, 169, 17, 17, 17, 169, 17, 17, 17, 169, 17, 17, 17, 169},
9038        {169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169}},
9039       {{0x455b, 0x455b, 0x455b, 0x455b, 0x4040, 0x4040, 0x5555, 0x5555},
9040        {0x40b4, 0x40b4, 0x5555, 0x5555, 0x0000, 0x40b4, 0x5555, 0x5555},
9041        {0x4016, 0x4016, 0x4016, 0x4016, 0x0000, 0x0000, 0x8000, 0x4016},
9042        {0x0000, 0x0000, 0x0000, 0x0000, 0x1111, 0x1111, 0x1111, 0x1111},
9043        {0x554a, 0x554a, 0x554a, 0x554a, 0x554c, 0x554c, 0x554c, 0x554c},
9044        {0x554a, 0x554a, 0x554e, 0x554e, 0x554b, 0x554b, 0x554b, 0x554b},
9045        {0x1111, 0xa9bb, 0x1111, 0xa9bb, 0x1111, 0xa9bb, 0x1111, 0xa9bb},
9046        {0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9, 0xa9a9}},
9047       {{0x455b'455b, 0x455b'455b, 0x4040'4040, 0x5555'5555},
9048        {0x40b4'40b4, 0x5555'5555, 0x40b4'0000, 0x5555'5555},
9049        {0x4016'4016, 0x4016'4016, 0x0000'0000, 0x4016'8000},
9050        {0x0000'0000, 0x0000'0000, 0x1111'1111, 0x1111'1111},
9051        {0x554a'554a, 0x554a'554a, 0x554c'554c, 0x554c'554c},
9052        {0x554a'554a, 0x554e'554e, 0x554b'554b, 0x554b'554b},
9053        {0xa9bb'bbbb, 0xa9bb'bbbb, 0xa9bb'bbbb, 0xa9bb'bbbb},
9054        {0xa9a9'a9a9, 0xa9a9'a9a9, 0xa9a9'a9a9, 0xa9a9'a9a9}},
9055       {{0x455b'455b'455b'455b, 0x5555'5554'9595'9596},
9056        {0x5555'5554'9609'960a, 0x5555'5554'9609'5556},
9057        {0x4016'4016'4016'4016, 0x4016'8000'0000'0000},
9058        {0x0000'0000'0000'0000, 0x1111'1111'1111'1111},
9059        {0x554a'554a'554a'554a, 0x554c'554c'554c'554c},
9060        {0x554e'554e'554a'554a, 0x554b'554b'554b'554b},
9061        {0xa9bb'bbbb'a9bb'bbbb, 0xa9bb'bbbb'a9bb'bbbb},
9062        {0xa9a9'a9a9'a9a9'a9a9, 0xa9a9'a9a9'a9a9'a9a9}},
9063       kVectorComparisonSource);
9064 
9065   TestVectorInstruction(
9066       ExecVremvv,
9067       ExecMaskedVremvv,
9068       {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
9069        {248, 13, 248, 13, 255, 255, 255, 255, 0, 0, 248, 13, 255, 255, 255, 255},
9070        {7, 0, 7, 0, 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0},
9071        {170, 170, 170, 170, 170, 170, 170, 170, 17, 17, 17, 17, 17, 17, 17, 17},
9072        {244, 255, 244, 255, 244, 255, 244, 255, 246, 255, 246, 255, 246, 255, 246, 255},
9073        {244, 255, 244, 255, 248, 255, 248, 255, 245, 255, 245, 255, 245, 255, 245, 255},
9074        {251, 249, 247, 227, 242, 241, 239, 219, 234, 233, 231, 253, 227, 225, 223, 237},
9075        {233, 229, 253, 247, 238, 235, 249, 241, 244, 253, 253, 249, 249, 253, 253, 255}},
9076       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
9077        {0x0d81, 0x0d81, 0xffff, 0xffff, 0x0000, 0x0d81, 0xffff, 0xffff},
9078        {0x000b, 0x000b, 0x000b, 0x000b, 0x0000, 0x0000, 0xfff8, 0x000b},
9079        {0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0x1111, 0x1111, 0x1111, 0x1111},
9080        {0xfff4, 0xfff4, 0xfff4, 0xfff4, 0xfff6, 0xfff6, 0xfff6, 0xfff6},
9081        {0xfff4, 0xfff4, 0xfff8, 0xfff8, 0xfff5, 0xfff5, 0xfff5, 0xfff5},
9082        {0xf8fb, 0xe2f7, 0xf0f2, 0xdaef, 0xe8ea, 0xfc13, 0xe0e3, 0xec03},
9083        {0xe3e9, 0xf4fd, 0xfe05, 0xff0d, 0xf803, 0xfb15, 0xff31, 0xfffd}},
9084       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
9085        {0x0d81'0d81, 0xffff'ffff, 0x0d80'cccd, 0xffff'ffff},
9086        {0x000b'fb79, 0x000b'fb79, 0x0000'0000, 0x000c'3b63},
9087        {0xaaaa'aaaa, 0xaaaa'aaaa, 0x1111'1111, 0x1111'1111},
9088        {0xfff4'fff4, 0xfff4'fff4, 0xfff6'fff6, 0xfff6'fff6},
9089        {0xfff4'fff4, 0xfff8'fff8, 0xfff5'fff5, 0xfff5'fff5},
9090        {0xe2f6'f8fb, 0xdaee'f0f2, 0xfc12'1619, 0xec02'060b},
9091        {0xf4fb'0109, 0xff09'131c, 0xfb0d'1f30, 0xffaa'5551}},
9092       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
9093        {0xffff'ffff'40b4'40b4, 0xffff'ffff'40b4'0000},
9094        {0x000c'000c'000b'fb79, 0x000c'3ff5'bff5'bb63},
9095        {0xaaaa'aaaa'aaaa'aaaa, 0x1111'1111'1111'1111},
9096        {0xfff4'fff4'fff4'fff4, 0xfff6'fff6'fff6'fff6},
9097        {0xfff8'fff8'fff4'fff4, 0xfff5'fff5'fff5'fff5},
9098        {0xdaee'f0f1'e2f6'f8fb, 0xec02'0609'fc12'1619},
9099        {0xff09'1318'2731'3b49, 0xffaa'54ff'aa54'ffa4}},
9100       kVectorComparisonSource);
9101 
9102   TestVectorInstruction(
9103       ExecVremvx,
9104       ExecMaskedVremvx,
9105       {{5, 240, 5, 240, 5, 240, 5, 240, 64, 64, 64, 64, 255, 255, 255, 255},
9106        {180, 64, 180, 64, 255, 255, 255, 255, 0, 0, 180, 64, 255, 255, 255, 255},
9107        {22, 64, 22, 64, 22, 64, 22, 64, 0, 0, 0, 0, 0, 214, 22, 64},
9108        {0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17},
9109        {244, 255, 244, 255, 244, 255, 244, 255, 246, 255, 246, 255, 246, 255, 246, 255},
9110        {244, 255, 244, 255, 248, 255, 248, 255, 245, 255, 245, 255, 245, 255, 245, 255},
9111        {187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, 255},
9112        {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}},
9113       {{0xf005, 0xf005, 0xf005, 0xf005, 0x4040, 0x4040, 0xffff, 0xffff},
9114        {0x40b4, 0x40b4, 0xffff, 0xffff, 0x0000, 0x40b4, 0xffff, 0xffff},
9115        {0x4016, 0x4016, 0x4016, 0x4016, 0x0000, 0x0000, 0xd556, 0x4016},
9116        {0x0000, 0x0000, 0x0000, 0x0000, 0x1111, 0x1111, 0x1111, 0x1111},
9117        {0xfff4, 0xfff4, 0xfff4, 0xfff4, 0xfff6, 0xfff6, 0xfff6, 0xfff6},
9118        {0xfff4, 0xfff4, 0xfff8, 0xfff8, 0xfff5, 0xfff5, 0xfff5, 0xfff5},
9119        {0xbbbb, 0xff11, 0xbbbb, 0xff11, 0xbbbb, 0xff11, 0xbbbb, 0xff11},
9120        {0xfeff, 0xfeff, 0xfeff, 0xfeff, 0xfeff, 0xfeff, 0xfeff, 0xfeff}},
9121       {{0xf005'f005, 0xf005'f005, 0x4040'4040, 0xffff'ffff},
9122        {0x40b4'40b4, 0xffff'ffff, 0x40b4'0000, 0xffff'ffff},
9123        {0x4016'4016, 0x4016'4016, 0x0000'0000, 0x4016'8000},
9124        {0x0000'0000, 0x0000'0000, 0x1111'1111, 0x1111'1111},
9125        {0xfff4'fff4, 0xfff4'fff4, 0xfff6'fff6, 0xfff6'fff6},
9126        {0xfff4'fff4, 0xfff8'fff8, 0xfff5'fff5, 0xfff5'fff5},
9127        {0xff11'1111, 0xff11'1111, 0xff11'1111, 0xff11'1111},
9128        {0xfefe'feff, 0xfefe'feff, 0xfefe'feff, 0xfefe'feff}},
9129       {{0xf005'f005'f005'f005, 0xffff'ffff'4040'4040},
9130        {0xffff'ffff'40b4'40b4, 0xffff'ffff'40b4'0000},
9131        {0x4016'4016'4016'4016, 0x4016'8000'0000'0000},
9132        {0x0000'0000'0000'0000, 0x1111'1111'1111'1111},
9133        {0xfff4'fff4'fff4'fff4, 0xfff6'fff6'fff6'fff6},
9134        {0xfff8'fff8'fff4'fff4, 0xfff5'fff5'fff5'fff5},
9135        {0xff11'1110'ff11'1111, 0xff11'1110'ff11'1111},
9136        {0xfefe'fefe'fefe'feff, 0xfefe'fefe'fefe'feff}},
9137       kVectorComparisonSource);
9138 }
9139 
ExecVslide1upvx()9140 [[gnu::naked]] void ExecVslide1upvx() {
9141   asm("vslide1up.vx  v8, v24, t0\n\t"
9142       "ret\n\t");
9143 }
9144 
ExecMaskedVslide1upvx()9145 [[gnu::naked]] void ExecMaskedVslide1upvx() {
9146   asm("vslide1up.vx  v8, v24, t0, v0.t\n\t"
9147       "ret\n\t");
9148 }
9149 
TEST(InlineAsmTestRiscv64,TestVslide1up)9150 TEST(InlineAsmTestRiscv64, TestVslide1up) {
9151   TestVectorInstruction(
9152       ExecVslide1upvx,
9153       ExecMaskedVslide1upvx,
9154       {{0xaa, 0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28},
9155        {30, 32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60},
9156        {62, 64, 66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92},
9157        {94, 96, 98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124},
9158        {126, 128, 130, 132, 134, 137, 138, 140, 142, 145, 146, 148, 150, 152, 154, 156},
9159        {158, 160, 162, 164, 166, 169, 170, 172, 174, 177, 178, 180, 182, 184, 186, 188},
9160        {190, 192, 194, 196, 198, 201, 202, 204, 206, 209, 210, 212, 214, 216, 218, 220},
9161        {222, 224, 226, 228, 230, 233, 234, 236, 238, 241, 242, 244, 246, 248, 250, 252}},
9162       {{0xaaaa, 0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18},
9163        {0x1e1c, 0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38},
9164        {0x3e3c, 0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58},
9165        {0x5e5c, 0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78},
9166        {0x7e7c, 0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98},
9167        {0x9e9c, 0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8},
9168        {0xbebc, 0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8},
9169        {0xdedc, 0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8}},
9170       {{0xaaaa'aaaa, 0x0604'0200, 0x0e0c'0a09, 0x1614'1211},
9171        {0x1e1c'1a18, 0x2624'2220, 0x2e2c'2a29, 0x3634'3231},
9172        {0x3e3c'3a38, 0x4644'4240, 0x4e4c'4a49, 0x5654'5251},
9173        {0x5e5c'5a58, 0x6664'6260, 0x6e6c'6a69, 0x7674'7271},
9174        {0x7e7c'7a78, 0x8684'8280, 0x8e8c'8a89, 0x9694'9291},
9175        {0x9e9c'9a98, 0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1},
9176        {0xbebc'bab8, 0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1},
9177        {0xdedc'dad8, 0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1}},
9178       {{0xaaaa'aaaa'aaaa'aaaa, 0x0e0c'0a09'0604'0200},
9179        {0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
9180        {0x3e3c'3a38'3634'3231, 0x4e4c'4a49'4644'4240},
9181        {0x5e5c'5a58'5654'5251, 0x6e6c'6a69'6664'6260},
9182        {0x7e7c'7a78'7674'7271, 0x8e8c'8a89'8684'8280},
9183        {0x9e9c'9a98'9694'9291, 0xaeac'aaa9'a6a4'a2a0},
9184        {0xbebc'bab8'b6b4'b2b1, 0xcecc'cac9'c6c4'c2c0},
9185        {0xdedc'dad8'd6d4'd2d1, 0xeeec'eae9'e6e4'e2e0}},
9186       kVectorCalculationsSourceLegacy);
9187 }
ExecVsllvv()9188 [[gnu::naked]] void ExecVsllvv() {
9189   asm("vsll.vv  v8, v16, v24\n\t"
9190       "ret\n\t");
9191 }
9192 
ExecMaskedVsllvv()9193 [[gnu::naked]] void ExecMaskedVsllvv() {
9194   asm("vsll.vv  v8, v16, v24, v0.t\n\t"
9195       "ret\n\t");
9196 }
9197 
ExecVsllvx()9198 [[gnu::naked]] void ExecVsllvx() {
9199   asm("vsll.vx  v8, v16, t0\n\t"
9200       "ret\n\t");
9201 }
9202 
ExecMaskedVsllvx()9203 [[gnu::naked]] void ExecMaskedVsllvx() {
9204   asm("vsll.vx  v8, v16, t0, v0.t\n\t"
9205       "ret\n\t");
9206 }
9207 
ExecVsllvi()9208 [[gnu::naked]] void ExecVsllvi() {
9209   asm("vsll.vi  v8, v16, 0xb\n\t"
9210       "ret\n\t");
9211 }
9212 
ExecMaskedVsllvi()9213 [[gnu::naked]] void ExecMaskedVsllvi() {
9214   asm("vsll.vi  v8, v16, 0xb, v0.t\n\t"
9215       "ret\n\t");
9216 }
9217 
TEST(InlineAsmTestRiscv64,TestVsll)9218 TEST(InlineAsmTestRiscv64, TestVsll) {
9219   TestVectorInstruction(
9220       ExecVsllvv,
9221       ExecMaskedVsllvv,
9222       {{0, 4, 32, 192, 8, 20, 96, 192, 16, 36, 160, 192, 12, 52, 224, 192},
9223        {16, 68, 32, 192, 40, 84, 96, 192, 48, 100, 160, 192, 28, 116, 224, 192},
9224        {32, 132, 32, 192, 72, 148, 96, 192, 80, 164, 160, 192, 44, 180, 224, 192},
9225        {48, 196, 32, 192, 104, 212, 96, 192, 112, 228, 160, 192, 60, 244, 224, 192},
9226        {64, 4, 32, 192, 136, 20, 96, 192, 144, 36, 160, 192, 76, 52, 224, 192},
9227        {80, 68, 32, 192, 168, 84, 96, 192, 176, 100, 160, 192, 92, 116, 224, 192},
9228        {96, 132, 32, 192, 200, 148, 96, 192, 208, 164, 160, 192, 108, 180, 224, 192},
9229        {112, 196, 32, 192, 232, 212, 96, 192, 240, 228, 160, 192, 124, 244, 224, 192}},
9230       {{0x8100, 0x3020, 0x0800, 0x6000, 0x1210, 0xb0a0, 0x0c00, 0xe000},
9231        {0x9110, 0x3120, 0x2800, 0x6000, 0x3230, 0xb1a0, 0x1c00, 0xe000},
9232        {0xa120, 0x3220, 0x4800, 0x6000, 0x5250, 0xb2a0, 0x2c00, 0xe000},
9233        {0xb130, 0x3320, 0x6800, 0x6000, 0x7270, 0xb3a0, 0x3c00, 0xe000},
9234        {0xc140, 0x3420, 0x8800, 0x6000, 0x9290, 0xb4a0, 0x4c00, 0xe000},
9235        {0xd150, 0x3520, 0xa800, 0x6000, 0xb2b0, 0xb5a0, 0x5c00, 0xe000},
9236        {0xe160, 0x3620, 0xc800, 0x6000, 0xd2d0, 0xb6a0, 0x6c00, 0xe000},
9237        {0xf170, 0x3720, 0xe800, 0x6000, 0xf2f0, 0xb7a0, 0x7c00, 0xe000}},
9238       {{0x8302'8100, 0x0d0a'0800, 0x1210'0000, 0x0c00'0000},
9239        {0x9312'9110, 0x2d2a'2800, 0x3230'0000, 0x1c00'0000},
9240        {0xa322'a120, 0x4d4a'4800, 0x5250'0000, 0x2c00'0000},
9241        {0xb332'b130, 0x6d6a'6800, 0x7270'0000, 0x3c00'0000},
9242        {0xc342'c140, 0x8d8a'8800, 0x9290'0000, 0x4c00'0000},
9243        {0xd352'd150, 0xadaa'a800, 0xb2b0'0000, 0x5c00'0000},
9244        {0xe362'e160, 0xcdca'c800, 0xd2d0'0000, 0x6c00'0000},
9245        {0xf372'f170, 0xedea'e800, 0xf2f0'0000, 0x7c00'0000}},
9246       {{0x8706'8504'8302'8100, 0x1a19'1615'1210'0000},
9247        {0x9312'9110'0000'0000, 0x3230'0000'0000'0000},
9248        {0xa726'a524'a322'a120, 0x5a59'5655'5250'0000},
9249        {0xb332'b130'0000'0000, 0x7270'0000'0000'0000},
9250        {0xc746'c544'c342'c140, 0x9a99'9695'9290'0000},
9251        {0xd352'd150'0000'0000, 0xb2b0'0000'0000'0000},
9252        {0xe766'e564'e362'e160, 0xdad9'd6d5'd2d0'0000},
9253        {0xf372'f170'0000'0000, 0xf2f0'0000'0000'0000}},
9254       kVectorCalculationsSourceLegacy);
9255   TestVectorInstruction(
9256       ExecVsllvx,
9257       ExecMaskedVsllvx,
9258       {{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60},
9259        {64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124},
9260        {128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188},
9261        {192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252},
9262        {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60},
9263        {64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124},
9264        {128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188},
9265        {192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252}},
9266       {{0x0000, 0x0800, 0x1000, 0x1800, 0x2000, 0x2800, 0x3000, 0x3800},
9267        {0x4000, 0x4800, 0x5000, 0x5800, 0x6000, 0x6800, 0x7000, 0x7800},
9268        {0x8000, 0x8800, 0x9000, 0x9800, 0xa000, 0xa800, 0xb000, 0xb800},
9269        {0xc000, 0xc800, 0xd000, 0xd800, 0xe000, 0xe800, 0xf000, 0xf800},
9270        {0x0000, 0x0800, 0x1000, 0x1800, 0x2000, 0x2800, 0x3000, 0x3800},
9271        {0x4000, 0x4800, 0x5000, 0x5800, 0x6000, 0x6800, 0x7000, 0x7800},
9272        {0x8000, 0x8800, 0x9000, 0x9800, 0xa000, 0xa800, 0xb000, 0xb800},
9273        {0xc000, 0xc800, 0xd000, 0xd800, 0xe000, 0xe800, 0xf000, 0xf800}},
9274       {{0x0a04'0000, 0x1a14'1000, 0x2a24'2000, 0x3a34'3000},
9275        {0x4a44'4000, 0x5a54'5000, 0x6a64'6000, 0x7a74'7000},
9276        {0x8a84'8000, 0x9a94'9000, 0xaaa4'a000, 0xbab4'b000},
9277        {0xcac4'c000, 0xdad4'd000, 0xeae4'e000, 0xfaf4'f000},
9278        {0x0b05'0000, 0x1b15'1000, 0x2b25'2000, 0x3b35'3000},
9279        {0x4b45'4000, 0x5b55'5000, 0x6b65'6000, 0x7b75'7000},
9280        {0x8b85'8000, 0x9b95'9000, 0xaba5'a000, 0xbbb5'b000},
9281        {0xcbc5'c000, 0xdbd5'd000, 0xebe5'e000, 0xfbf5'f000}},
9282       {{0x0a04'0000'0000'0000, 0x2a24'2000'0000'0000},
9283        {0x4a44'4000'0000'0000, 0x6a64'6000'0000'0000},
9284        {0x8a84'8000'0000'0000, 0xaaa4'a000'0000'0000},
9285        {0xcac4'c000'0000'0000, 0xeae4'e000'0000'0000},
9286        {0x0b05'0000'0000'0000, 0x2b25'2000'0000'0000},
9287        {0x4b45'4000'0000'0000, 0x6b65'6000'0000'0000},
9288        {0x8b85'8000'0000'0000, 0xaba5'a000'0000'0000},
9289        {0xcbc5'c000'0000'0000, 0xebe5'e000'0000'0000}},
9290       kVectorCalculationsSourceLegacy);
9291   TestVectorInstruction(
9292       ExecVsllvi,
9293       ExecMaskedVsllvi,
9294       {{0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120},
9295        {128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248},
9296        {0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120},
9297        {128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248},
9298        {0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120},
9299        {128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248},
9300        {0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120},
9301        {128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248}},
9302       {{0x0000, 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000},
9303        {0x8000, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000},
9304        {0x0000, 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000},
9305        {0x8000, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000},
9306        {0x0000, 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000},
9307        {0x8000, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000},
9308        {0x0000, 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000},
9309        {0x8000, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000}},
9310       {{0x1408'0000, 0x3428'2000, 0x5448'4000, 0x7468'6000},
9311        {0x9488'8000, 0xb4a8'a000, 0xd4c8'c000, 0xf4e8'e000},
9312        {0x1509'0000, 0x3529'2000, 0x5549'4000, 0x7569'6000},
9313        {0x9589'8000, 0xb5a9'a000, 0xd5c9'c000, 0xf5e9'e000},
9314        {0x160a'0000, 0x362a'2000, 0x564a'4000, 0x766a'6000},
9315        {0x968a'8000, 0xb6aa'a000, 0xd6ca'c000, 0xf6ea'e000},
9316        {0x170b'0000, 0x372b'2000, 0x574b'4000, 0x776b'6000},
9317        {0x978b'8000, 0xb7ab'a000, 0xd7cb'c000, 0xf7eb'e000}},
9318       {{0x3428'2418'1408'0000, 0x7468'6458'5448'4000},
9319        {0xb4a8'a498'9488'8000, 0xf4e8'e4d8'd4c8'c000},
9320        {0x3529'2519'1509'0000, 0x7569'6559'5549'4000},
9321        {0xb5a9'a599'9589'8000, 0xf5e9'e5d9'd5c9'c000},
9322        {0x362a'261a'160a'0000, 0x766a'665a'564a'4000},
9323        {0xb6aa'a69a'968a'8000, 0xf6ea'e6da'd6ca'c000},
9324        {0x372b'271b'170b'0000, 0x776b'675b'574b'4000},
9325        {0xb7ab'a79b'978b'8000, 0xf7eb'e7db'd7cb'c000}},
9326       kVectorCalculationsSourceLegacy);
9327 }
9328 
ExecVsravv()9329 [[gnu::naked]] void ExecVsravv() {
9330   asm("vsra.vv  v8, v16, v24\n\t"
9331       "ret\n\t");
9332 }
9333 
ExecMaskedVsravv()9334 [[gnu::naked]] void ExecMaskedVsravv() {
9335   asm("vsra.vv  v8, v16, v24, v0.t\n\t"
9336       "ret\n\t");
9337 }
9338 
ExecVsravx()9339 [[gnu::naked]] void ExecVsravx() {
9340   asm("vsra.vx  v8, v16, t0\n\t"
9341       "ret\n\t");
9342 }
9343 
ExecMaskedVsravx()9344 [[gnu::naked]] void ExecMaskedVsravx() {
9345   asm("vsra.vx  v8, v16, t0, v0.t\n\t"
9346       "ret\n\t");
9347 }
9348 
ExecVsravi()9349 [[gnu::naked]] void ExecVsravi() {
9350   asm("vsra.vi  v8, v16, 0x3\n\t"
9351       "ret\n\t");
9352 }
9353 
ExecMaskedVsravi()9354 [[gnu::naked]] void ExecMaskedVsravi() {
9355   asm("vsra.vi  v8, v16, 0x3, v0.t\n\t"
9356       "ret\n\t");
9357 }
9358 
TEST(InlineAsmTestRiscv64,TestVsra)9359 TEST(InlineAsmTestRiscv64, TestVsra) {
9360   TestVectorInstruction(ExecVsravv,
9361                         ExecMaskedVsravv,
9362                         {{0, 224, 0, 254, 2, 225, 0, 254, 4, 226, 0, 254, 12, 227, 0, 254},
9363                          {16, 228, 1, 254, 10, 229, 1, 254, 12, 230, 1, 254, 28, 231, 1, 254},
9364                          {32, 232, 2, 254, 18, 233, 2, 254, 20, 234, 2, 254, 44, 235, 2, 254},
9365                          {48, 236, 3, 254, 26, 237, 3, 254, 28, 238, 3, 254, 60, 239, 3, 254},
9366                          {64, 240, 4, 255, 34, 241, 4, 255, 36, 242, 4, 255, 76, 243, 4, 255},
9367                          {80, 244, 5, 255, 42, 245, 5, 255, 44, 246, 5, 255, 92, 247, 5, 255},
9368                          {96, 248, 6, 255, 50, 249, 6, 255, 52, 250, 6, 255, 108, 251, 6, 255},
9369                          {112, 252, 7, 255, 58, 253, 7, 255, 60, 254, 7, 255, 124, 255, 7, 255}},
9370                         {{0x8100, 0xf830, 0xffc2, 0xfff8, 0xc484, 0xf8b0, 0xff8d, 0xfff8},
9371                          {0x9110, 0xf931, 0xffca, 0xfff9, 0xcc8c, 0xf9b1, 0xff9d, 0xfff9},
9372                          {0xa120, 0xfa32, 0xffd2, 0xfffa, 0xd494, 0xfab2, 0xffad, 0xfffa},
9373                          {0xb130, 0xfb33, 0xffda, 0xfffb, 0xdc9c, 0xfbb3, 0xffbd, 0xfffb},
9374                          {0xc140, 0xfc34, 0xffe2, 0xfffc, 0xe4a4, 0xfcb4, 0xffcd, 0xfffc},
9375                          {0xd150, 0xfd35, 0xffea, 0xfffd, 0xecac, 0xfdb5, 0xffdd, 0xfffd},
9376                          {0xe160, 0xfe36, 0xfff2, 0xfffe, 0xf4b4, 0xfeb6, 0xffed, 0xfffe},
9377                          {0xf170, 0xff37, 0xfffa, 0xffff, 0xfcbc, 0xffb7, 0xfffd, 0xffff}},
9378                         {{0x8302'8100, 0xffc3'8342, 0xffff'c585, 0xffff'ff8f},
9379                          {0x9312'9110, 0xffcb'8b4a, 0xffff'cd8d, 0xffff'ff9f},
9380                          {0xa322'a120, 0xffd3'9352, 0xffff'd595, 0xffff'ffaf},
9381                          {0xb332'b130, 0xffdb'9b5a, 0xffff'dd9d, 0xffff'ffbf},
9382                          {0xc342'c140, 0xffe3'a362, 0xffff'e5a5, 0xffff'ffcf},
9383                          {0xd352'd150, 0xffeb'ab6a, 0xffff'edad, 0xffff'ffdf},
9384                          {0xe362'e160, 0xfff3'b372, 0xffff'f5b5, 0xffff'ffef},
9385                          {0xf372'f170, 0xfffb'bb7a, 0xffff'fdbd, 0xffff'ffff}},
9386                         {{0x8706'8504'8302'8100, 0xffff'c787'4686'4585},
9387                          {0xffff'ffff'9716'9514, 0xffff'ffff'ffff'cf8f},
9388                          {0xa726'a524'a322'a120, 0xffff'd797'5696'5595},
9389                          {0xffff'ffff'b736'b534, 0xffff'ffff'ffff'df9f},
9390                          {0xc746'c544'c342'c140, 0xffff'e7a7'66a6'65a5},
9391                          {0xffff'ffff'd756'd554, 0xffff'ffff'ffff'efaf},
9392                          {0xe766'e564'e362'e160, 0xffff'f7b7'76b6'75b5},
9393                          {0xffff'ffff'f776'f574, 0xffff'ffff'ffff'ffbf}},
9394                         kVectorCalculationsSourceLegacy);
9395   TestVectorInstruction(ExecVsravx,
9396                         ExecMaskedVsravx,
9397                         {{0, 224, 0, 224, 1, 225, 1, 225, 2, 226, 2, 226, 3, 227, 3, 227},
9398                          {4, 228, 4, 228, 5, 229, 5, 229, 6, 230, 6, 230, 7, 231, 7, 231},
9399                          {8, 232, 8, 232, 9, 233, 9, 233, 10, 234, 10, 234, 11, 235, 11, 235},
9400                          {12, 236, 12, 236, 13, 237, 13, 237, 14, 238, 14, 238, 15, 239, 15, 239},
9401                          {16, 240, 16, 240, 17, 241, 17, 241, 18, 242, 18, 242, 19, 243, 19, 243},
9402                          {20, 244, 20, 244, 21, 245, 21, 245, 22, 246, 22, 246, 23, 247, 23, 247},
9403                          {24, 248, 24, 248, 25, 249, 25, 249, 26, 250, 26, 250, 27, 251, 27, 251},
9404                          {28, 252, 28, 252, 29, 253, 29, 253, 30, 254, 30, 254, 31, 255, 31, 255}},
9405                         {{0xffe0, 0xffe0, 0xffe1, 0xffe1, 0xffe2, 0xffe2, 0xffe3, 0xffe3},
9406                          {0xffe4, 0xffe4, 0xffe5, 0xffe5, 0xffe6, 0xffe6, 0xffe7, 0xffe7},
9407                          {0xffe8, 0xffe8, 0xffe9, 0xffe9, 0xffea, 0xffea, 0xffeb, 0xffeb},
9408                          {0xffec, 0xffec, 0xffed, 0xffed, 0xffee, 0xffee, 0xffef, 0xffef},
9409                          {0xfff0, 0xfff0, 0xfff1, 0xfff1, 0xfff2, 0xfff2, 0xfff3, 0xfff3},
9410                          {0xfff4, 0xfff4, 0xfff5, 0xfff5, 0xfff6, 0xfff6, 0xfff7, 0xfff7},
9411                          {0xfff8, 0xfff8, 0xfff9, 0xfff9, 0xfffa, 0xfffa, 0xfffb, 0xfffb},
9412                          {0xfffc, 0xfffc, 0xfffd, 0xfffd, 0xfffe, 0xfffe, 0xffff, 0xffff}},
9413                         {{0xffe0'c0a0, 0xffe1'c1a1, 0xffe2'c2a2, 0xffe3'c3a3},
9414                          {0xffe4'c4a4, 0xffe5'c5a5, 0xffe6'c6a6, 0xffe7'c7a7},
9415                          {0xffe8'c8a8, 0xffe9'c9a9, 0xffea'caaa, 0xffeb'cbab},
9416                          {0xffec'ccac, 0xffed'cdad, 0xffee'ceae, 0xffef'cfaf},
9417                          {0xfff0'd0b0, 0xfff1'd1b1, 0xfff2'd2b2, 0xfff3'd3b3},
9418                          {0xfff4'd4b4, 0xfff5'd5b5, 0xfff6'd6b6, 0xfff7'd7b7},
9419                          {0xfff8'd8b8, 0xfff9'd9b9, 0xfffa'daba, 0xfffb'dbbb},
9420                          {0xfffc'dcbc, 0xfffd'ddbd, 0xfffe'debe, 0xffff'dfbf}},
9421                         {{0xffff'ffff'ffe1'c1a1, 0xffff'ffff'ffe3'c3a3},
9422                          {0xffff'ffff'ffe5'c5a5, 0xffff'ffff'ffe7'c7a7},
9423                          {0xffff'ffff'ffe9'c9a9, 0xffff'ffff'ffeb'cbab},
9424                          {0xffff'ffff'ffed'cdad, 0xffff'ffff'ffef'cfaf},
9425                          {0xffff'ffff'fff1'd1b1, 0xffff'ffff'fff3'd3b3},
9426                          {0xffff'ffff'fff5'd5b5, 0xffff'ffff'fff7'd7b7},
9427                          {0xffff'ffff'fff9'd9b9, 0xffff'ffff'fffb'dbbb},
9428                          {0xffff'ffff'fffd'ddbd, 0xffff'ffff'ffff'dfbf}},
9429                         kVectorCalculationsSourceLegacy);
9430   TestVectorInstruction(ExecVsravi,
9431                         ExecMaskedVsravi,
9432                         {{0, 240, 0, 240, 0, 240, 0, 240, 1, 241, 1, 241, 1, 241, 1, 241},
9433                          {2, 242, 2, 242, 2, 242, 2, 242, 3, 243, 3, 243, 3, 243, 3, 243},
9434                          {4, 244, 4, 244, 4, 244, 4, 244, 5, 245, 5, 245, 5, 245, 5, 245},
9435                          {6, 246, 6, 246, 6, 246, 6, 246, 7, 247, 7, 247, 7, 247, 7, 247},
9436                          {8, 248, 8, 248, 8, 248, 8, 248, 9, 249, 9, 249, 9, 249, 9, 249},
9437                          {10, 250, 10, 250, 10, 250, 10, 250, 11, 251, 11, 251, 11, 251, 11, 251},
9438                          {12, 252, 12, 252, 12, 252, 12, 252, 13, 253, 13, 253, 13, 253, 13, 253},
9439                          {14, 254, 14, 254, 14, 254, 14, 254, 15, 255, 15, 255, 15, 255, 15, 255}},
9440                         {{0xf020, 0xf060, 0xf0a0, 0xf0e0, 0xf121, 0xf161, 0xf1a1, 0xf1e1},
9441                          {0xf222, 0xf262, 0xf2a2, 0xf2e2, 0xf323, 0xf363, 0xf3a3, 0xf3e3},
9442                          {0xf424, 0xf464, 0xf4a4, 0xf4e4, 0xf525, 0xf565, 0xf5a5, 0xf5e5},
9443                          {0xf626, 0xf666, 0xf6a6, 0xf6e6, 0xf727, 0xf767, 0xf7a7, 0xf7e7},
9444                          {0xf828, 0xf868, 0xf8a8, 0xf8e8, 0xf929, 0xf969, 0xf9a9, 0xf9e9},
9445                          {0xfa2a, 0xfa6a, 0xfaaa, 0xfaea, 0xfb2b, 0xfb6b, 0xfbab, 0xfbeb},
9446                          {0xfc2c, 0xfc6c, 0xfcac, 0xfcec, 0xfd2d, 0xfd6d, 0xfdad, 0xfded},
9447                          {0xfe2e, 0xfe6e, 0xfeae, 0xfeee, 0xff2f, 0xff6f, 0xffaf, 0xffef}},
9448                         {{0xf060'5020, 0xf0e0'd0a0, 0xf161'5121, 0xf1e1'd1a1},
9449                          {0xf262'5222, 0xf2e2'd2a2, 0xf363'5323, 0xf3e3'd3a3},
9450                          {0xf464'5424, 0xf4e4'd4a4, 0xf565'5525, 0xf5e5'd5a5},
9451                          {0xf666'5626, 0xf6e6'd6a6, 0xf767'5727, 0xf7e7'd7a7},
9452                          {0xf868'5828, 0xf8e8'd8a8, 0xf969'5929, 0xf9e9'd9a9},
9453                          {0xfa6a'5a2a, 0xfaea'daaa, 0xfb6b'5b2b, 0xfbeb'dbab},
9454                          {0xfc6c'5c2c, 0xfcec'dcac, 0xfd6d'5d2d, 0xfded'ddad},
9455                          {0xfe6e'5e2e, 0xfeee'deae, 0xff6f'5f2f, 0xffef'dfaf}},
9456                         {{0xf0e0'd0a0'9060'5020, 0xf1e1'd1a1'9161'5121},
9457                          {0xf2e2'd2a2'9262'5222, 0xf3e3'd3a3'9363'5323},
9458                          {0xf4e4'd4a4'9464'5424, 0xf5e5'd5a5'9565'5525},
9459                          {0xf6e6'd6a6'9666'5626, 0xf7e7'd7a7'9767'5727},
9460                          {0xf8e8'd8a8'9868'5828, 0xf9e9'd9a9'9969'5929},
9461                          {0xfaea'daaa'9a6a'5a2a, 0xfbeb'dbab'9b6b'5b2b},
9462                          {0xfcec'dcac'9c6c'5c2c, 0xfded'ddad'9d6d'5d2d},
9463                          {0xfeee'deae'9e6e'5e2e, 0xffef'dfaf'9f6f'5f2f}},
9464                         kVectorCalculationsSourceLegacy);
9465 }
9466 
ExecVsrlvv()9467 [[gnu::naked]] void ExecVsrlvv() {
9468   asm("vsrl.vv  v8, v16, v24\n\t"
9469       "ret\n\t");
9470 }
9471 
ExecMaskedVsrlvv()9472 [[gnu::naked]] void ExecMaskedVsrlvv() {
9473   asm("vsrl.vv  v8, v16, v24, v0.t\n\t"
9474       "ret\n\t");
9475 }
9476 
ExecVsrlvx()9477 [[gnu::naked]] void ExecVsrlvx() {
9478   asm("vsrl.vx  v8, v16, t0\n\t"
9479       "ret\n\t");
9480 }
9481 
ExecMaskedVsrlvx()9482 [[gnu::naked]] void ExecMaskedVsrlvx() {
9483   asm("vsrl.vx  v8, v16, t0, v0.t\n\t"
9484       "ret\n\t");
9485 }
9486 
ExecVsrlvi()9487 [[gnu::naked]] void ExecVsrlvi() {
9488   asm("vsrl.vi  v8, v16, 0x3\n\t"
9489       "ret\n\t");
9490 }
9491 
ExecMaskedVsrlvi()9492 [[gnu::naked]] void ExecMaskedVsrlvi() {
9493   asm("vsrl.vi  v8, v16, 0x3, v0.t\n\t"
9494       "ret\n\t");
9495 }
9496 
TEST(InlineAsmTestRiscv64,TestVsrl)9497 TEST(InlineAsmTestRiscv64, TestVsrl) {
9498   TestVectorInstruction(ExecVsrlvv,
9499                         ExecMaskedVsrlvv,
9500                         {{0, 32, 0, 2, 2, 33, 0, 2, 4, 34, 0, 2, 12, 35, 0, 2},
9501                          {16, 36, 1, 2, 10, 37, 1, 2, 12, 38, 1, 2, 28, 39, 1, 2},
9502                          {32, 40, 2, 2, 18, 41, 2, 2, 20, 42, 2, 2, 44, 43, 2, 2},
9503                          {48, 44, 3, 2, 26, 45, 3, 2, 28, 46, 3, 2, 60, 47, 3, 2},
9504                          {64, 48, 4, 3, 34, 49, 4, 3, 36, 50, 4, 3, 76, 51, 4, 3},
9505                          {80, 52, 5, 3, 42, 53, 5, 3, 44, 54, 5, 3, 92, 55, 5, 3},
9506                          {96, 56, 6, 3, 50, 57, 6, 3, 52, 58, 6, 3, 108, 59, 6, 3},
9507                          {112, 60, 7, 3, 58, 61, 7, 3, 60, 62, 7, 3, 124, 63, 7, 3}},
9508                         {{0x8100, 0x0830, 0x0042, 0x0008, 0x4484, 0x08b0, 0x008d, 0x0008},
9509                          {0x9110, 0x0931, 0x004a, 0x0009, 0x4c8c, 0x09b1, 0x009d, 0x0009},
9510                          {0xa120, 0x0a32, 0x0052, 0x000a, 0x5494, 0x0ab2, 0x00ad, 0x000a},
9511                          {0xb130, 0x0b33, 0x005a, 0x000b, 0x5c9c, 0x0bb3, 0x00bd, 0x000b},
9512                          {0xc140, 0x0c34, 0x0062, 0x000c, 0x64a4, 0x0cb4, 0x00cd, 0x000c},
9513                          {0xd150, 0x0d35, 0x006a, 0x000d, 0x6cac, 0x0db5, 0x00dd, 0x000d},
9514                          {0xe160, 0x0e36, 0x0072, 0x000e, 0x74b4, 0x0eb6, 0x00ed, 0x000e},
9515                          {0xf170, 0x0f37, 0x007a, 0x000f, 0x7cbc, 0x0fb7, 0x00fd, 0x000f}},
9516                         {{0x8302'8100, 0x0043'8342, 0x0000'4585, 0x0000'008f},
9517                          {0x9312'9110, 0x004b'8b4a, 0x0000'4d8d, 0x0000'009f},
9518                          {0xa322'a120, 0x0053'9352, 0x0000'5595, 0x0000'00af},
9519                          {0xb332'b130, 0x005b'9b5a, 0x0000'5d9d, 0x0000'00bf},
9520                          {0xc342'c140, 0x0063'a362, 0x0000'65a5, 0x0000'00cf},
9521                          {0xd352'd150, 0x006b'ab6a, 0x0000'6dad, 0x0000'00df},
9522                          {0xe362'e160, 0x0073'b372, 0x0000'75b5, 0x0000'00ef},
9523                          {0xf372'f170, 0x007b'bb7a, 0x0000'7dbd, 0x0000'00ff}},
9524                         {{0x8706'8504'8302'8100, 0x0000'4787'4686'4585},
9525                          {0x0000'0000'9716'9514, 0x0000'0000'0000'4f8f},
9526                          {0xa726'a524'a322'a120, 0x0000'5797'5696'5595},
9527                          {0x0000'0000'b736'b534, 0x0000'0000'0000'5f9f},
9528                          {0xc746'c544'c342'c140, 0x0000'67a7'66a6'65a5},
9529                          {0x0000'0000'd756'd554, 0x0000'0000'0000'6faf},
9530                          {0xe766'e564'e362'e160, 0x0000'77b7'76b6'75b5},
9531                          {0x0000'0000'f776'f574, 0x0000'0000'0000'7fbf}},
9532                         kVectorCalculationsSourceLegacy);
9533   TestVectorInstruction(ExecVsrlvx,
9534                         ExecMaskedVsrlvx,
9535                         {{0, 32, 0, 32, 1, 33, 1, 33, 2, 34, 2, 34, 3, 35, 3, 35},
9536                          {4, 36, 4, 36, 5, 37, 5, 37, 6, 38, 6, 38, 7, 39, 7, 39},
9537                          {8, 40, 8, 40, 9, 41, 9, 41, 10, 42, 10, 42, 11, 43, 11, 43},
9538                          {12, 44, 12, 44, 13, 45, 13, 45, 14, 46, 14, 46, 15, 47, 15, 47},
9539                          {16, 48, 16, 48, 17, 49, 17, 49, 18, 50, 18, 50, 19, 51, 19, 51},
9540                          {20, 52, 20, 52, 21, 53, 21, 53, 22, 54, 22, 54, 23, 55, 23, 55},
9541                          {24, 56, 24, 56, 25, 57, 25, 57, 26, 58, 26, 58, 27, 59, 27, 59},
9542                          {28, 60, 28, 60, 29, 61, 29, 61, 30, 62, 30, 62, 31, 63, 31, 63}},
9543                         {{0x0020, 0x0020, 0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023},
9544                          {0x0024, 0x0024, 0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027},
9545                          {0x0028, 0x0028, 0x0029, 0x0029, 0x002a, 0x002a, 0x002b, 0x002b},
9546                          {0x002c, 0x002c, 0x002d, 0x002d, 0x002e, 0x002e, 0x002f, 0x002f},
9547                          {0x0030, 0x0030, 0x0031, 0x0031, 0x0032, 0x0032, 0x0033, 0x0033},
9548                          {0x0034, 0x0034, 0x0035, 0x0035, 0x0036, 0x0036, 0x0037, 0x0037},
9549                          {0x0038, 0x0038, 0x0039, 0x0039, 0x003a, 0x003a, 0x003b, 0x003b},
9550                          {0x003c, 0x003c, 0x003d, 0x003d, 0x003e, 0x003e, 0x003f, 0x003f}},
9551                         {{0x0020'c0a0, 0x0021'c1a1, 0x0022'c2a2, 0x0023'c3a3},
9552                          {0x0024'c4a4, 0x0025'c5a5, 0x0026'c6a6, 0x0027'c7a7},
9553                          {0x0028'c8a8, 0x0029'c9a9, 0x002a'caaa, 0x002b'cbab},
9554                          {0x002c'ccac, 0x002d'cdad, 0x002e'ceae, 0x002f'cfaf},
9555                          {0x0030'd0b0, 0x0031'd1b1, 0x0032'd2b2, 0x0033'd3b3},
9556                          {0x0034'd4b4, 0x0035'd5b5, 0x0036'd6b6, 0x0037'd7b7},
9557                          {0x0038'd8b8, 0x0039'd9b9, 0x003a'daba, 0x003b'dbbb},
9558                          {0x003c'dcbc, 0x003d'ddbd, 0x003e'debe, 0x003f'dfbf}},
9559                         {{0x0000'0000'0021'c1a1, 0x0000'0000'0023'c3a3},
9560                          {0x0000'0000'0025'c5a5, 0x0000'0000'0027'c7a7},
9561                          {0x0000'0000'0029'c9a9, 0x0000'0000'002b'cbab},
9562                          {0x0000'0000'002d'cdad, 0x0000'0000'002f'cfaf},
9563                          {0x0000'0000'0031'd1b1, 0x0000'0000'0033'd3b3},
9564                          {0x0000'0000'0035'd5b5, 0x0000'0000'0037'd7b7},
9565                          {0x0000'0000'0039'd9b9, 0x0000'0000'003b'dbbb},
9566                          {0x0000'0000'003d'ddbd, 0x0000'0000'003f'dfbf}},
9567                         kVectorCalculationsSourceLegacy);
9568   TestVectorInstruction(ExecVsrlvi,
9569                         ExecMaskedVsrlvi,
9570                         {{0, 16, 0, 16, 0, 16, 0, 16, 1, 17, 1, 17, 1, 17, 1, 17},
9571                          {2, 18, 2, 18, 2, 18, 2, 18, 3, 19, 3, 19, 3, 19, 3, 19},
9572                          {4, 20, 4, 20, 4, 20, 4, 20, 5, 21, 5, 21, 5, 21, 5, 21},
9573                          {6, 22, 6, 22, 6, 22, 6, 22, 7, 23, 7, 23, 7, 23, 7, 23},
9574                          {8, 24, 8, 24, 8, 24, 8, 24, 9, 25, 9, 25, 9, 25, 9, 25},
9575                          {10, 26, 10, 26, 10, 26, 10, 26, 11, 27, 11, 27, 11, 27, 11, 27},
9576                          {12, 28, 12, 28, 12, 28, 12, 28, 13, 29, 13, 29, 13, 29, 13, 29},
9577                          {14, 30, 14, 30, 14, 30, 14, 30, 15, 31, 15, 31, 15, 31, 15, 31}},
9578                         {{0x1020, 0x1060, 0x10a0, 0x10e0, 0x1121, 0x1161, 0x11a1, 0x11e1},
9579                          {0x1222, 0x1262, 0x12a2, 0x12e2, 0x1323, 0x1363, 0x13a3, 0x13e3},
9580                          {0x1424, 0x1464, 0x14a4, 0x14e4, 0x1525, 0x1565, 0x15a5, 0x15e5},
9581                          {0x1626, 0x1666, 0x16a6, 0x16e6, 0x1727, 0x1767, 0x17a7, 0x17e7},
9582                          {0x1828, 0x1868, 0x18a8, 0x18e8, 0x1929, 0x1969, 0x19a9, 0x19e9},
9583                          {0x1a2a, 0x1a6a, 0x1aaa, 0x1aea, 0x1b2b, 0x1b6b, 0x1bab, 0x1beb},
9584                          {0x1c2c, 0x1c6c, 0x1cac, 0x1cec, 0x1d2d, 0x1d6d, 0x1dad, 0x1ded},
9585                          {0x1e2e, 0x1e6e, 0x1eae, 0x1eee, 0x1f2f, 0x1f6f, 0x1faf, 0x1fef}},
9586                         {{0x1060'5020, 0x10e0'd0a0, 0x1161'5121, 0x11e1'd1a1},
9587                          {0x1262'5222, 0x12e2'd2a2, 0x1363'5323, 0x13e3'd3a3},
9588                          {0x1464'5424, 0x14e4'd4a4, 0x1565'5525, 0x15e5'd5a5},
9589                          {0x1666'5626, 0x16e6'd6a6, 0x1767'5727, 0x17e7'd7a7},
9590                          {0x1868'5828, 0x18e8'd8a8, 0x1969'5929, 0x19e9'd9a9},
9591                          {0x1a6a'5a2a, 0x1aea'daaa, 0x1b6b'5b2b, 0x1beb'dbab},
9592                          {0x1c6c'5c2c, 0x1cec'dcac, 0x1d6d'5d2d, 0x1ded'ddad},
9593                          {0x1e6e'5e2e, 0x1eee'deae, 0x1f6f'5f2f, 0x1fef'dfaf}},
9594                         {{0x10e0'd0a0'9060'5020, 0x11e1'd1a1'9161'5121},
9595                          {0x12e2'd2a2'9262'5222, 0x13e3'd3a3'9363'5323},
9596                          {0x14e4'd4a4'9464'5424, 0x15e5'd5a5'9565'5525},
9597                          {0x16e6'd6a6'9666'5626, 0x17e7'd7a7'9767'5727},
9598                          {0x18e8'd8a8'9868'5828, 0x19e9'd9a9'9969'5929},
9599                          {0x1aea'daaa'9a6a'5a2a, 0x1beb'dbab'9b6b'5b2b},
9600                          {0x1cec'dcac'9c6c'5c2c, 0x1ded'ddad'9d6d'5d2d},
9601                          {0x1eee'deae'9e6e'5e2e, 0x1fef'dfaf'9f6f'5f2f}},
9602                         kVectorCalculationsSourceLegacy);
9603 }
9604 
ExecVwaddvv()9605 [[gnu::naked]] void ExecVwaddvv() {
9606   asm("vwadd.vv  v8, v16, v24\n\t"
9607       "ret\n\t");
9608 }
9609 
ExecMaskedVwaddvv()9610 [[gnu::naked]] void ExecMaskedVwaddvv() {
9611   asm("vwadd.vv  v8, v16, v24, v0.t\n\t"
9612       "ret\n\t");
9613 }
9614 
TEST(InlineAsmTestRiscv64,TestVwadd)9615 TEST(InlineAsmTestRiscv64, TestVwadd) {
9616   TestWideningVectorInstruction(ExecVwaddvv,
9617                                 ExecMaskedVwaddvv,
9618                                 {{0x0000, 0xff13, 0x0006, 0xff19, 0x000d, 0xff1f, 0x0012, 0xff25},
9619                                  {0x0019, 0xff0b, 0x001e, 0xff11, 0x0024, 0xff17, 0x002a, 0xff1d},
9620                                  {0x0030, 0xff43, 0x0036, 0xff49, 0x003d, 0xff4f, 0x0042, 0xff55},
9621                                  {0x0049, 0xff3b, 0x004e, 0xff41, 0x0054, 0xff47, 0x005a, 0xff4d},
9622                                  {0x0060, 0xff73, 0x0066, 0xff79, 0x006d, 0xff7f, 0x0072, 0xff85},
9623                                  {0x0079, 0xff6b, 0x007e, 0xff71, 0x0084, 0xff77, 0x008a, 0xff7d},
9624                                  {0x0090, 0xffa3, 0x0096, 0xffa9, 0x009d, 0xffaf, 0x00a2, 0xffb5},
9625                                  {0x00a9, 0xff9b, 0x00ae, 0xffa1, 0x00b4, 0xffa7, 0x00ba, 0xffad}},
9626                                 {{0xffff'1300, 0xffff'1906, 0xffff'1f0d, 0xffff'2512},
9627                                  {0xffff'0b19, 0xffff'111e, 0xffff'1724, 0xffff'1d2a},
9628                                  {0xffff'4330, 0xffff'4936, 0xffff'4f3d, 0xffff'5542},
9629                                  {0xffff'3b49, 0xffff'414e, 0xffff'4754, 0xffff'4d5a},
9630                                  {0xffff'7360, 0xffff'7966, 0xffff'7f6d, 0xffff'8572},
9631                                  {0xffff'6b79, 0xffff'717e, 0xffff'7784, 0xffff'7d8a},
9632                                  {0xffff'a390, 0xffff'a996, 0xffff'af9d, 0xffff'b5a2},
9633                                  {0xffff'9ba9, 0xffff'a1ae, 0xffff'a7b4, 0xffff'adba}},
9634                                 {{0xffff'ffff'1907'1300, 0xffff'ffff'2513'1f0d},
9635                                  {0xffff'ffff'111f'0b19, 0xffff'ffff'1d2b'1724},
9636                                  {0xffff'ffff'4937'4330, 0xffff'ffff'5543'4f3d},
9637                                  {0xffff'ffff'414f'3b49, 0xffff'ffff'4d5b'4754},
9638                                  {0xffff'ffff'7967'7360, 0xffff'ffff'8573'7f6d},
9639                                  {0xffff'ffff'717f'6b79, 0xffff'ffff'7d8b'7784},
9640                                  {0xffff'ffff'a997'a390, 0xffff'ffff'b5a3'af9d},
9641                                  {0xffff'ffff'a1af'9ba9, 0xffff'ffff'adbb'a7b4}},
9642                                 kVectorCalculationsSource);
9643 }
9644 
ExecVwadduvv()9645 [[gnu::naked]] void ExecVwadduvv() {
9646   asm("vwaddu.vv  v8, v16, v24\n\t"
9647       "ret\n\t");
9648 }
9649 
ExecMaskedVwadduvv()9650 [[gnu::naked]] void ExecMaskedVwadduvv() {
9651   asm("vwaddu.vv  v8, v16, v24, v0.t\n\t"
9652       "ret\n\t");
9653 }
9654 
TEST(InlineAsmTestRiscv64,TestVwaddu)9655 TEST(InlineAsmTestRiscv64, TestVwaddu) {
9656   TestWideningVectorInstruction(ExecVwadduvv,
9657                                 ExecMaskedVwadduvv,
9658                                 {{0x0000, 0x0113, 0x0006, 0x0119, 0x000d, 0x011f, 0x0012, 0x0125},
9659                                  {0x0019, 0x010b, 0x001e, 0x0111, 0x0024, 0x0117, 0x002a, 0x011d},
9660                                  {0x0030, 0x0143, 0x0036, 0x0149, 0x003d, 0x014f, 0x0042, 0x0155},
9661                                  {0x0049, 0x013b, 0x004e, 0x0141, 0x0054, 0x0147, 0x005a, 0x014d},
9662                                  {0x0060, 0x0173, 0x0066, 0x0179, 0x006d, 0x017f, 0x0072, 0x0185},
9663                                  {0x0079, 0x016b, 0x007e, 0x0171, 0x0084, 0x0177, 0x008a, 0x017d},
9664                                  {0x0090, 0x01a3, 0x0096, 0x01a9, 0x009d, 0x01af, 0x00a2, 0x01b5},
9665                                  {0x00a9, 0x019b, 0x00ae, 0x01a1, 0x00b4, 0x01a7, 0x00ba, 0x01ad}},
9666                                 {{0x0001'1300, 0x0001'1906, 0x0001'1f0d, 0x0001'2512},
9667                                  {0x0001'0b19, 0x0001'111e, 0x0001'1724, 0x0001'1d2a},
9668                                  {0x0001'4330, 0x0001'4936, 0x0001'4f3d, 0x0001'5542},
9669                                  {0x0001'3b49, 0x0001'414e, 0x0001'4754, 0x0001'4d5a},
9670                                  {0x0001'7360, 0x0001'7966, 0x0001'7f6d, 0x0001'8572},
9671                                  {0x0001'6b79, 0x0001'717e, 0x0001'7784, 0x0001'7d8a},
9672                                  {0x0001'a390, 0x0001'a996, 0x0001'af9d, 0x0001'b5a2},
9673                                  {0x0001'9ba9, 0x0001'a1ae, 0x0001'a7b4, 0x0001'adba}},
9674                                 {{0x0000'0001'1907'1300, 0x0000'0001'2513'1f0d},
9675                                  {0x0000'0001'111f'0b19, 0x0000'0001'1d2b'1724},
9676                                  {0x0000'0001'4937'4330, 0x0000'0001'5543'4f3d},
9677                                  {0x0000'0001'414f'3b49, 0x0000'0001'4d5b'4754},
9678                                  {0x0000'0001'7967'7360, 0x0000'0001'8573'7f6d},
9679                                  {0x0000'0001'717f'6b79, 0x0000'0001'7d8b'7784},
9680                                  {0x0000'0001'a997'a390, 0x0000'0001'b5a3'af9d},
9681                                  {0x0000'0001'a1af'9ba9, 0x0000'0001'adbb'a7b4}},
9682                                 kVectorCalculationsSource);
9683 }
9684 
ExecVwadduvx()9685 [[gnu::naked]] void ExecVwadduvx() {
9686   asm("vwaddu.vx  v8, v16, t0\n\t"
9687       "ret\n\t");
9688 }
9689 
ExecMaskedVwadduvx()9690 [[gnu::naked]] void ExecMaskedVwadduvx() {
9691   asm("vwaddu.vx  v8, v16, t0, v0.t\n\t"
9692       "ret\n\t");
9693 }
9694 
TEST(InlineAsmTestRiscv64,TestVwadduvx)9695 TEST(InlineAsmTestRiscv64, TestVwadduvx) {
9696   TestWideningVectorInstruction(ExecVwadduvx,
9697                                 ExecMaskedVwadduvx,
9698                                 {{0x00aa, 0x012b, 0x00ac, 0x012d, 0x00ae, 0x012f, 0x00b0, 0x0131},
9699                                  {0x00b2, 0x0133, 0x00b4, 0x0135, 0x00b6, 0x0137, 0x00b8, 0x0139},
9700                                  {0x00ba, 0x013b, 0x00bc, 0x013d, 0x00be, 0x013f, 0x00c0, 0x0141},
9701                                  {0x00c2, 0x0143, 0x00c4, 0x0145, 0x00c6, 0x0147, 0x00c8, 0x0149},
9702                                  {0x00ca, 0x014b, 0x00cc, 0x014d, 0x00ce, 0x014f, 0x00d0, 0x0151},
9703                                  {0x00d2, 0x0153, 0x00d4, 0x0155, 0x00d6, 0x0157, 0x00d8, 0x0159},
9704                                  {0x00da, 0x015b, 0x00dc, 0x015d, 0x00de, 0x015f, 0x00e0, 0x0161},
9705                                  {0x00e2, 0x0163, 0x00e4, 0x0165, 0x00e6, 0x0167, 0x00e8, 0x0169}},
9706                                 {{0x0001'2baa, 0x0001'2dac, 0x0001'2fae, 0x0001'31b0},
9707                                  {0x0001'33b2, 0x0001'35b4, 0x0001'37b6, 0x0001'39b8},
9708                                  {0x0001'3bba, 0x0001'3dbc, 0x0001'3fbe, 0x0001'41c0},
9709                                  {0x0001'43c2, 0x0001'45c4, 0x0001'47c6, 0x0001'49c8},
9710                                  {0x0001'4bca, 0x0001'4dcc, 0x0001'4fce, 0x0001'51d0},
9711                                  {0x0001'53d2, 0x0001'55d4, 0x0001'57d6, 0x0001'59d8},
9712                                  {0x0001'5bda, 0x0001'5ddc, 0x0001'5fde, 0x0001'61e0},
9713                                  {0x0001'63e2, 0x0001'65e4, 0x0001'67e6, 0x0001'69e8}},
9714                                 {{0x0000'0001'2dad'2baa, 0x0000'0001'31b1'2fae},
9715                                  {0x0000'0001'35b5'33b2, 0x0000'0001'39b9'37b6},
9716                                  {0x0000'0001'3dbd'3bba, 0x0000'0001'41c1'3fbe},
9717                                  {0x0000'0001'45c5'43c2, 0x0000'0001'49c9'47c6},
9718                                  {0x0000'0001'4dcd'4bca, 0x0000'0001'51d1'4fce},
9719                                  {0x0000'0001'55d5'53d2, 0x0000'0001'59d9'57d6},
9720                                  {0x0000'0001'5ddd'5bda, 0x0000'0001'61e1'5fde},
9721                                  {0x0000'0001'65e5'63e2, 0x0000'0001'69e9'67e6}},
9722                                 kVectorCalculationsSource);
9723 }
9724 
ExecVwadduwv()9725 [[gnu::naked]] void ExecVwadduwv() {
9726   asm("vwaddu.wv  v8, v16, v24\n\t"
9727       "ret\n\t");
9728 }
9729 
ExecMaskedVwadduwv()9730 [[gnu::naked]] void ExecMaskedVwadduwv() {
9731   asm("vwaddu.wv  v8, v16, v24, v0.t\n\t"
9732       "ret\n\t");
9733 }
9734 
TEST(InlineAsmTestRiscv64,TestVwadduwv)9735 TEST(InlineAsmTestRiscv64, TestVwadduwv) {
9736   TestWideningVectorInstruction(ExecVwadduwv,
9737                                 ExecMaskedVwadduwv,
9738                                 {{0x8100, 0x8394, 0x8508, 0x879c, 0x8911, 0x8ba4, 0x8d18, 0x8fac},
9739                                  {0x9121, 0x9394, 0x9528, 0x979c, 0x9930, 0x9ba4, 0x9d38, 0x9fac},
9740                                  {0xa140, 0xa3d4, 0xa548, 0xa7dc, 0xa951, 0xabe4, 0xad58, 0xafec},
9741                                  {0xb161, 0xb3d4, 0xb568, 0xb7dc, 0xb970, 0xbbe4, 0xbd78, 0xbfec},
9742                                  {0xc180, 0xc414, 0xc588, 0xc81c, 0xc991, 0xcc24, 0xcd98, 0xd02c},
9743                                  {0xd1a1, 0xd414, 0xd5a8, 0xd81c, 0xd9b0, 0xdc24, 0xddb8, 0xe02c},
9744                                  {0xe1c0, 0xe454, 0xe5c8, 0xe85c, 0xe9d1, 0xec64, 0xedd8, 0xf06c},
9745                                  {0xf1e1, 0xf454, 0xf5e8, 0xf85c, 0xf9f0, 0xfc64, 0xfdf8, 0x006c}},
9746                                 {{0x8303'1300, 0x8707'1b08, 0x8b0b'2311, 0x8f0f'2b18},
9747                                  {0x9313'1321, 0x9717'1b28, 0x9b1b'2330, 0x9f1f'2b38},
9748                                  {0xa323'5340, 0xa727'5b48, 0xab2b'6351, 0xaf2f'6b58},
9749                                  {0xb333'5361, 0xb737'5b68, 0xbb3b'6370, 0xbf3f'6b78},
9750                                  {0xc343'9380, 0xc747'9b88, 0xcb4b'a391, 0xcf4f'ab98},
9751                                  {0xd353'93a1, 0xd757'9ba8, 0xdb5b'a3b0, 0xdf5f'abb8},
9752                                  {0xe363'd3c0, 0xe767'dbc8, 0xeb6b'e3d1, 0xef6f'ebd8},
9753                                  {0xf373'd3e1, 0xf777'dbe8, 0xfb7b'e3f0, 0xff7f'ebf8}},
9754                                 {{0x8706'8505'1907'1300, 0x8f0e'8d0d'2917'2311},
9755                                  {0x9716'9515'1927'1321, 0x9f1e'9d1d'2937'2330},
9756                                  {0xa726'a525'5947'5340, 0xaf2e'ad2d'6957'6351},
9757                                  {0xb736'b535'5967'5361, 0xbf3e'bd3d'6977'6370},
9758                                  {0xc746'c545'9987'9380, 0xcf4e'cd4d'a997'a391},
9759                                  {0xd756'd555'99a7'93a1, 0xdf5e'dd5d'a9b7'a3b0},
9760                                  {0xe766'e565'd9c7'd3c0, 0xef6e'ed6d'e9d7'e3d1},
9761                                  {0xf776'f575'd9e7'd3e1, 0xff7e'fd7d'e9f7'e3f0}},
9762                                 kVectorCalculationsSource);
9763 }
9764 
ExecVwadduwx()9765 [[gnu::naked]] void ExecVwadduwx() {
9766   asm("vwaddu.wx v8, v16, t0\n\t"
9767       "ret\n\t");
9768 }
9769 
ExecMaskedVwadduwx()9770 [[gnu::naked]] void ExecMaskedVwadduwx() {
9771   asm("vwaddu.wx v8, v16, t0, v0.t\n\t"
9772       "ret\n\t");
9773 }
9774 
TEST(InlineAsmTestRiscv64,TestVwadduwx)9775 TEST(InlineAsmTestRiscv64, TestVwadduwx) {
9776   TestWideningVectorInstruction(ExecVwadduwx,
9777                                 ExecMaskedVwadduwx,
9778                                 {{0x81aa, 0x83ac, 0x85ae, 0x87b0, 0x89b2, 0x8bb4, 0x8db6, 0x8fb8},
9779                                  {0x91ba, 0x93bc, 0x95be, 0x97c0, 0x99c2, 0x9bc4, 0x9dc6, 0x9fc8},
9780                                  {0xa1ca, 0xa3cc, 0xa5ce, 0xa7d0, 0xa9d2, 0xabd4, 0xadd6, 0xafd8},
9781                                  {0xb1da, 0xb3dc, 0xb5de, 0xb7e0, 0xb9e2, 0xbbe4, 0xbde6, 0xbfe8},
9782                                  {0xc1ea, 0xc3ec, 0xc5ee, 0xc7f0, 0xc9f2, 0xcbf4, 0xcdf6, 0xcff8},
9783                                  {0xd1fa, 0xd3fc, 0xd5fe, 0xd800, 0xda02, 0xdc04, 0xde06, 0xe008},
9784                                  {0xe20a, 0xe40c, 0xe60e, 0xe810, 0xea12, 0xec14, 0xee16, 0xf018},
9785                                  {0xf21a, 0xf41c, 0xf61e, 0xf820, 0xfa22, 0xfc24, 0xfe26, 0x0028}},
9786                                 {{0x8303'2baa, 0x8707'2fae, 0x8b0b'33b2, 0x8f0f'37b6},
9787                                  {0x9313'3bba, 0x9717'3fbe, 0x9b1b'43c2, 0x9f1f'47c6},
9788                                  {0xa323'4bca, 0xa727'4fce, 0xab2b'53d2, 0xaf2f'57d6},
9789                                  {0xb333'5bda, 0xb737'5fde, 0xbb3b'63e2, 0xbf3f'67e6},
9790                                  {0xc343'6bea, 0xc747'6fee, 0xcb4b'73f2, 0xcf4f'77f6},
9791                                  {0xd353'7bfa, 0xd757'7ffe, 0xdb5b'8402, 0xdf5f'8806},
9792                                  {0xe363'8c0a, 0xe767'900e, 0xeb6b'9412, 0xef6f'9816},
9793                                  {0xf373'9c1a, 0xf777'a01e, 0xfb7b'a422, 0xff7f'a826}},
9794                                 {{0x8706'8505'2dad'2baa, 0x8f0e'8d0d'35b5'33b2},
9795                                  {0x9716'9515'3dbd'3bba, 0x9f1e'9d1d'45c5'43c2},
9796                                  {0xa726'a525'4dcd'4bca, 0xaf2e'ad2d'55d5'53d2},
9797                                  {0xb736'b535'5ddd'5bda, 0xbf3e'bd3d'65e5'63e2},
9798                                  {0xc746'c545'6ded'6bea, 0xcf4e'cd4d'75f5'73f2},
9799                                  {0xd756'd555'7dfd'7bfa, 0xdf5e'dd5d'8605'8402},
9800                                  {0xe766'e565'8e0d'8c0a, 0xef6e'ed6d'9615'9412},
9801                                  {0xf776'f575'9e1d'9c1a, 0xff7e'fd7d'a625'a422}},
9802                                 kVectorCalculationsSource);
9803 }
9804 
ExecVwaddvx()9805 [[gnu::naked]] void ExecVwaddvx() {
9806   asm("vwadd.vx  v8, v16, t0\n\t"
9807       "ret\n\t");
9808 }
9809 
ExecMaskedVwaddvx()9810 [[gnu::naked]] void ExecMaskedVwaddvx() {
9811   asm("vwadd.vx  v8, v16, t0, v0.t\n\t"
9812       "ret\n\t");
9813 }
9814 
TEST(InlineAsmTestRiscv64,TestVwaddvx)9815 TEST(InlineAsmTestRiscv64, TestVwaddvx) {
9816   TestWideningVectorInstruction(ExecVwaddvx,
9817                                 ExecMaskedVwaddvx,
9818                                 {{0xffaa, 0xff2b, 0xffac, 0xff2d, 0xffae, 0xff2f, 0xffb0, 0xff31},
9819                                  {0xffb2, 0xff33, 0xffb4, 0xff35, 0xffb6, 0xff37, 0xffb8, 0xff39},
9820                                  {0xffba, 0xff3b, 0xffbc, 0xff3d, 0xffbe, 0xff3f, 0xffc0, 0xff41},
9821                                  {0xffc2, 0xff43, 0xffc4, 0xff45, 0xffc6, 0xff47, 0xffc8, 0xff49},
9822                                  {0xffca, 0xff4b, 0xffcc, 0xff4d, 0xffce, 0xff4f, 0xffd0, 0xff51},
9823                                  {0xffd2, 0xff53, 0xffd4, 0xff55, 0xffd6, 0xff57, 0xffd8, 0xff59},
9824                                  {0xffda, 0xff5b, 0xffdc, 0xff5d, 0xffde, 0xff5f, 0xffe0, 0xff61},
9825                                  {0xffe2, 0xff63, 0xffe4, 0xff65, 0xffe6, 0xff67, 0xffe8, 0xff69}},
9826                                 {{0xffff'2baa, 0xffff'2dac, 0xffff'2fae, 0xffff'31b0},
9827                                  {0xffff'33b2, 0xffff'35b4, 0xffff'37b6, 0xffff'39b8},
9828                                  {0xffff'3bba, 0xffff'3dbc, 0xffff'3fbe, 0xffff'41c0},
9829                                  {0xffff'43c2, 0xffff'45c4, 0xffff'47c6, 0xffff'49c8},
9830                                  {0xffff'4bca, 0xffff'4dcc, 0xffff'4fce, 0xffff'51d0},
9831                                  {0xffff'53d2, 0xffff'55d4, 0xffff'57d6, 0xffff'59d8},
9832                                  {0xffff'5bda, 0xffff'5ddc, 0xffff'5fde, 0xffff'61e0},
9833                                  {0xffff'63e2, 0xffff'65e4, 0xffff'67e6, 0xffff'69e8}},
9834                                 {{0xffff'ffff'2dad'2baa, 0xffff'ffff'31b1'2fae},
9835                                  {0xffff'ffff'35b5'33b2, 0xffff'ffff'39b9'37b6},
9836                                  {0xffff'ffff'3dbd'3bba, 0xffff'ffff'41c1'3fbe},
9837                                  {0xffff'ffff'45c5'43c2, 0xffff'ffff'49c9'47c6},
9838                                  {0xffff'ffff'4dcd'4bca, 0xffff'ffff'51d1'4fce},
9839                                  {0xffff'ffff'55d5'53d2, 0xffff'ffff'59d9'57d6},
9840                                  {0xffff'ffff'5ddd'5bda, 0xffff'ffff'61e1'5fde},
9841                                  {0xffff'ffff'65e5'63e2, 0xffff'ffff'69e9'67e6}},
9842                                 kVectorCalculationsSource);
9843 }
9844 
ExecVwaddwv()9845 [[gnu::naked]] void ExecVwaddwv() {
9846   asm("vwadd.wv  v8, v16, v24\n\t"
9847       "ret\n\t");
9848 }
9849 
ExecMaskedVwaddwv()9850 [[gnu::naked]] void ExecMaskedVwaddwv() {
9851   asm("vwadd.wv  v8, v16, v24, v0.t\n\t"
9852       "ret\n\t");
9853 }
9854 
TEST(InlineAsmTestRiscv64,TestVwaddwv)9855 TEST(InlineAsmTestRiscv64, TestVwaddwv) {
9856   TestWideningVectorInstruction(ExecVwaddwv,
9857                                 ExecMaskedVwaddwv,
9858                                 {{0x8100, 0x8294, 0x8508, 0x869c, 0x8911, 0x8aa4, 0x8d18, 0x8eac},
9859                                  {0x9121, 0x9294, 0x9528, 0x969c, 0x9930, 0x9aa4, 0x9d38, 0x9eac},
9860                                  {0xa140, 0xa2d4, 0xa548, 0xa6dc, 0xa951, 0xaae4, 0xad58, 0xaeec},
9861                                  {0xb161, 0xb2d4, 0xb568, 0xb6dc, 0xb970, 0xbae4, 0xbd78, 0xbeec},
9862                                  {0xc180, 0xc314, 0xc588, 0xc71c, 0xc991, 0xcb24, 0xcd98, 0xcf2c},
9863                                  {0xd1a1, 0xd314, 0xd5a8, 0xd71c, 0xd9b0, 0xdb24, 0xddb8, 0xdf2c},
9864                                  {0xe1c0, 0xe354, 0xe5c8, 0xe75c, 0xe9d1, 0xeb64, 0xedd8, 0xef6c},
9865                                  {0xf1e1, 0xf354, 0xf5e8, 0xf75c, 0xf9f0, 0xfb64, 0xfdf8, 0xff6c}},
9866                                 {{0x8302'1300, 0x8706'1b08, 0x8b0a'2311, 0x8f0e'2b18},
9867                                  {0x9312'1321, 0x9716'1b28, 0x9b1a'2330, 0x9f1e'2b38},
9868                                  {0xa322'5340, 0xa726'5b48, 0xab2a'6351, 0xaf2e'6b58},
9869                                  {0xb332'5361, 0xb736'5b68, 0xbb3a'6370, 0xbf3e'6b78},
9870                                  {0xc342'9380, 0xc746'9b88, 0xcb4a'a391, 0xcf4e'ab98},
9871                                  {0xd352'93a1, 0xd756'9ba8, 0xdb5a'a3b0, 0xdf5e'abb8},
9872                                  {0xe362'd3c0, 0xe766'dbc8, 0xeb6a'e3d1, 0xef6e'ebd8},
9873                                  {0xf372'd3e1, 0xf776'dbe8, 0xfb7a'e3f0, 0xff7e'ebf8}},
9874                                 {{0x8706'8504'1907'1300, 0x8f0e'8d0c'2917'2311},
9875                                  {0x9716'9514'1927'1321, 0x9f1e'9d1c'2937'2330},
9876                                  {0xa726'a524'5947'5340, 0xaf2e'ad2c'6957'6351},
9877                                  {0xb736'b534'5967'5361, 0xbf3e'bd3c'6977'6370},
9878                                  {0xc746'c544'9987'9380, 0xcf4e'cd4c'a997'a391},
9879                                  {0xd756'd554'99a7'93a1, 0xdf5e'dd5c'a9b7'a3b0},
9880                                  {0xe766'e564'd9c7'd3c0, 0xef6e'ed6c'e9d7'e3d1},
9881                                  {0xf776'f574'd9e7'd3e1, 0xff7e'fd7c'e9f7'e3f0}},
9882                                 kVectorCalculationsSource);
9883 }
9884 
ExecVwaddwx()9885 [[gnu::naked]] void ExecVwaddwx() {
9886   asm("vwadd.wx  v8, v16, t0\n\t"
9887       "ret\n\t");
9888 }
9889 
ExecMaskedVwaddwx()9890 [[gnu::naked]] void ExecMaskedVwaddwx() {
9891   asm("vwadd.wx  v8, v16, t0, v0.t\n\t"
9892       "ret\n\t");
9893 }
9894 
TEST(InlineAsmTestRiscv64,TestVwaddwx)9895 TEST(InlineAsmTestRiscv64, TestVwaddwx) {
9896   TestWideningVectorInstruction(ExecVwaddwx,
9897                                 ExecMaskedVwaddwx,
9898                                 {{0x80aa, 0x82ac, 0x84ae, 0x86b0, 0x88b2, 0x8ab4, 0x8cb6, 0x8eb8},
9899                                  {0x90ba, 0x92bc, 0x94be, 0x96c0, 0x98c2, 0x9ac4, 0x9cc6, 0x9ec8},
9900                                  {0xa0ca, 0xa2cc, 0xa4ce, 0xa6d0, 0xa8d2, 0xaad4, 0xacd6, 0xaed8},
9901                                  {0xb0da, 0xb2dc, 0xb4de, 0xb6e0, 0xb8e2, 0xbae4, 0xbce6, 0xbee8},
9902                                  {0xc0ea, 0xc2ec, 0xc4ee, 0xc6f0, 0xc8f2, 0xcaf4, 0xccf6, 0xcef8},
9903                                  {0xd0fa, 0xd2fc, 0xd4fe, 0xd700, 0xd902, 0xdb04, 0xdd06, 0xdf08},
9904                                  {0xe10a, 0xe30c, 0xe50e, 0xe710, 0xe912, 0xeb14, 0xed16, 0xef18},
9905                                  {0xf11a, 0xf31c, 0xf51e, 0xf720, 0xf922, 0xfb24, 0xfd26, 0xff28}},
9906                                 {{0x8302'2baa, 0x8706'2fae, 0x8b0a'33b2, 0x8f0e'37b6},
9907                                  {0x9312'3bba, 0x9716'3fbe, 0x9b1a'43c2, 0x9f1e'47c6},
9908                                  {0xa322'4bca, 0xa726'4fce, 0xab2a'53d2, 0xaf2e'57d6},
9909                                  {0xb332'5bda, 0xb736'5fde, 0xbb3a'63e2, 0xbf3e'67e6},
9910                                  {0xc342'6bea, 0xc746'6fee, 0xcb4a'73f2, 0xcf4e'77f6},
9911                                  {0xd352'7bfa, 0xd756'7ffe, 0xdb5a'8402, 0xdf5e'8806},
9912                                  {0xe362'8c0a, 0xe766'900e, 0xeb6a'9412, 0xef6e'9816},
9913                                  {0xf372'9c1a, 0xf776'a01e, 0xfb7a'a422, 0xff7e'a826}},
9914                                 {{0x8706'8504'2dad'2baa, 0x8f0e'8d0c'35b5'33b2},
9915                                  {0x9716'9514'3dbd'3bba, 0x9f1e'9d1c'45c5'43c2},
9916                                  {0xa726'a524'4dcd'4bca, 0xaf2e'ad2c'55d5'53d2},
9917                                  {0xb736'b534'5ddd'5bda, 0xbf3e'bd3c'65e5'63e2},
9918                                  {0xc746'c544'6ded'6bea, 0xcf4e'cd4c'75f5'73f2},
9919                                  {0xd756'd554'7dfd'7bfa, 0xdf5e'dd5c'8605'8402},
9920                                  {0xe766'e564'8e0d'8c0a, 0xef6e'ed6c'9615'9412},
9921                                  {0xf776'f574'9e1d'9c1a, 0xff7e'fd7c'a625'a422}},
9922                                 kVectorCalculationsSource);
9923 }
9924 
ExecVwmulvv()9925 [[gnu::naked]] void ExecVwmulvv() {
9926   asm("vwmul.vv  v8, v16, v24\n\t"
9927       "ret\n\t");
9928 }
9929 
ExecMaskedVwmulvv()9930 [[gnu::naked]] void ExecMaskedVwmulvv() {
9931   asm("vwmul.vv  v8, v16, v24, v0.t\n\t"
9932       "ret\n\t");
9933 }
9934 
TEST(InlineAsmTestRiscv64,TestVwmul)9935 TEST(InlineAsmTestRiscv64, TestVwmul) {
9936   TestWideningVectorInstruction(ExecVwmulvv,
9937                                 ExecMaskedVwmulvv,
9938                                 {{0x0000, 0x3692, 0x0008, 0x33c2, 0x0024, 0x3102, 0x0048, 0x2e52},
9939                                  {0x0088, 0x3a92, 0x00c8, 0x37c2, 0x0120, 0x3502, 0x0188, 0x3252},
9940                                  {0x0200, 0x21d2, 0x0288, 0x1f82, 0x0334, 0x1d42, 0x03c8, 0x1b12},
9941                                  {0x0498, 0x25d2, 0x0548, 0x2382, 0x0620, 0x2142, 0x0708, 0x1f12},
9942                                  {0x0800, 0x1112, 0x0908, 0x0f42, 0x0a44, 0x0d82, 0x0b48, 0x0bd2},
9943                                  {0x0ca8, 0x1512, 0x0dc8, 0x1342, 0x0f20, 0x1182, 0x1088, 0x0fd2},
9944                                  {0x1200, 0x0452, 0x1388, 0x0302, 0x1554, 0x01c2, 0x16c8, 0x0092},
9945                                  {0x18b8, 0x0852, 0x1a48, 0x0702, 0x1c20, 0x05c2, 0x1e08, 0x0492}},
9946                                 {{0x3692'0000, 0x33bf'3808, 0x30fc'1524, 0x2e4a'0848},
9947                                  {0x3a86'2988, 0x37b4'18c8, 0x34f1'b120, 0x323f'6988},
9948                                  {0x21bf'4200, 0x1f6d'7a88, 0x1d2b'6834, 0x1afa'4bc8},
9949                                  {0x25b5'7d98, 0x2364'5d48, 0x2122'f620, 0x1ef1'af08},
9950                                  {0x10f4'8800, 0x0f23'c108, 0x0d62'bf44, 0x0bb2'9348},
9951                                  {0x14ec'd5a8, 0x131c'a5c8, 0x115c'3f20, 0x0fab'f888},
9952                                  {0x0431'd200, 0x02e2'0b88, 0x01a2'1a54, 0x0072'dec8},
9953                                  {0x082c'31b8, 0x06dc'f248, 0x059d'8c20, 0x046e'4608}},
9954                                 {{0x33be'bb57'7192'0000, 0x2e49'8c98'5f6f'1524},
9955                                  {0x37b3'9c18'79e9'2988, 0x323e'eddb'56b5'b120},
9956                                  {0x1f6d'04e3'116f'4200, 0x1af9'd928'125e'6834},
9957                                  {0x2363'e7a8'2dd8'7d98, 0x1ef1'3c6e'fd96'f620},
9958                                  {0x0f23'5a7e'bd54'8800, 0x0bb2'31c7'd155'bf44},
9959                                  {0x131c'3f47'edcf'd5a8, 0x0fab'9712'b080'3f20},
9960                                  {0x02e1'bc2a'7541'd200, 0x0072'9677'9c55'1a54},
9961                                  {0x06dc'a2f7'b9cf'31b8, 0x046d'fdc6'6f71'8c20}},
9962                                 kVectorCalculationsSource);
9963 }
9964 
ExecVwmulsuvv()9965 [[gnu::naked]] void ExecVwmulsuvv() {
9966   asm("vwmulsu.vv  v8, v16, v24\n\t"
9967       "ret\n\t");
9968 }
9969 
ExecMaskedVwmulsuvv()9970 [[gnu::naked]] void ExecMaskedVwmulsuvv() {
9971   asm("vwmulsu.vv  v8, v16, v24, v0.t\n\t"
9972       "ret\n\t");
9973 }
9974 
TEST(InlineAsmTestRiscv64,TestVwmulsu)9975 TEST(InlineAsmTestRiscv64, TestVwmulsu) {
9976   TestWideningVectorInstruction(ExecVwmulsuvv,
9977                                 ExecMaskedVwmulsuvv,
9978                                 {{0x0000, 0xb792, 0x0008, 0xb6c2, 0x0024, 0xb602, 0x0048, 0xb552},
9979                                  {0x0088, 0xc392, 0x00c8, 0xc2c2, 0x0120, 0xc202, 0x0188, 0xc152},
9980                                  {0x0200, 0xb2d2, 0x0288, 0xb282, 0x0334, 0xb242, 0x03c8, 0xb212},
9981                                  {0x0498, 0xbed2, 0x0548, 0xbe82, 0x0620, 0xbe42, 0x0708, 0xbe12},
9982                                  {0x0800, 0xb212, 0x0908, 0xb242, 0x0a44, 0xb282, 0x0b48, 0xb2d2},
9983                                  {0x0ca8, 0xbe12, 0x0dc8, 0xbe42, 0x0f20, 0xbe82, 0x1088, 0xbed2},
9984                                  {0x1200, 0xb552, 0x1388, 0xb602, 0x1554, 0xb6c2, 0x16c8, 0xb792},
9985                                  {0x18b8, 0xc152, 0x1a48, 0xc202, 0x1c20, 0xc2c2, 0x1e08, 0xc392}},
9986                                 {{0xb792'0000, 0xb6c1'3808, 0xb600'1524, 0xb550'0848},
9987                                  {0xc38e'2988, 0xc2be'18c8, 0xc1fd'b120, 0xc14d'6988},
9988                                  {0xb2cf'4200, 0xb27f'7a88, 0xb23f'6834, 0xb210'4bc8},
9989                                  {0xbecd'7d98, 0xbe7e'5d48, 0xbe3e'f620, 0xbe0f'af08},
9990                                  {0xb214'8800, 0xb245'c108, 0xb286'bf44, 0xb2d8'9348},
9991                                  {0xbe14'd5a8, 0xbe46'a5c8, 0xbe88'3f20, 0xbed9'f888},
9992                                  {0xb561'd200, 0xb614'0b88, 0xb6d6'1a54, 0xb7a8'dec8},
9993                                  {0xc164'31b8, 0xc216'f248, 0xc2d9'8c20, 0xc3ac'4608}},
9994                                 {{0xb6c1'3c57'7192'0000, 0xb550'119c'5f6f'1524},
9995                                  {0xc2be'2520'79e9'2988, 0xc14d'7ae7'56b5'b120},
9996                                  {0xb27f'95f3'116f'4200, 0xb210'6e3c'125e'6834},
9997                                  {0xbe7e'80c0'2dd8'7d98, 0xbe0f'd98a'fd96'f620},
9998                                  {0xb245'fb9e'bd54'8800, 0xb2d8'd6eb'd155'bf44},
9999                                  {0xbe46'e86f'edcf'd5a8, 0xbeda'443e'b080'3f20},
10000                                  {0xb614'6d5a'7541'd200, 0xb7a9'4bab'9c55'1a54},
10001                                  {0xc217'5c2f'b9cf'31b8, 0xc3ac'bb02'6f71'8c20}},
10002                                 kVectorCalculationsSource);
10003 }
10004 
ExecVwmulsuvx()10005 [[gnu::naked]] void ExecVwmulsuvx() {
10006   asm("vwmulsu.vx  v8, v16, t0\n\t"
10007       "ret\n\t");
10008 }
10009 
ExecMaskedVwmulsuvx()10010 [[gnu::naked]] void ExecMaskedVwmulsuvx() {
10011   asm("vwmulsu.vx  v8, v16, t0, v0.t\n\t"
10012       "ret\n\t");
10013 }
10014 
TEST(InlineAsmTestRiscv64,TestVwmulsuvx)10015 TEST(InlineAsmTestRiscv64, TestVwmulsuvx) {
10016   TestWideningVectorInstruction(ExecVwmulsuvx,
10017                                 ExecMaskedVwmulsuvx,
10018                                 {{0x0000, 0xabaa, 0x0154, 0xacfe, 0x02a8, 0xae52, 0x03fc, 0xafa6},
10019                                  {0x0550, 0xb0fa, 0x06a4, 0xb24e, 0x07f8, 0xb3a2, 0x094c, 0xb4f6},
10020                                  {0x0aa0, 0xb64a, 0x0bf4, 0xb79e, 0x0d48, 0xb8f2, 0x0e9c, 0xba46},
10021                                  {0x0ff0, 0xbb9a, 0x1144, 0xbcee, 0x1298, 0xbe42, 0x13ec, 0xbf96},
10022                                  {0x1540, 0xc0ea, 0x1694, 0xc23e, 0x17e8, 0xc392, 0x193c, 0xc4e6},
10023                                  {0x1a90, 0xc63a, 0x1be4, 0xc78e, 0x1d38, 0xc8e2, 0x1e8c, 0xca36},
10024                                  {0x1fe0, 0xcb8a, 0x2134, 0xccde, 0x2288, 0xce32, 0x23dc, 0xcf86},
10025                                  {0x2530, 0xd0da, 0x2684, 0xd22e, 0x27d8, 0xd382, 0x292c, 0xd4d6}},
10026                                 {{0xab55'aa00, 0xacac'5354, 0xae02'fca8, 0xaf59'a5fc},
10027                                  {0xb0b0'4f50, 0xb206'f8a4, 0xb35d'a1f8, 0xb4b4'4b4c},
10028                                  {0xb60a'f4a0, 0xb761'9df4, 0xb8b8'4748, 0xba0e'f09c},
10029                                  {0xbb65'99f0, 0xbcbc'4344, 0xbe12'ec98, 0xbf69'95ec},
10030                                  {0xc0c0'3f40, 0xc216'e894, 0xc36d'91e8, 0xc4c4'3b3c},
10031                                  {0xc61a'e490, 0xc771'8de4, 0xc8c8'3738, 0xca1e'e08c},
10032                                  {0xcb75'89e0, 0xcccc'3334, 0xce22'dc88, 0xcf79'85dc},
10033                                  {0xd0d0'2f30, 0xd226'd884, 0xd37d'81d8, 0xd4d4'2b2c}},
10034                                 {{0xacac'5600'5353'aa00, 0xaf59'ae02'fb50'fca8},
10035                                  {0xb207'0605'a34e'4f50, 0xb4b4'5e08'4b4b'a1f8},
10036                                  {0xb761'b60a'f348'f4a0, 0xba0f'0e0d'9b46'4748},
10037                                  {0xbcbc'6610'4343'99f0, 0xbf69'be12'eb40'ec98},
10038                                  {0xc217'1615'933e'3f40, 0xc4c4'6e18'3b3b'91e8},
10039                                  {0xc771'c61a'e338'e490, 0xca1f'1e1d'8b36'3738},
10040                                  {0xcccc'7620'3333'89e0, 0xcf79'ce22'db30'dc88},
10041                                  {0xd227'2625'832e'2f30, 0xd4d4'7e28'2b2b'81d8}},
10042                                 kVectorCalculationsSource);
10043 }
10044 
ExecVwmuluvv()10045 [[gnu::naked]] void ExecVwmuluvv() {
10046   asm("vwmulu.vv  v8, v16, v24\n\t"
10047       "ret\n\t");
10048 }
10049 
ExecMaskedVwmuluvv()10050 [[gnu::naked]] void ExecMaskedVwmuluvv() {
10051   asm("vwmulu.vv  v8, v16, v24, v0.t\n\t"
10052       "ret\n\t");
10053 }
10054 
TEST(InlineAsmTestRiscv64,TestVwmulu)10055 TEST(InlineAsmTestRiscv64, TestVwmulu) {
10056   TestWideningVectorInstruction(ExecVwmuluvv,
10057                                 ExecMaskedVwmuluvv,
10058                                 {{0x0000, 0x4992, 0x0008, 0x4cc2, 0x0024, 0x5002, 0x0048, 0x5352},
10059                                  {0x0088, 0x4592, 0x00c8, 0x48c2, 0x0120, 0x4c02, 0x0188, 0x4f52},
10060                                  {0x0200, 0x64d2, 0x0288, 0x6882, 0x0334, 0x6c42, 0x03c8, 0x7012},
10061                                  {0x0498, 0x60d2, 0x0548, 0x6482, 0x0620, 0x6842, 0x0708, 0x6c12},
10062                                  {0x0800, 0x8412, 0x0908, 0x8842, 0x0a44, 0x8c82, 0x0b48, 0x90d2},
10063                                  {0x0ca8, 0x8012, 0x0dc8, 0x8442, 0x0f20, 0x8882, 0x1088, 0x8cd2},
10064                                  {0x1200, 0xa752, 0x1388, 0xac02, 0x1554, 0xb0c2, 0x16c8, 0xb592},
10065                                  {0x18b8, 0xa352, 0x1a48, 0xa802, 0x1c20, 0xacc2, 0x1e08, 0xb192}},
10066                                 {{0x4992'0000, 0x4cc5'3808, 0x5009'1524, 0x535c'0848},
10067                                  {0x459f'2988, 0x48d2'18c8, 0x4c15'b120, 0x4f69'6988},
10068                                  {0x64ef'4200, 0x68a3'7a88, 0x6c68'6834, 0x703c'4bc8},
10069                                  {0x60fe'7d98, 0x64b2'5d48, 0x6876'f620, 0x6c4b'af08},
10070                                  {0x8454'8800, 0x8889'c108, 0x8ccf'bf44, 0x9124'9348},
10071                                  {0x8065'd5a8, 0x849a'a5c8, 0x88e0'3f20, 0x8d35'f888},
10072                                  {0xa7c1'd200, 0xac78'0b88, 0xb13f'1a54, 0xb614'dec8},
10073                                  {0xa3d5'31b8, 0xa88a'f248, 0xad51'8c20, 0xb228'4608}},
10074                                 {{0x4cc5'ce57'7192'0000, 0x535c'aba5'5f6f'1524},
10075                                  {0x48d2'a731'79e9'2988, 0x4f6a'04ff'56b5'b120},
10076                                  {0x68a4'4813'116f'4200, 0x703d'2865'125e'6834},
10077                                  {0x64b3'22f1'2dd8'7d98, 0x6c4c'83c2'fd96'f620},
10078                                  {0x888a'cdde'bd54'8800, 0x9125'b134'd155'bf44},
10079                                  {0x849b'aac0'edcf'd5a8, 0x8d37'0e96'b080'3f20},
10080                                  {0xac79'5fba'7541'd200, 0xb616'4614'9c55'1a54},
10081                                  {0xa88c'3ea0'b9cf'31b8, 0xb229'a57a'6f71'8c20}},
10082                                 kVectorCalculationsSource);
10083 }
10084 
ExecVwmuluvx()10085 [[gnu::naked]] void ExecVwmuluvx() {
10086   asm("vwmulu.vx  v8, v16, t0\n\t"
10087       "ret\n\t");
10088 }
10089 
ExecMaskedVwmuluvx()10090 [[gnu::naked]] void ExecMaskedVwmuluvx() {
10091   asm("vwmulu.vx  v8, v16, t0, v0.t\n\t"
10092       "ret\n\t");
10093 }
10094 
TEST(InlineAsmTestRiscv64,TestVwmuluvx)10095 TEST(InlineAsmTestRiscv64, TestVwmuluvx) {
10096   TestWideningVectorInstruction(ExecVwmuluvx,
10097                                 ExecMaskedVwmuluvx,
10098                                 {{0x0000, 0x55aa, 0x0154, 0x56fe, 0x02a8, 0x5852, 0x03fc, 0x59a6},
10099                                  {0x0550, 0x5afa, 0x06a4, 0x5c4e, 0x07f8, 0x5da2, 0x094c, 0x5ef6},
10100                                  {0x0aa0, 0x604a, 0x0bf4, 0x619e, 0x0d48, 0x62f2, 0x0e9c, 0x6446},
10101                                  {0x0ff0, 0x659a, 0x1144, 0x66ee, 0x1298, 0x6842, 0x13ec, 0x6996},
10102                                  {0x1540, 0x6aea, 0x1694, 0x6c3e, 0x17e8, 0x6d92, 0x193c, 0x6ee6},
10103                                  {0x1a90, 0x703a, 0x1be4, 0x718e, 0x1d38, 0x72e2, 0x1e8c, 0x7436},
10104                                  {0x1fe0, 0x758a, 0x2134, 0x76de, 0x2288, 0x7832, 0x23dc, 0x7986},
10105                                  {0x2530, 0x7ada, 0x2684, 0x7c2e, 0x27d8, 0x7d82, 0x292c, 0x7ed6}},
10106                                 {{0x55ff'aa00, 0x5756'5354, 0x58ac'fca8, 0x5a03'a5fc},
10107                                  {0x5b5a'4f50, 0x5cb0'f8a4, 0x5e07'a1f8, 0x5f5e'4b4c},
10108                                  {0x60b4'f4a0, 0x620b'9df4, 0x6362'4748, 0x64b8'f09c},
10109                                  {0x660f'99f0, 0x6766'4344, 0x68bc'ec98, 0x6a13'95ec},
10110                                  {0x6b6a'3f40, 0x6cc0'e894, 0x6e17'91e8, 0x6f6e'3b3c},
10111                                  {0x70c4'e490, 0x721b'8de4, 0x7372'3738, 0x74c8'e08c},
10112                                  {0x761f'89e0, 0x7776'3334, 0x78cc'dc88, 0x7a23'85dc},
10113                                  {0x7b7a'2f30, 0x7cd0'd884, 0x7e27'81d8, 0x7f7e'2b2c}},
10114                                 {{0x5757'00aa'5353'aa00, 0x5a04'58ac'fb50'fca8},
10115                                  {0x5cb1'b0af'a34e'4f50, 0x5f5f'08b2'4b4b'a1f8},
10116                                  {0x620c'60b4'f348'f4a0, 0x64b9'b8b7'9b46'4748},
10117                                  {0x6767'10ba'4343'99f0, 0x6a14'68bc'eb40'ec98},
10118                                  {0x6cc1'c0bf'933e'3f40, 0x6f6f'18c2'3b3b'91e8},
10119                                  {0x721c'70c4'e338'e490, 0x74c9'c8c7'8b36'3738},
10120                                  {0x7777'20ca'3333'89e0, 0x7a24'78cc'db30'dc88},
10121                                  {0x7cd1'd0cf'832e'2f30, 0x7f7f'28d2'2b2b'81d8}},
10122                                 kVectorCalculationsSource);
10123 }
10124 
ExecVwmulvx()10125 [[gnu::naked]] void ExecVwmulvx() {
10126   asm("vwmul.vx  v8, v16, t0\n\t"
10127       "ret\n\t");
10128 }
10129 
ExecMaskedVwmulvx()10130 [[gnu::naked]] void ExecMaskedVwmulvx() {
10131   asm("vwmul.vx  v8, v16, t0, v0.t\n\t"
10132       "ret\n\t");
10133 }
10134 
TEST(InlineAsmTestRiscv64,TestVwmulvx)10135 TEST(InlineAsmTestRiscv64, TestVwmulvx) {
10136   TestWideningVectorInstruction(ExecVwmulvx,
10137                                 ExecMaskedVwmulvx,
10138                                 {{0x0000, 0x2aaa, 0xff54, 0x29fe, 0xfea8, 0x2952, 0xfdfc, 0x28a6},
10139                                  {0xfd50, 0x27fa, 0xfca4, 0x274e, 0xfbf8, 0x26a2, 0xfb4c, 0x25f6},
10140                                  {0xfaa0, 0x254a, 0xf9f4, 0x249e, 0xf948, 0x23f2, 0xf89c, 0x2346},
10141                                  {0xf7f0, 0x229a, 0xf744, 0x21ee, 0xf698, 0x2142, 0xf5ec, 0x2096},
10142                                  {0xf540, 0x1fea, 0xf494, 0x1f3e, 0xf3e8, 0x1e92, 0xf33c, 0x1de6},
10143                                  {0xf290, 0x1d3a, 0xf1e4, 0x1c8e, 0xf138, 0x1be2, 0xf08c, 0x1b36},
10144                                  {0xefe0, 0x1a8a, 0xef34, 0x19de, 0xee88, 0x1932, 0xeddc, 0x1886},
10145                                  {0xed30, 0x17da, 0xec84, 0x172e, 0xebd8, 0x1682, 0xeb2c, 0x15d6}},
10146                                 {{0x2a55'aa00, 0x29aa'5354, 0x28fe'fca8, 0x2853'a5fc},
10147                                  {0x27a8'4f50, 0x26fc'f8a4, 0x2651'a1f8, 0x25a6'4b4c},
10148                                  {0x24fa'f4a0, 0x244f'9df4, 0x23a4'4748, 0x22f8'f09c},
10149                                  {0x224d'99f0, 0x21a2'4344, 0x20f6'ec98, 0x204b'95ec},
10150                                  {0x1fa0'3f40, 0x1ef4'e894, 0x1e49'91e8, 0x1d9e'3b3c},
10151                                  {0x1cf2'e490, 0x1c47'8de4, 0x1b9c'3738, 0x1af0'e08c},
10152                                  {0x1a45'89e0, 0x199a'3334, 0x18ee'dc88, 0x1843'85dc},
10153                                  {0x1798'2f30, 0x16ec'd884, 0x1641'81d8, 0x1596'2b2c}},
10154                                 {{0x29a9'd500'5353'aa00, 0x2853'28fe'fb50'fca8},
10155                                  {0x26fc'7cfd'a34e'4f50, 0x25a5'd0fc'4b4b'a1f8},
10156                                  {0x244f'24fa'f348'f4a0, 0x22f8'78f9'9b46'4748},
10157                                  {0x21a1'ccf8'4343'99f0, 0x204b'20f6'eb40'ec98},
10158                                  {0x1ef4'74f5'933e'3f40, 0x1d9d'c8f4'3b3b'91e8},
10159                                  {0x1c47'1cf2'e338'e490, 0x1af0'70f1'8b36'3738},
10160                                  {0x1999'c4f0'3333'89e0, 0x1843'18ee'db30'dc88},
10161                                  {0x16ec'6ced'832e'2f30, 0x1595'c0ec'2b2b'81d8}},
10162                                 kVectorCalculationsSource);
10163 }
10164 
ExecVwsubuvv()10165 [[gnu::naked]] void ExecVwsubuvv() {
10166   asm("vwsubu.vv  v8, v16, v24\n\t"
10167       "ret\n\t");
10168 }
10169 
ExecMaskedVwsubuvv()10170 [[gnu::naked]] void ExecMaskedVwsubuvv() {
10171   asm("vwsubu.vv  v8, v16, v24, v0.t\n\t"
10172       "ret\n\t");
10173 }
10174 
TEST(InlineAsmTestRiscv64,TestVwsubuvv)10175 TEST(InlineAsmTestRiscv64, TestVwsubuvv) {
10176   TestWideningVectorInstruction(ExecVwsubuvv,
10177                                 ExecMaskedVwsubuvv,
10178                                 {{0x0000, 0xffef, 0xfffe, 0xffed, 0xfffb, 0xffeb, 0xfffa, 0xffe9},
10179                                  {0xfff7, 0x0007, 0xfff6, 0x0005, 0xfff4, 0x0003, 0xfff2, 0x0001},
10180                                  {0xfff0, 0xffdf, 0xffee, 0xffdd, 0xffeb, 0xffdb, 0xffea, 0xffd9},
10181                                  {0xffe7, 0xfff7, 0xffe6, 0xfff5, 0xffe4, 0xfff3, 0xffe2, 0xfff1},
10182                                  {0xffe0, 0xffcf, 0xffde, 0xffcd, 0xffdb, 0xffcb, 0xffda, 0xffc9},
10183                                  {0xffd7, 0xffe7, 0xffd6, 0xffe5, 0xffd4, 0xffe3, 0xffd2, 0xffe1},
10184                                  {0xffd0, 0xffbf, 0xffce, 0xffbd, 0xffcb, 0xffbb, 0xffca, 0xffb9},
10185                                  {0xffc7, 0xffd7, 0xffc6, 0xffd5, 0xffc4, 0xffd3, 0xffc2, 0xffd1}},
10186                                 {{0xffff'ef00, 0xffff'ecfe, 0xffff'eafb, 0xffff'e8fa},
10187                                  {0x0000'06f7, 0x0000'04f6, 0x0000'02f4, 0x0000'00f2},
10188                                  {0xffff'def0, 0xffff'dcee, 0xffff'daeb, 0xffff'd8ea},
10189                                  {0xffff'f6e7, 0xffff'f4e6, 0xffff'f2e4, 0xffff'f0e2},
10190                                  {0xffff'cee0, 0xffff'ccde, 0xffff'cadb, 0xffff'c8da},
10191                                  {0xffff'e6d7, 0xffff'e4d6, 0xffff'e2d4, 0xffff'e0d2},
10192                                  {0xffff'bed0, 0xffff'bcce, 0xffff'bacb, 0xffff'b8ca},
10193                                  {0xffff'd6c7, 0xffff'd4c6, 0xffff'd2c4, 0xffff'd0c2}},
10194                                 {{0xffff'ffff'ecfd'ef00, 0xffff'ffff'e8f9'eafb},
10195                                  {0x0000'0000'04f6'06f7, 0x0000'0000'00f2'02f4},
10196                                  {0xffff'ffff'dced'def0, 0xffff'ffff'd8e9'daeb},
10197                                  {0xffff'ffff'f4e5'f6e7, 0xffff'ffff'f0e1'f2e4},
10198                                  {0xffff'ffff'ccdd'cee0, 0xffff'ffff'c8d9'cadb},
10199                                  {0xffff'ffff'e4d5'e6d7, 0xffff'ffff'e0d1'e2d4},
10200                                  {0xffff'ffff'bccd'bed0, 0xffff'ffff'b8c9'bacb},
10201                                  {0xffff'ffff'd4c5'd6c7, 0xffff'ffff'd0c1'd2c4}},
10202                                 kVectorCalculationsSource);
10203 }
10204 
ExecVwsubuvx()10205 [[gnu::naked]] void ExecVwsubuvx() {
10206   asm("vwsubu.vx  v8, v16, t0\n\t"
10207       "ret\n\t");
10208 }
10209 
ExecMaskedVwsubuvx()10210 [[gnu::naked]] void ExecMaskedVwsubuvx() {
10211   asm("vwsubu.vx  v8, v16, t0, v0.t\n\t"
10212       "ret\n\t");
10213 }
10214 
TEST(InlineAsmTestRiscv64,TestVwsubuvx)10215 TEST(InlineAsmTestRiscv64, TestVwsubuvx) {
10216   TestWideningVectorInstruction(ExecVwsubuvx,
10217                                 ExecMaskedVwsubuvx,
10218                                 {{0xff56, 0xffd7, 0xff58, 0xffd9, 0xff5a, 0xffdb, 0xff5c, 0xffdd},
10219                                  {0xff5e, 0xffdf, 0xff60, 0xffe1, 0xff62, 0xffe3, 0xff64, 0xffe5},
10220                                  {0xff66, 0xffe7, 0xff68, 0xffe9, 0xff6a, 0xffeb, 0xff6c, 0xffed},
10221                                  {0xff6e, 0xffef, 0xff70, 0xfff1, 0xff72, 0xfff3, 0xff74, 0xfff5},
10222                                  {0xff76, 0xfff7, 0xff78, 0xfff9, 0xff7a, 0xfffb, 0xff7c, 0xfffd},
10223                                  {0xff7e, 0xffff, 0xff80, 0x0001, 0xff82, 0x0003, 0xff84, 0x0005},
10224                                  {0xff86, 0x0007, 0xff88, 0x0009, 0xff8a, 0x000b, 0xff8c, 0x000d},
10225                                  {0xff8e, 0x000f, 0xff90, 0x0011, 0xff92, 0x0013, 0xff94, 0x0015}},
10226                                 {{0xffff'd656, 0xffff'd858, 0xffff'da5a, 0xffff'dc5c},
10227                                  {0xffff'de5e, 0xffff'e060, 0xffff'e262, 0xffff'e464},
10228                                  {0xffff'e666, 0xffff'e868, 0xffff'ea6a, 0xffff'ec6c},
10229                                  {0xffff'ee6e, 0xffff'f070, 0xffff'f272, 0xffff'f474},
10230                                  {0xffff'f676, 0xffff'f878, 0xffff'fa7a, 0xffff'fc7c},
10231                                  {0xffff'fe7e, 0x0000'0080, 0x0000'0282, 0x0000'0484},
10232                                  {0x0000'0686, 0x0000'0888, 0x0000'0a8a, 0x0000'0c8c},
10233                                  {0x0000'0e8e, 0x0000'1090, 0x0000'1292, 0x0000'1494}},
10234                                 {{0xffff'ffff'd857'd656, 0xffff'ffff'dc5b'da5a},
10235                                  {0xffff'ffff'e05f'de5e, 0xffff'ffff'e463'e262},
10236                                  {0xffff'ffff'e867'e666, 0xffff'ffff'ec6b'ea6a},
10237                                  {0xffff'ffff'f06f'ee6e, 0xffff'ffff'f473'f272},
10238                                  {0xffff'ffff'f877'f676, 0xffff'ffff'fc7b'fa7a},
10239                                  {0x0000'0000'007f'fe7e, 0x0000'0000'0484'0282},
10240                                  {0x0000'0000'0888'0686, 0x0000'0000'0c8c'0a8a},
10241                                  {0x0000'0000'1090'0e8e, 0x0000'0000'1494'1292}},
10242                                 kVectorCalculationsSource);
10243 }
10244 
ExecVwsubuwv()10245 [[gnu::naked]] void ExecVwsubuwv() {
10246   asm("vwsubu.wv  v8, v16, v24\n\t"
10247       "ret\n\t");
10248 }
10249 
ExecMaskedVwsubuwv()10250 [[gnu::naked]] void ExecMaskedVwsubuwv() {
10251   asm("vwsubu.wv  v8, v16, v24, v0.t\n\t"
10252       "ret\n\t");
10253 }
10254 
TEST(InlineAsmTestRiscv64,TestVwsubuwv)10255 TEST(InlineAsmTestRiscv64, TestVwsubuwv) {
10256   TestWideningVectorInstruction(ExecVwsubuwv,
10257                                 ExecMaskedVwsubuwv,
10258                                 {{0x8100, 0x8270, 0x8500, 0x8670, 0x88ff, 0x8a70, 0x8d00, 0x8e70},
10259                                  {0x90ff, 0x9290, 0x9500, 0x9690, 0x9900, 0x9a90, 0x9d00, 0x9e90},
10260                                  {0xa100, 0xa270, 0xa500, 0xa670, 0xa8ff, 0xaa70, 0xad00, 0xae70},
10261                                  {0xb0ff, 0xb290, 0xb500, 0xb690, 0xb900, 0xba90, 0xbd00, 0xbe90},
10262                                  {0xc100, 0xc270, 0xc500, 0xc670, 0xc8ff, 0xca70, 0xcd00, 0xce70},
10263                                  {0xd0ff, 0xd290, 0xd500, 0xd690, 0xd900, 0xda90, 0xdd00, 0xde90},
10264                                  {0xe100, 0xe270, 0xe500, 0xe670, 0xe8ff, 0xea70, 0xed00, 0xee70},
10265                                  {0xf0ff, 0xf290, 0xf500, 0xf690, 0xf900, 0xfa90, 0xfd00, 0xfe90}},
10266                                 {{0x8301'ef00, 0x8705'ef00, 0x8b09'eeff, 0x8f0d'ef00},
10267                                  {0x9312'0eff, 0x9716'0f00, 0x9b1a'0f00, 0x9f1e'0f00},
10268                                  {0xa321'ef00, 0xa725'ef00, 0xab29'eeff, 0xaf2d'ef00},
10269                                  {0xb332'0eff, 0xb736'0f00, 0xbb3a'0f00, 0xbf3e'0f00},
10270                                  {0xc341'ef00, 0xc745'ef00, 0xcb49'eeff, 0xcf4d'ef00},
10271                                  {0xd352'0eff, 0xd756'0f00, 0xdb5a'0f00, 0xdf5e'0f00},
10272                                  {0xe361'ef00, 0xe765'ef00, 0xeb69'eeff, 0xef6d'ef00},
10273                                  {0xf372'0eff, 0xf776'0f00, 0xfb7a'0f00, 0xff7e'0f00}},
10274                                 {{0x8706'8503'ecfd'ef00, 0x8f0e'8d0b'ecfd'eeff},
10275                                  {0x9716'9514'0cfe'0eff, 0x9f1e'9d1c'0cfe'0f00},
10276                                  {0xa726'a523'ecfd'ef00, 0xaf2e'ad2b'ecfd'eeff},
10277                                  {0xb736'b534'0cfe'0eff, 0xbf3e'bd3c'0cfe'0f00},
10278                                  {0xc746'c543'ecfd'ef00, 0xcf4e'cd4b'ecfd'eeff},
10279                                  {0xd756'd554'0cfe'0eff, 0xdf5e'dd5c'0cfe'0f00},
10280                                  {0xe766'e563'ecfd'ef00, 0xef6e'ed6b'ecfd'eeff},
10281                                  {0xf776'f574'0cfe'0eff, 0xff7e'fd7c'0cfe'0f00}},
10282                                 kVectorCalculationsSource);
10283 }
10284 
ExecVwsubuwx()10285 [[gnu::naked]] void ExecVwsubuwx() {
10286   asm("vwsubu.wx v8, v16, t0\n\t"
10287       "ret\n\t");
10288 }
10289 
ExecMaskedVwsubuwx()10290 [[gnu::naked]] void ExecMaskedVwsubuwx() {
10291   asm("vwsubu.wx v8, v16, t0, v0.t\n\t"
10292       "ret\n\t");
10293 }
10294 
TEST(InlineAsmTestRiscv64,TestVwsubuwx)10295 TEST(InlineAsmTestRiscv64, TestVwsubuwx) {
10296   TestWideningVectorInstruction(ExecVwsubuwx,
10297                                 ExecMaskedVwsubuwx,
10298                                 {{0x8056, 0x8258, 0x845a, 0x865c, 0x885e, 0x8a60, 0x8c62, 0x8e64},
10299                                  {0x9066, 0x9268, 0x946a, 0x966c, 0x986e, 0x9a70, 0x9c72, 0x9e74},
10300                                  {0xa076, 0xa278, 0xa47a, 0xa67c, 0xa87e, 0xaa80, 0xac82, 0xae84},
10301                                  {0xb086, 0xb288, 0xb48a, 0xb68c, 0xb88e, 0xba90, 0xbc92, 0xbe94},
10302                                  {0xc096, 0xc298, 0xc49a, 0xc69c, 0xc89e, 0xcaa0, 0xcca2, 0xcea4},
10303                                  {0xd0a6, 0xd2a8, 0xd4aa, 0xd6ac, 0xd8ae, 0xdab0, 0xdcb2, 0xdeb4},
10304                                  {0xe0b6, 0xe2b8, 0xe4ba, 0xe6bc, 0xe8be, 0xeac0, 0xecc2, 0xeec4},
10305                                  {0xf0c6, 0xf2c8, 0xf4ca, 0xf6cc, 0xf8ce, 0xfad0, 0xfcd2, 0xfed4}},
10306                                 {{0x8301'd656, 0x8705'da5a, 0x8b09'de5e, 0x8f0d'e262},
10307                                  {0x9311'e666, 0x9715'ea6a, 0x9b19'ee6e, 0x9f1d'f272},
10308                                  {0xa321'f676, 0xa725'fa7a, 0xab29'fe7e, 0xaf2e'0282},
10309                                  {0xb332'0686, 0xb736'0a8a, 0xbb3a'0e8e, 0xbf3e'1292},
10310                                  {0xc342'1696, 0xc746'1a9a, 0xcb4a'1e9e, 0xcf4e'22a2},
10311                                  {0xd352'26a6, 0xd756'2aaa, 0xdb5a'2eae, 0xdf5e'32b2},
10312                                  {0xe362'36b6, 0xe766'3aba, 0xeb6a'3ebe, 0xef6e'42c2},
10313                                  {0xf372'46c6, 0xf776'4aca, 0xfb7a'4ece, 0xff7e'52d2}},
10314                                 {{0x8706'8503'd857'd656, 0x8f0e'8d0b'e05f'de5e},
10315                                  {0x9716'9513'e867'e666, 0x9f1e'9d1b'f06f'ee6e},
10316                                  {0xa726'a523'f877'f676, 0xaf2e'ad2c'007f'fe7e},
10317                                  {0xb736'b534'0888'0686, 0xbf3e'bd3c'1090'0e8e},
10318                                  {0xc746'c544'1898'1696, 0xcf4e'cd4c'20a0'1e9e},
10319                                  {0xd756'd554'28a8'26a6, 0xdf5e'dd5c'30b0'2eae},
10320                                  {0xe766'e564'38b8'36b6, 0xef6e'ed6c'40c0'3ebe},
10321                                  {0xf776'f574'48c8'46c6, 0xff7e'fd7c'50d0'4ece}},
10322                                 kVectorCalculationsSource);
10323 }
10324 
ExecVwsubvv()10325 [[gnu::naked]] void ExecVwsubvv() {
10326   asm("vwsub.vv  v8, v16, v24\n\t"
10327       "ret\n\t");
10328 }
10329 
ExecMaskedVwsubvv()10330 [[gnu::naked]] void ExecMaskedVwsubvv() {
10331   asm("vwsub.vv  v8, v16, v24, v0.t\n\t"
10332       "ret\n\t");
10333 }
10334 
TEST(InlineAsmTestRiscv64,TestVwsubvv)10335 TEST(InlineAsmTestRiscv64, TestVwsubvv) {
10336   TestWideningVectorInstruction(ExecVwsubvv,
10337                                 ExecMaskedVwsubvv,
10338                                 {{0x0000, 0xffef, 0xfffe, 0xffed, 0xfffb, 0xffeb, 0xfffa, 0xffe9},
10339                                  {0xfff7, 0x0007, 0xfff6, 0x0005, 0xfff4, 0x0003, 0xfff2, 0x0001},
10340                                  {0xfff0, 0xffdf, 0xffee, 0xffdd, 0xffeb, 0xffdb, 0xffea, 0xffd9},
10341                                  {0xffe7, 0xfff7, 0xffe6, 0xfff5, 0xffe4, 0xfff3, 0xffe2, 0xfff1},
10342                                  {0xffe0, 0xffcf, 0xffde, 0xffcd, 0xffdb, 0xffcb, 0xffda, 0xffc9},
10343                                  {0xffd7, 0xffe7, 0xffd6, 0xffe5, 0xffd4, 0xffe3, 0xffd2, 0xffe1},
10344                                  {0xffd0, 0xffbf, 0xffce, 0xffbd, 0xffcb, 0xffbb, 0xffca, 0xffb9},
10345                                  {0xffc7, 0xffd7, 0xffc6, 0xffd5, 0xffc4, 0xffd3, 0xffc2, 0xffd1}},
10346                                 {{0xffff'ef00, 0xffff'ecfe, 0xffff'eafb, 0xffff'e8fa},
10347                                  {0x0000'06f7, 0x0000'04f6, 0x0000'02f4, 0x0000'00f2},
10348                                  {0xffff'def0, 0xffff'dcee, 0xffff'daeb, 0xffff'd8ea},
10349                                  {0xffff'f6e7, 0xffff'f4e6, 0xffff'f2e4, 0xffff'f0e2},
10350                                  {0xffff'cee0, 0xffff'ccde, 0xffff'cadb, 0xffff'c8da},
10351                                  {0xffff'e6d7, 0xffff'e4d6, 0xffff'e2d4, 0xffff'e0d2},
10352                                  {0xffff'bed0, 0xffff'bcce, 0xffff'bacb, 0xffff'b8ca},
10353                                  {0xffff'd6c7, 0xffff'd4c6, 0xffff'd2c4, 0xffff'd0c2}},
10354                                 {{0xffff'ffff'ecfd'ef00, 0xffff'ffff'e8f9'eafb},
10355                                  {0x0000'0000'04f6'06f7, 0x0000'0000'00f2'02f4},
10356                                  {0xffff'ffff'dced'def0, 0xffff'ffff'd8e9'daeb},
10357                                  {0xffff'ffff'f4e5'f6e7, 0xffff'ffff'f0e1'f2e4},
10358                                  {0xffff'ffff'ccdd'cee0, 0xffff'ffff'c8d9'cadb},
10359                                  {0xffff'ffff'e4d5'e6d7, 0xffff'ffff'e0d1'e2d4},
10360                                  {0xffff'ffff'bccd'bed0, 0xffff'ffff'b8c9'bacb},
10361                                  {0xffff'ffff'd4c5'd6c7, 0xffff'ffff'd0c1'd2c4}},
10362                                 kVectorCalculationsSource);
10363 }
10364 
ExecVwsubvx()10365 [[gnu::naked]] void ExecVwsubvx() {
10366   asm("vwsub.vx  v8, v16, t0\n\t"
10367       "ret\n\t");
10368 }
10369 
ExecMaskedVwsubvx()10370 [[gnu::naked]] void ExecMaskedVwsubvx() {
10371   asm("vwsub.vx  v8, v16, t0, v0.t\n\t"
10372       "ret\n\t");
10373 }
10374 
TEST(InlineAsmTestRiscv64,TestVwsubvx)10375 TEST(InlineAsmTestRiscv64, TestVwsubvx) {
10376   TestWideningVectorInstruction(ExecVwsubvx,
10377                                 ExecMaskedVwsubvx,
10378                                 {{0x0056, 0xffd7, 0x0058, 0xffd9, 0x005a, 0xffdb, 0x005c, 0xffdd},
10379                                  {0x005e, 0xffdf, 0x0060, 0xffe1, 0x0062, 0xffe3, 0x0064, 0xffe5},
10380                                  {0x0066, 0xffe7, 0x0068, 0xffe9, 0x006a, 0xffeb, 0x006c, 0xffed},
10381                                  {0x006e, 0xffef, 0x0070, 0xfff1, 0x0072, 0xfff3, 0x0074, 0xfff5},
10382                                  {0x0076, 0xfff7, 0x0078, 0xfff9, 0x007a, 0xfffb, 0x007c, 0xfffd},
10383                                  {0x007e, 0xffff, 0x0080, 0x0001, 0x0082, 0x0003, 0x0084, 0x0005},
10384                                  {0x0086, 0x0007, 0x0088, 0x0009, 0x008a, 0x000b, 0x008c, 0x000d},
10385                                  {0x008e, 0x000f, 0x0090, 0x0011, 0x0092, 0x0013, 0x0094, 0x0015}},
10386                                 {{0xffff'd656, 0xffff'd858, 0xffff'da5a, 0xffff'dc5c},
10387                                  {0xffff'de5e, 0xffff'e060, 0xffff'e262, 0xffff'e464},
10388                                  {0xffff'e666, 0xffff'e868, 0xffff'ea6a, 0xffff'ec6c},
10389                                  {0xffff'ee6e, 0xffff'f070, 0xffff'f272, 0xffff'f474},
10390                                  {0xffff'f676, 0xffff'f878, 0xffff'fa7a, 0xffff'fc7c},
10391                                  {0xffff'fe7e, 0x0000'0080, 0x0000'0282, 0x0000'0484},
10392                                  {0x0000'0686, 0x0000'0888, 0x0000'0a8a, 0x0000'0c8c},
10393                                  {0x0000'0e8e, 0x0000'1090, 0x0000'1292, 0x0000'1494}},
10394                                 {{0xffff'ffff'd857'd656, 0xffff'ffff'dc5b'da5a},
10395                                  {0xffff'ffff'e05f'de5e, 0xffff'ffff'e463'e262},
10396                                  {0xffff'ffff'e867'e666, 0xffff'ffff'ec6b'ea6a},
10397                                  {0xffff'ffff'f06f'ee6e, 0xffff'ffff'f473'f272},
10398                                  {0xffff'ffff'f877'f676, 0xffff'ffff'fc7b'fa7a},
10399                                  {0x0000'0000'007f'fe7e, 0x0000'0000'0484'0282},
10400                                  {0x0000'0000'0888'0686, 0x0000'0000'0c8c'0a8a},
10401                                  {0x0000'0000'1090'0e8e, 0x0000'0000'1494'1292}},
10402                                 kVectorCalculationsSource);
10403 }
10404 
ExecVwsubwv()10405 [[gnu::naked]] void ExecVwsubwv() {
10406   asm("vwsub.wv  v8, v16, v24\n\t"
10407       "ret\n\t");
10408 }
10409 
ExecMaskedVwsubwv()10410 [[gnu::naked]] void ExecMaskedVwsubwv() {
10411   asm("vwsub.wv  v8, v16, v24, v0.t\n\t"
10412       "ret\n\t");
10413 }
10414 
TEST(InlineAsmTestRiscv64,TestVwsubwv)10415 TEST(InlineAsmTestRiscv64, TestVwsubwv) {
10416   TestWideningVectorInstruction(ExecVwsubwv,
10417                                 ExecMaskedVwsubwv,
10418                                 {{0x8100, 0x8370, 0x8500, 0x8770, 0x88ff, 0x8b70, 0x8d00, 0x8f70},
10419                                  {0x90ff, 0x9390, 0x9500, 0x9790, 0x9900, 0x9b90, 0x9d00, 0x9f90},
10420                                  {0xa100, 0xa370, 0xa500, 0xa770, 0xa8ff, 0xab70, 0xad00, 0xaf70},
10421                                  {0xb0ff, 0xb390, 0xb500, 0xb790, 0xb900, 0xbb90, 0xbd00, 0xbf90},
10422                                  {0xc100, 0xc370, 0xc500, 0xc770, 0xc8ff, 0xcb70, 0xcd00, 0xcf70},
10423                                  {0xd0ff, 0xd390, 0xd500, 0xd790, 0xd900, 0xdb90, 0xdd00, 0xdf90},
10424                                  {0xe100, 0xe370, 0xe500, 0xe770, 0xe8ff, 0xeb70, 0xed00, 0xef70},
10425                                  {0xf0ff, 0xf390, 0xf500, 0xf790, 0xf900, 0xfb90, 0xfd00, 0xff90}},
10426                                 {{0x8302'ef00, 0x8706'ef00, 0x8b0a'eeff, 0x8f0e'ef00},
10427                                  {0x9313'0eff, 0x9717'0f00, 0x9b1b'0f00, 0x9f1f'0f00},
10428                                  {0xa322'ef00, 0xa726'ef00, 0xab2a'eeff, 0xaf2e'ef00},
10429                                  {0xb333'0eff, 0xb737'0f00, 0xbb3b'0f00, 0xbf3f'0f00},
10430                                  {0xc342'ef00, 0xc746'ef00, 0xcb4a'eeff, 0xcf4e'ef00},
10431                                  {0xd353'0eff, 0xd757'0f00, 0xdb5b'0f00, 0xdf5f'0f00},
10432                                  {0xe362'ef00, 0xe766'ef00, 0xeb6a'eeff, 0xef6e'ef00},
10433                                  {0xf373'0eff, 0xf777'0f00, 0xfb7b'0f00, 0xff7f'0f00}},
10434                                 {{0x8706'8504'ecfd'ef00, 0x8f0e'8d0c'ecfd'eeff},
10435                                  {0x9716'9515'0cfe'0eff, 0x9f1e'9d1d'0cfe'0f00},
10436                                  {0xa726'a524'ecfd'ef00, 0xaf2e'ad2c'ecfd'eeff},
10437                                  {0xb736'b535'0cfe'0eff, 0xbf3e'bd3d'0cfe'0f00},
10438                                  {0xc746'c544'ecfd'ef00, 0xcf4e'cd4c'ecfd'eeff},
10439                                  {0xd756'd555'0cfe'0eff, 0xdf5e'dd5d'0cfe'0f00},
10440                                  {0xe766'e564'ecfd'ef00, 0xef6e'ed6c'ecfd'eeff},
10441                                  {0xf776'f575'0cfe'0eff, 0xff7e'fd7d'0cfe'0f00}},
10442                                 kVectorCalculationsSource);
10443 }
10444 
ExecVwsubwx()10445 [[gnu::naked]] void ExecVwsubwx() {
10446   asm("vwsub.wx v8, v16, t0\n\t"
10447       "ret\n\t");
10448 }
10449 
ExecMaskedVwsubwx()10450 [[gnu::naked]] void ExecMaskedVwsubwx() {
10451   asm("vwsub.wx v8, v16, t0, v0.t\n\t"
10452       "ret\n\t");
10453 }
10454 
TEST(InlineAsmTestRiscv64,TestVwsubwx)10455 TEST(InlineAsmTestRiscv64, TestVwsubwx) {
10456   TestWideningVectorInstruction(ExecVwsubwx,
10457                                 ExecMaskedVwsubwx,
10458                                 {{0x8156, 0x8358, 0x855a, 0x875c, 0x895e, 0x8b60, 0x8d62, 0x8f64},
10459                                  {0x9166, 0x9368, 0x956a, 0x976c, 0x996e, 0x9b70, 0x9d72, 0x9f74},
10460                                  {0xa176, 0xa378, 0xa57a, 0xa77c, 0xa97e, 0xab80, 0xad82, 0xaf84},
10461                                  {0xb186, 0xb388, 0xb58a, 0xb78c, 0xb98e, 0xbb90, 0xbd92, 0xbf94},
10462                                  {0xc196, 0xc398, 0xc59a, 0xc79c, 0xc99e, 0xcba0, 0xcda2, 0xcfa4},
10463                                  {0xd1a6, 0xd3a8, 0xd5aa, 0xd7ac, 0xd9ae, 0xdbb0, 0xddb2, 0xdfb4},
10464                                  {0xe1b6, 0xe3b8, 0xe5ba, 0xe7bc, 0xe9be, 0xebc0, 0xedc2, 0xefc4},
10465                                  {0xf1c6, 0xf3c8, 0xf5ca, 0xf7cc, 0xf9ce, 0xfbd0, 0xfdd2, 0xffd4}},
10466                                 {{0x8302'd656, 0x8706'da5a, 0x8b0a'de5e, 0x8f0e'e262},
10467                                  {0x9312'e666, 0x9716'ea6a, 0x9b1a'ee6e, 0x9f1e'f272},
10468                                  {0xa322'f676, 0xa726'fa7a, 0xab2a'fe7e, 0xaf2f'0282},
10469                                  {0xb333'0686, 0xb737'0a8a, 0xbb3b'0e8e, 0xbf3f'1292},
10470                                  {0xc343'1696, 0xc747'1a9a, 0xcb4b'1e9e, 0xcf4f'22a2},
10471                                  {0xd353'26a6, 0xd757'2aaa, 0xdb5b'2eae, 0xdf5f'32b2},
10472                                  {0xe363'36b6, 0xe767'3aba, 0xeb6b'3ebe, 0xef6f'42c2},
10473                                  {0xf373'46c6, 0xf777'4aca, 0xfb7b'4ece, 0xff7f'52d2}},
10474                                 {{0x8706'8504'd857'd656, 0x8f0e'8d0c'e05f'de5e},
10475                                  {0x9716'9514'e867'e666, 0x9f1e'9d1c'f06f'ee6e},
10476                                  {0xa726'a524'f877'f676, 0xaf2e'ad2d'007f'fe7e},
10477                                  {0xb736'b535'0888'0686, 0xbf3e'bd3d'1090'0e8e},
10478                                  {0xc746'c545'1898'1696, 0xcf4e'cd4d'20a0'1e9e},
10479                                  {0xd756'd555'28a8'26a6, 0xdf5e'dd5d'30b0'2eae},
10480                                  {0xe766'e565'38b8'36b6, 0xef6e'ed6d'40c0'3ebe},
10481                                  {0xf776'f575'48c8'46c6, 0xff7e'fd7d'50d0'4ece}},
10482                                 kVectorCalculationsSource);
10483 }
10484 
ExecVzextvf8()10485 [[gnu::naked]] void ExecVzextvf8() {
10486   asm("vzext.vf8  v8, v16\n\t"
10487       "ret\n\t");
10488 }
10489 
ExecMaskedVzextvf8()10490 [[gnu::naked]] void ExecMaskedVzextvf8() {
10491   asm("vzext.vf8  v8, v16, v0.t\n\t"
10492       "ret\n\t");
10493 }
10494 
ExecVsextvf8()10495 [[gnu::naked]] void ExecVsextvf8() {
10496   asm("vsext.vf8  v8, v16\n\t"
10497       "ret\n\t");
10498 }
10499 
ExecMaskedVsextvf8()10500 [[gnu::naked]] void ExecMaskedVsextvf8() {
10501   asm("vsext.vf8  v8, v16, v0.t\n\t"
10502       "ret\n\t");
10503 }
10504 
ExecVzextvf4()10505 [[gnu::naked]] void ExecVzextvf4() {
10506   asm("vzext.vf4  v8, v16\n\t"
10507       "ret\n\t");
10508 }
10509 
ExecMaskedVzextvf4()10510 [[gnu::naked]] void ExecMaskedVzextvf4() {
10511   asm("vzext.vf4  v8, v16, v0.t\n\t"
10512       "ret\n\t");
10513 }
10514 
ExecVsextvf4()10515 [[gnu::naked]] void ExecVsextvf4() {
10516   asm("vsext.vf4  v8, v16\n\t"
10517       "ret\n\t");
10518 }
10519 
ExecMaskedVsextvf4()10520 [[gnu::naked]] void ExecMaskedVsextvf4() {
10521   asm("vsext.vf4  v8, v16, v0.t\n\t"
10522       "ret\n\t");
10523 }
10524 
ExecVzextvf2()10525 [[gnu::naked]] void ExecVzextvf2() {
10526   asm("vzext.vf2  v8, v16\n\t"
10527       "ret\n\t");
10528 }
10529 
ExecMaskedVzextvf2()10530 [[gnu::naked]] void ExecMaskedVzextvf2() {
10531   asm("vzext.vf2  v8, v16, v0.t\n\t"
10532       "ret\n\t");
10533 }
10534 
ExecVsextvf2()10535 [[gnu::naked]] void ExecVsextvf2() {
10536   asm("vsext.vf2  v8, v16\n\t"
10537       "ret\n\t");
10538 }
10539 
ExecMaskedVsextvf2()10540 [[gnu::naked]] void ExecMaskedVsextvf2() {
10541   asm("vsext.vf2  v8, v16, v0.t\n\t"
10542       "ret\n\t");
10543 }
10544 
TEST(InlineAsmTestRiscv64,TestVXext)10545 TEST(InlineAsmTestRiscv64, TestVXext) {
10546   TestExtendingVectorInstruction(ExecVzextvf8,
10547                                  ExecMaskedVzextvf8,
10548                                  {},
10549                                  {},
10550                                  {{0x0000'0000'0000'0000, 0x0000'0000'0000'0081},
10551                                   {0x0000'0000'0000'0002, 0x0000'0000'0000'0083},
10552                                   {0x0000'0000'0000'0004, 0x0000'0000'0000'0085},
10553                                   {0x0000'0000'0000'0006, 0x0000'0000'0000'0087},
10554                                   {0x0000'0000'0000'0008, 0x0000'0000'0000'0089},
10555                                   {0x0000'0000'0000'000a, 0x0000'0000'0000'008b},
10556                                   {0x0000'0000'0000'000c, 0x0000'0000'0000'008d},
10557                                   {0x0000'0000'0000'000e, 0x0000'0000'0000'008f}},
10558                                  kVectorCalculationsSource,
10559                                  8);
10560 
10561   TestExtendingVectorInstruction(ExecVsextvf8,
10562                                  ExecMaskedVsextvf8,
10563                                  {},
10564                                  {},
10565                                  {{0x0000'0000'0000'0000, 0xffff'ffff'ffff'ff81},
10566                                   {0x0000'0000'0000'0002, 0xffff'ffff'ffff'ff83},
10567                                   {0x0000'0000'0000'0004, 0xffff'ffff'ffff'ff85},
10568                                   {0x0000'0000'0000'0006, 0xffff'ffff'ffff'ff87},
10569                                   {0x0000'0000'0000'0008, 0xffff'ffff'ffff'ff89},
10570                                   {0x0000'0000'0000'000a, 0xffff'ffff'ffff'ff8b},
10571                                   {0x0000'0000'0000'000c, 0xffff'ffff'ffff'ff8d},
10572                                   {0x0000'0000'0000'000e, 0xffff'ffff'ffff'ff8f}},
10573                                  kVectorCalculationsSource,
10574                                  8);
10575 
10576   TestExtendingVectorInstruction(ExecVzextvf4,
10577                                  ExecMaskedVzextvf4,
10578                                  {},
10579                                  {{0x0000'0000, 0x0000'0081, 0x0000'0002, 0x0000'0083},
10580                                   {0x0000'0004, 0x0000'0085, 0x0000'0006, 0x0000'0087},
10581                                   {0x0000'0008, 0x0000'0089, 0x0000'000a, 0x0000'008b},
10582                                   {0x0000'000c, 0x0000'008d, 0x0000'000e, 0x0000'008f},
10583                                   {0x0000'0010, 0x0000'0091, 0x0000'0012, 0x0000'0093},
10584                                   {0x0000'0014, 0x0000'0095, 0x0000'0016, 0x0000'0097},
10585                                   {0x0000'0018, 0x0000'0099, 0x0000'001a, 0x0000'009b},
10586                                   {0x0000'001c, 0x0000'009d, 0x0000'001e, 0x0000'009f}},
10587                                  {{0x0000'0000'0000'8100, 0x0000'0000'0000'8302},
10588                                   {0x0000'0000'0000'8504, 0x0000'0000'0000'8706},
10589                                   {0x0000'0000'0000'8908, 0x0000'0000'0000'8b0a},
10590                                   {0x0000'0000'0000'8d0c, 0x0000'0000'0000'8f0e},
10591                                   {0x0000'0000'0000'9110, 0x0000'0000'0000'9312},
10592                                   {0x0000'0000'0000'9514, 0x0000'0000'0000'9716},
10593                                   {0x0000'0000'0000'9918, 0x0000'0000'0000'9b1a},
10594                                   {0x0000'0000'0000'9d1c, 0x0000'0000'0000'9f1e}},
10595                                  kVectorCalculationsSource,
10596                                  4);
10597 
10598   TestExtendingVectorInstruction(ExecVsextvf4,
10599                                  ExecMaskedVsextvf4,
10600                                  {},
10601                                  {{0x0000'0000, 0xffff'ff81, 0x0000'0002, 0xffff'ff83},
10602                                   {0x0000'0004, 0xffff'ff85, 0x0000'0006, 0xffff'ff87},
10603                                   {0x0000'0008, 0xffff'ff89, 0x0000'000a, 0xffff'ff8b},
10604                                   {0x0000'000c, 0xffff'ff8d, 0x0000'000e, 0xffff'ff8f},
10605                                   {0x0000'0010, 0xffff'ff91, 0x0000'0012, 0xffff'ff93},
10606                                   {0x0000'0014, 0xffff'ff95, 0x0000'0016, 0xffff'ff97},
10607                                   {0x0000'0018, 0xffff'ff99, 0x0000'001a, 0xffff'ff9b},
10608                                   {0x0000'001c, 0xffff'ff9d, 0x0000'001e, 0xffff'ff9f}},
10609                                  {{0xffff'ffff'ffff'8100, 0xffff'ffff'ffff'8302},
10610                                   {0xffff'ffff'ffff'8504, 0xffff'ffff'ffff'8706},
10611                                   {0xffff'ffff'ffff'8908, 0xffff'ffff'ffff'8b0a},
10612                                   {0xffff'ffff'ffff'8d0c, 0xffff'ffff'ffff'8f0e},
10613                                   {0xffff'ffff'ffff'9110, 0xffff'ffff'ffff'9312},
10614                                   {0xffff'ffff'ffff'9514, 0xffff'ffff'ffff'9716},
10615                                   {0xffff'ffff'ffff'9918, 0xffff'ffff'ffff'9b1a},
10616                                   {0xffff'ffff'ffff'9d1c, 0xffff'ffff'ffff'9f1e}},
10617                                  kVectorCalculationsSource,
10618                                  4);
10619 
10620   TestExtendingVectorInstruction(ExecVzextvf2,
10621                                  ExecMaskedVzextvf2,
10622                                  {{0x0000, 0x0081, 0x0002, 0x0083, 0x0004, 0x0085, 0x0006, 0x0087},
10623                                   {0x0008, 0x0089, 0x000a, 0x008b, 0x000c, 0x008d, 0x000e, 0x008f},
10624                                   {0x0010, 0x0091, 0x0012, 0x0093, 0x0014, 0x0095, 0x0016, 0x0097},
10625                                   {0x0018, 0x0099, 0x001a, 0x009b, 0x001c, 0x009d, 0x001e, 0x009f},
10626                                   {0x0020, 0x00a1, 0x0022, 0x00a3, 0x0024, 0x00a5, 0x0026, 0x00a7},
10627                                   {0x0028, 0x00a9, 0x002a, 0x00ab, 0x002c, 0x00ad, 0x002e, 0x00af},
10628                                   {0x0030, 0x00b1, 0x0032, 0x00b3, 0x0034, 0x00b5, 0x0036, 0x00b7},
10629                                   {0x0038, 0x00b9, 0x003a, 0x00bb, 0x003c, 0x00bd, 0x003e, 0x00bf}},
10630                                  {{0x0000'8100, 0x0000'8302, 0x0000'8504, 0x0000'8706},
10631                                   {0x0000'8908, 0x0000'8b0a, 0x0000'8d0c, 0x0000'8f0e},
10632                                   {0x0000'9110, 0x0000'9312, 0x0000'9514, 0x0000'9716},
10633                                   {0x0000'9918, 0x0000'9b1a, 0x0000'9d1c, 0x0000'9f1e},
10634                                   {0x0000'a120, 0x0000'a322, 0x0000'a524, 0x0000'a726},
10635                                   {0x0000'a928, 0x0000'ab2a, 0x0000'ad2c, 0x0000'af2e},
10636                                   {0x0000'b130, 0x0000'b332, 0x0000'b534, 0x0000'b736},
10637                                   {0x0000'b938, 0x0000'bb3a, 0x0000'bd3c, 0x0000'bf3e}},
10638                                  {{0x0000'0000'8302'8100, 0x0000'0000'8706'8504},
10639                                   {0x0000'0000'8b0a'8908, 0x0000'0000'8f0e'8d0c},
10640                                   {0x0000'0000'9312'9110, 0x0000'0000'9716'9514},
10641                                   {0x0000'0000'9b1a'9918, 0x0000'0000'9f1e'9d1c},
10642                                   {0x0000'0000'a322'a120, 0x0000'0000'a726'a524},
10643                                   {0x0000'0000'ab2a'a928, 0x0000'0000'af2e'ad2c},
10644                                   {0x0000'0000'b332'b130, 0x0000'0000'b736'b534},
10645                                   {0x0000'0000'bb3a'b938, 0x0000'0000'bf3e'bd3c}},
10646                                  kVectorCalculationsSource,
10647                                  2);
10648 
10649   TestExtendingVectorInstruction(ExecVsextvf2,
10650                                  ExecMaskedVsextvf2,
10651                                  {{0x0000, 0xff81, 0x0002, 0xff83, 0x0004, 0xff85, 0x0006, 0xff87},
10652                                   {0x0008, 0xff89, 0x000a, 0xff8b, 0x000c, 0xff8d, 0x000e, 0xff8f},
10653                                   {0x0010, 0xff91, 0x0012, 0xff93, 0x0014, 0xff95, 0x0016, 0xff97},
10654                                   {0x0018, 0xff99, 0x001a, 0xff9b, 0x001c, 0xff9d, 0x001e, 0xff9f},
10655                                   {0x0020, 0xffa1, 0x0022, 0xffa3, 0x0024, 0xffa5, 0x0026, 0xffa7},
10656                                   {0x0028, 0xffa9, 0x002a, 0xffab, 0x002c, 0xffad, 0x002e, 0xffaf},
10657                                   {0x0030, 0xffb1, 0x0032, 0xffb3, 0x0034, 0xffb5, 0x0036, 0xffb7},
10658                                   {0x0038, 0xffb9, 0x003a, 0xffbb, 0x003c, 0xffbd, 0x003e, 0xffbf}},
10659                                  {{0xffff'8100, 0xffff'8302, 0xffff'8504, 0xffff'8706},
10660                                   {0xffff'8908, 0xffff'8b0a, 0xffff'8d0c, 0xffff'8f0e},
10661                                   {0xffff'9110, 0xffff'9312, 0xffff'9514, 0xffff'9716},
10662                                   {0xffff'9918, 0xffff'9b1a, 0xffff'9d1c, 0xffff'9f1e},
10663                                   {0xffff'a120, 0xffff'a322, 0xffff'a524, 0xffff'a726},
10664                                   {0xffff'a928, 0xffff'ab2a, 0xffff'ad2c, 0xffff'af2e},
10665                                   {0xffff'b130, 0xffff'b332, 0xffff'b534, 0xffff'b736},
10666                                   {0xffff'b938, 0xffff'bb3a, 0xffff'bd3c, 0xffff'bf3e}},
10667                                  {{0xffff'ffff'8302'8100, 0xffff'ffff'8706'8504},
10668                                   {0xffff'ffff'8b0a'8908, 0xffff'ffff'8f0e'8d0c},
10669                                   {0xffff'ffff'9312'9110, 0xffff'ffff'9716'9514},
10670                                   {0xffff'ffff'9b1a'9918, 0xffff'ffff'9f1e'9d1c},
10671                                   {0xffff'ffff'a322'a120, 0xffff'ffff'a726'a524},
10672                                   {0xffff'ffff'ab2a'a928, 0xffff'ffff'af2e'ad2c},
10673                                   {0xffff'ffff'b332'b130, 0xffff'ffff'b736'b534},
10674                                   {0xffff'ffff'bb3a'b938, 0xffff'ffff'bf3e'bd3c}},
10675                                  kVectorCalculationsSource,
10676                                  2);
10677 }
10678 
ExecVmulhsuvv()10679 [[gnu::naked]] void ExecVmulhsuvv() {
10680   asm("vmulhsu.vv  v8, v16, v24\n\t"
10681       "ret\n\t");
10682 }
10683 
ExecMaskedVmulhsuvv()10684 [[gnu::naked]] void ExecMaskedVmulhsuvv() {
10685   asm("vmulhsu.vv  v8, v16, v24, v0.t\n\t"
10686       "ret\n\t");
10687 }
10688 
ExecVmulhsuvx()10689 [[gnu::naked]] void ExecVmulhsuvx() {
10690   asm("vmulhsu.vx  v8, v16, t0\n\t"
10691       "ret\n\t");
10692 }
10693 
ExecMaskedVmulhsuvx()10694 [[gnu::naked]] void ExecMaskedVmulhsuvx() {
10695   asm("vmulhsu.vx  v8, v16, t0, v0.t\n\t"
10696       "ret\n\t");
10697 }
10698 
TEST(InlineAsmTestRiscv64,TestVmulhsu)10699 TEST(InlineAsmTestRiscv64, TestVmulhsu) {
10700   TestVectorInstruction(
10701       ExecVmulhsuvv,
10702       ExecMaskedVmulhsuvv,
10703       {{0, 255, 0, 253, 0, 251, 0, 249, 0, 247, 0, 245, 1, 244, 1, 242},
10704        {2, 241, 2, 239, 3, 238, 3, 237, 4, 235, 5, 234, 6, 233, 7, 232},
10705        {8, 231, 9, 230, 10, 229, 11, 228, 12, 228, 13, 227, 15, 226, 16, 226},
10706        {18, 225, 19, 225, 21, 224, 22, 224, 24, 224, 26, 224, 28, 224, 30, 224},
10707        {32, 224, 34, 224, 36, 224, 38, 224, 40, 224, 42, 224, 45, 225, 47, 225},
10708        {50, 226, 52, 226, 55, 227, 57, 228, 60, 228, 63, 229, 66, 230, 69, 231},
10709        {72, 232, 75, 233, 78, 234, 81, 235, 84, 237, 87, 238, 91, 239, 94, 241},
10710        {98, 242, 101, 244, 105, 245, 108, 247, 112, 249, 116, 251, 120, 253, 124, 255}},
10711       {{0xff02, 0xfd10, 0xfb2d, 0xf95c, 0xf79a, 0xf5e9, 0xf448, 0xf2b7},
10712        {0xf136, 0xefc5, 0xee64, 0xed13, 0xebd2, 0xeaa2, 0xe982, 0xe872},
10713        {0xe772, 0xe682, 0xe5a2, 0xe4d3, 0xe413, 0xe364, 0xe2c4, 0xe235},
10714        {0xe1b6, 0xe147, 0xe0e8, 0xe09a, 0xe05b, 0xe02d, 0xe00f, 0xe001},
10715        {0xe003, 0xe015, 0xe037, 0xe069, 0xe0ac, 0xe0fe, 0xe161, 0xe1d4},
10716        {0xe257, 0xe2ea, 0xe38d, 0xe441, 0xe504, 0xe5d8, 0xe6bb, 0xe7af},
10717        {0xe8b3, 0xe9c7, 0xeaec, 0xec20, 0xed64, 0xeeb9, 0xf01e, 0xf193},
10718        {0xf318, 0xf4ad, 0xf652, 0xf807, 0xf9cd, 0xfba2, 0xfd88, 0xff7e}},
10719       {{0xfd10'1a16, 0xf95c'aad6, 0xf5e9'bc58, 0xf2b7'4e9b},
10720        {0xefc5'619f, 0xed13'f564, 0xeaa3'09ea, 0xe872'9f31},
10721        {0xe682'b539, 0xe4d3'4c01, 0xe364'638b, 0xe235'fbd7},
10722        {0xe148'14e2, 0xe09a'aeaf, 0xe02d'c93d, 0xe001'648c},
10723        {0xe015'809c, 0xe06a'1d6d, 0xe0ff'3aff, 0xe1d4'd952},
10724        {0xe2ea'f866, 0xe441'983b, 0xe5d8'b8d1, 0xe7b0'5a28},
10725        {0xe9c8'7c40, 0xec21'1f19, 0xeeba'42b3, 0xf193'e70e},
10726        {0xf4ae'0c2a, 0xf808'b207, 0xfba3'd8a5, 0xff7f'8004}},
10727       {{0xf95c'aad6'78f5'63b8, 0xf2b7'4e9b'bf9d'55cb},
10728        {0xed13'f564'2968'6900, 0xe872'9f31'6a0c'5913},
10729        {0xe4d3'4c01'edf3'8a67, 0xe235'fbd7'2893'787a},
10730        {0xe09a'aeaf'c696'c7ef, 0xe001'648c'fb32'b402},
10731        {0xe06a'1d6d'b352'2196, 0xe1d4'd952'e1ea'0ba9},
10732        {0xe441'983b'b425'975e, 0xe7b0'5a28'dcb9'7f71},
10733        {0xec21'1f19'c911'2946, 0xf193'e70e'eba1'0f59},
10734        {0xf808'b207'f214'd74e, 0xff7f'8005'0ea0'bb61}},
10735       kVectorCalculationsSourceLegacy);
10736   TestVectorInstruction(ExecVmulhsuvx,
10737                         ExecMaskedVmulhsuvx,
10738                         {{0, 171, 1, 172, 2, 174, 3, 175, 5, 176, 6, 178, 7, 179, 9, 180},
10739                          {10, 182, 11, 183, 13, 184, 14, 186, 15, 187, 17, 188, 18, 190, 19, 191},
10740                          {21, 192, 22, 194, 23, 195, 25, 196, 26, 198, 27, 199, 29, 200, 30, 202},
10741                          {31, 203, 33, 204, 34, 206, 35, 207, 37, 208, 38, 210, 39, 211, 41, 212},
10742                          {42, 214, 43, 215, 45, 216, 46, 218, 47, 219, 49, 220, 50, 222, 51, 223},
10743                          {53, 224, 54, 226, 55, 227, 57, 228, 58, 230, 59, 231, 61, 232, 62, 234},
10744                          {63, 235, 65, 236, 66, 238, 67, 239, 69, 240, 70, 242, 71, 243, 73, 244},
10745                          {74, 246, 75, 247, 77, 248, 78, 250, 79, 251, 81, 252, 82, 254, 83, 255}},
10746                         {{0xab55, 0xacac, 0xae02, 0xaf59, 0xb0b0, 0xb206, 0xb35d, 0xb4b4},
10747                          {0xb60a, 0xb761, 0xb8b8, 0xba0e, 0xbb65, 0xbcbc, 0xbe12, 0xbf69},
10748                          {0xc0c0, 0xc216, 0xc36d, 0xc4c4, 0xc61a, 0xc771, 0xc8c8, 0xca1e},
10749                          {0xcb75, 0xcccc, 0xce22, 0xcf79, 0xd0d0, 0xd226, 0xd37d, 0xd4d4},
10750                          {0xd62a, 0xd781, 0xd8d8, 0xda2e, 0xdb85, 0xdcdc, 0xde32, 0xdf89},
10751                          {0xe0e0, 0xe236, 0xe38d, 0xe4e4, 0xe63a, 0xe791, 0xe8e8, 0xea3e},
10752                          {0xeb95, 0xecec, 0xee42, 0xef99, 0xf0f0, 0xf246, 0xf39d, 0xf4f4},
10753                          {0xf64a, 0xf7a1, 0xf8f8, 0xfa4e, 0xfba5, 0xfcfc, 0xfe52, 0xffa9}},
10754                         {{0xacac'5600, 0xaf59'ae02, 0xb207'0605, 0xb4b4'5e08},
10755                          {0xb761'b60a, 0xba0f'0e0d, 0xbcbc'6610, 0xbf69'be12},
10756                          {0xc217'1615, 0xc4c4'6e18, 0xc771'c61a, 0xca1f'1e1d},
10757                          {0xcccc'7620, 0xcf79'ce22, 0xd227'2625, 0xd4d4'7e28},
10758                          {0xd781'd62a, 0xda2f'2e2d, 0xdcdc'8630, 0xdf89'de32},
10759                          {0xe237'3635, 0xe4e4'8e38, 0xe791'e63a, 0xea3f'3e3d},
10760                          {0xecec'9640, 0xef99'ee42, 0xf247'4645, 0xf4f4'9e48},
10761                          {0xf7a1'f64a, 0xfa4f'4e4d, 0xfcfc'a650, 0xffa9'fe52}},
10762                         {{0xaf59'ae03'0201'ab55, 0xb4b4'5e08'5cb1'b0b0},
10763                          {0xba0f'0e0d'b761'b60a, 0xbf69'be13'1211'bb65},
10764                          {0xc4c4'6e18'6cc1'c0c0, 0xca1f'1e1d'c771'c61a},
10765                          {0xcf79'ce23'2221'cb75, 0xd4d4'7e28'7cd1'd0d0},
10766                          {0xda2f'2e2d'd781'd62a, 0xdf89'de33'3231'db85},
10767                          {0xe4e4'8e38'8ce1'e0e0, 0xea3f'3e3d'e791'e63a},
10768                          {0xef99'ee43'4241'eb95, 0xf4f4'9e48'9cf1'f0f0},
10769                          {0xfa4f'4e4d'f7a1'f64a, 0xffa9'fe53'5251'fba5}},
10770                         kVectorCalculationsSourceLegacy);
10771 }
10772 
ExecVslidedownvi()10773 [[gnu::naked]] void ExecVslidedownvi() {
10774   asm("vslidedown.vi  v8, v24, 0\n\t"
10775       "ret\n\t");
10776 }
10777 
ExecMaskedVslidedownvi()10778 [[gnu::naked]] void ExecMaskedVslidedownvi() {
10779   asm("vslidedown.vi  v8, v24, 0, v0.t\n\t"
10780       "ret\n\t");
10781 }
10782 
ExecVslidedownvx()10783 [[gnu::naked]] void ExecVslidedownvx() {
10784   asm("vslidedown.vx  v8, v24, t0\n\t"
10785       "ret\n\t");
10786 }
10787 
ExecMaskedVslidedownvx()10788 [[gnu::naked]] void ExecMaskedVslidedownvx() {
10789   asm("vslidedown.vx  v8, v24, t0, v0.t\n\t"
10790       "ret\n\t");
10791 }
10792 
TEST(InlineAsmTestRiscv64,TestVslidedown)10793 TEST(InlineAsmTestRiscv64, TestVslidedown) {
10794   // With slide offset equal zero, this is equivalent to Vmv.
10795   TestVectorInstruction(
10796       ExecVslidedownvi,
10797       ExecMaskedVslidedownvi,
10798       {{0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30},
10799        {32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60, 62},
10800        {64, 66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92, 94},
10801        {96, 98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124, 126},
10802        {128, 130, 132, 134, 137, 138, 140, 142, 145, 146, 148, 150, 152, 154, 156, 158},
10803        {160, 162, 164, 166, 169, 170, 172, 174, 177, 178, 180, 182, 184, 186, 188, 190},
10804        {192, 194, 196, 198, 201, 202, 204, 206, 209, 210, 212, 214, 216, 218, 220, 222},
10805        {224, 226, 228, 230, 233, 234, 236, 238, 241, 242, 244, 246, 248, 250, 252, 254}},
10806       {{0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
10807        {0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
10808        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
10809        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
10810        {0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c},
10811        {0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc},
10812        {0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc},
10813        {0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8, 0xfefc}},
10814       {{0x0604'0200, 0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18},
10815        {0x2624'2220, 0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38},
10816        {0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
10817        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
10818        {0x8684'8280, 0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98},
10819        {0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8},
10820        {0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1, 0xdedc'dad8},
10821        {0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1, 0xfefc'faf8}},
10822       {{0x0e0c'0a09'0604'0200, 0x1e1c'1a18'1614'1211},
10823        {0x2e2c'2a29'2624'2220, 0x3e3c'3a38'3634'3231},
10824        {0x4e4c'4a49'4644'4240, 0x5e5c'5a58'5654'5251},
10825        {0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271},
10826        {0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291},
10827        {0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1},
10828        {0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1},
10829        {0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1}},
10830       kVectorCalculationsSourceLegacy);
10831 
10832   // VLMUL = 0.
10833   TestVectorPermutationInstruction(
10834       ExecVslidedownvx,
10835       ExecMaskedVslidedownvx,
10836       {{2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30, 0},
10837        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10838        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10839        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10840        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10841        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10842        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10843        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
10844       {{0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c, 0x0000},
10845        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10846        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10847        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10848        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10849        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10850        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10851        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
10852       {{0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18, 0x0000'0000},
10853        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10854        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10855        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10856        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10857        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10858        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10859        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
10860       {{0x1e1c'1a18'1614'1211, 0x0000'0000'0000'0000},
10861        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10862        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10863        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10864        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10865        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10866        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10867        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
10868       kVectorCalculationsSourceLegacy,
10869       /*vlmul=*/0,
10870       /*regx1=*/1,
10871       /*skip=*/0);
10872 
10873   TestVectorPermutationInstruction(
10874       ExecVslidedownvx,
10875       ExecMaskedVslidedownvx,
10876       {{17, 18, 20, 22, 24, 26, 28, 30, 0, 0, 0, 0, 0, 0, 0, 0},
10877        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10878        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10879        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10880        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10881        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10882        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10883        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
10884       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10885        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10886        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10887        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10888        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10889        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10890        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10891        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
10892       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10893        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10894        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10895        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10896        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10897        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10898        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10899        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
10900       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10901        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10902        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10903        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10904        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10905        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10906        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10907        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
10908       kVectorCalculationsSourceLegacy,
10909       /*vlmul=*/0,
10910       /*regx1=*/8,
10911       /*skip=*/0);
10912 
10913   // VLMUL = 1
10914   TestVectorPermutationInstruction(
10915       ExecVslidedownvx,
10916       ExecMaskedVslidedownvx,
10917       {{2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30, 32},
10918        {34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60, 62, 0},
10919        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10920        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10921        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10922        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10923        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10924        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
10925       {{0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c, 0x2220},
10926        {0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c, 0x0000},
10927        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10928        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10929        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10930        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10931        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10932        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
10933       {{0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18, 0x2624'2220},
10934        {0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38, 0x0000'0000},
10935        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10936        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10937        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10938        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10939        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10940        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
10941       {{0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
10942        {0x3e3c'3a38'3634'3231, 0x0000'0000'0000'0000},
10943        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10944        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10945        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10946        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10947        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10948        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
10949       kVectorCalculationsSourceLegacy,
10950       /*vlmul=*/1,
10951       /*regx1=*/1,
10952       /*skip=*/0);
10953   TestVectorPermutationInstruction(
10954       ExecVslidedownvx,
10955       ExecMaskedVslidedownvx,
10956       {{17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 42, 44, 46},
10957        {49, 50, 52, 54, 56, 58, 60, 62, 0, 0, 0, 0, 0, 0, 0, 0},
10958        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10959        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10960        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10961        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10962        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
10963        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
10964       {{0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
10965        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10966        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10967        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10968        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10969        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10970        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
10971        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
10972       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10973        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10974        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10975        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10976        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10977        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10978        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
10979        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
10980       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10981        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10982        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10983        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10984        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10985        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10986        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
10987        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
10988       kVectorCalculationsSourceLegacy,
10989       /*vlmul=*/1,
10990       /*regx1=*/8,
10991       /*skip=*/0);
10992 
10993   // VLMUL = 2
10994   TestVectorPermutationInstruction(
10995       ExecVslidedownvx,
10996       ExecMaskedVslidedownvx,
10997       {{2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30, 32},
10998        {34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60, 62, 64},
10999        {66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92, 94, 96},
11000        {98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124, 126, 0},
11001        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11002        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11003        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11004        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11005       {{0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c, 0x2220},
11006        {0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c, 0x4240},
11007        {0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c, 0x6260},
11008        {0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c, 0x0000},
11009        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11010        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11011        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11012        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11013       {{0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18, 0x2624'2220},
11014        {0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38, 0x4644'4240},
11015        {0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58, 0x6664'6260},
11016        {0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78, 0x0000'0000},
11017        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11018        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11019        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11020        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11021       {{0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
11022        {0x3e3c'3a38'3634'3231, 0x4e4c'4a49'4644'4240},
11023        {0x5e5c'5a58'5654'5251, 0x6e6c'6a69'6664'6260},
11024        {0x7e7c'7a78'7674'7271, 0x0000'0000'0000'0000},
11025        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11026        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11027        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11028        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11029       kVectorCalculationsSourceLegacy,
11030       /*vlmul=*/2,
11031       /*regx1=*/1,
11032       /*skip=*/0);
11033 
11034   TestVectorPermutationInstruction(
11035       ExecVslidedownvx,
11036       ExecMaskedVslidedownvx,
11037       {{17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 42, 44, 46},
11038        {49, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 73, 74, 76, 78},
11039        {81, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 105, 106, 108, 110},
11040        {113, 114, 116, 118, 120, 122, 124, 126, 0, 0, 0, 0, 0, 0, 0, 0},
11041        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11042        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11043        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11044        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11045       {{0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
11046        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
11047        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
11048        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11049        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11050        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11051        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11052        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11053       {{0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
11054        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
11055        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11056        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11057        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11058        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11059        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11060        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11061       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11062        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11063        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11064        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11065        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11066        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11067        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11068        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11069       kVectorCalculationsSourceLegacy,
11070       /*vlmul=*/2,
11071       /*regx1=*/8,
11072       /*skip=*/0);
11073 
11074   // VLMUL = 3
11075   TestVectorPermutationInstruction(
11076       ExecVslidedownvx,
11077       ExecMaskedVslidedownvx,
11078       {{2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30, 32},
11079        {34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60, 62, 64},
11080        {66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92, 94, 96},
11081        {98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124, 126, 128},
11082        {130, 132, 134, 137, 138, 140, 142, 145, 146, 148, 150, 152, 154, 156, 158, 160},
11083        {162, 164, 166, 169, 170, 172, 174, 177, 178, 180, 182, 184, 186, 188, 190, 192},
11084        {194, 196, 198, 201, 202, 204, 206, 209, 210, 212, 214, 216, 218, 220, 222, 224},
11085        {226, 228, 230, 233, 234, 236, 238, 241, 242, 244, 246, 248, 250, 252, 254, 0}},
11086       {{0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c, 0x2220},
11087        {0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c, 0x4240},
11088        {0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c, 0x6260},
11089        {0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c, 0x8280},
11090        {0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c, 0xa2a0},
11091        {0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc, 0xc2c0},
11092        {0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc, 0xe2e0},
11093        {0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8, 0xfefc, 0x0000}},
11094       {{0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18, 0x2624'2220},
11095        {0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38, 0x4644'4240},
11096        {0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58, 0x6664'6260},
11097        {0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78, 0x8684'8280},
11098        {0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98, 0xa6a4'a2a0},
11099        {0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8, 0xc6c4'c2c0},
11100        {0xcecc'cac9, 0xd6d4'd2d1, 0xdedc'dad8, 0xe6e4'e2e0},
11101        {0xeeec'eae9, 0xf6f4'f2f1, 0xfefc'faf8, 0x0000'0000}},
11102       {{0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
11103        {0x3e3c'3a38'3634'3231, 0x4e4c'4a49'4644'4240},
11104        {0x5e5c'5a58'5654'5251, 0x6e6c'6a69'6664'6260},
11105        {0x7e7c'7a78'7674'7271, 0x8e8c'8a89'8684'8280},
11106        {0x9e9c'9a98'9694'9291, 0xaeac'aaa9'a6a4'a2a0},
11107        {0xbebc'bab8'b6b4'b2b1, 0xcecc'cac9'c6c4'c2c0},
11108        {0xdedc'dad8'd6d4'd2d1, 0xeeec'eae9'e6e4'e2e0},
11109        {0xfefc'faf8'f6f4'f2f1, 0x0000'0000'0000'0000}},
11110       kVectorCalculationsSourceLegacy,
11111       /*vlmul=*/3,
11112       /*regx1=*/1,
11113       /*skip=*/0);
11114 
11115   TestVectorPermutationInstruction(
11116       ExecVslidedownvx,
11117       ExecMaskedVslidedownvx,
11118       {{17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 42, 44, 46},
11119        {49, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 73, 74, 76, 78},
11120        {81, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 105, 106, 108, 110},
11121        {113, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 137, 138, 140, 142},
11122        {145, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 169, 170, 172, 174},
11123        {177, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 201, 202, 204, 206},
11124        {209, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 233, 234, 236, 238},
11125        {241, 242, 244, 246, 248, 250, 252, 254, 0, 0, 0, 0, 0, 0, 0, 0}},
11126       {{0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
11127        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
11128        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
11129        {0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c},
11130        {0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc},
11131        {0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc},
11132        {0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8, 0xfefc},
11133        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11134       {{0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
11135        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
11136        {0x8684'8280, 0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98},
11137        {0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8},
11138        {0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1, 0xdedc'dad8},
11139        {0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1, 0xfefc'faf8},
11140        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11141        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11142       {{0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291},
11143        {0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1},
11144        {0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1},
11145        {0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1},
11146        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11147        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11148        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11149        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11150       kVectorCalculationsSourceLegacy,
11151       /*vlmul=*/3,
11152       /*regx1=*/8,
11153       /*skip=*/0);
11154 
11155   // VLMUL = 4
11156   TestVectorPermutationInstruction(
11157       ExecVslidedownvx,
11158       ExecMaskedVslidedownvx,
11159       {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11160        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11161        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11162        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11163        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11164        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11165        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11166        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11167       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11168        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11169        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11170        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11171        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11172        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11173        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11174        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11175       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11176        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11177        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11178        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11179        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11180        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11181        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11182        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11183       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11184        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11185        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11186        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11187        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11188        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11189        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11190        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11191       kVectorCalculationsSourceLegacy,
11192       /*vlmul=*/4,
11193       /*regx1=*/1,
11194       /*skip=*/0);
11195 
11196   TestVectorPermutationInstruction(
11197       ExecVslidedownvx,
11198       ExecMaskedVslidedownvx,
11199       {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11200        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11201        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11202        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11203        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11204        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11205        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11206        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11207       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11208        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11209        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11210        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11211        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11212        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11213        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11214        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11215       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11216        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11217        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11218        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11219        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11220        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11221        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11222        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11223       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11224        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11225        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11226        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11227        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11228        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11229        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11230        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11231       kVectorCalculationsSourceLegacy,
11232       /*vlmul=*/4,
11233       /*regx1=*/8,
11234       /*skip=*/0);
11235 
11236   // VLMUL = 5
11237   TestVectorPermutationInstruction(
11238       ExecVslidedownvx,
11239       ExecMaskedVslidedownvx,
11240       {{2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11241        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11242        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11243        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11244        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11245        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11246        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11247        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11248       {{0x0604, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11249        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11250        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11251        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11252        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11253        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11254        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11255        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11256       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11257        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11258        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11259        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11260        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11261        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11262        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11263        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11264       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11265        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11266        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11267        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11268        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11269        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11270        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11271        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11272       kVectorCalculationsSourceLegacy,
11273       /*vlmul=*/5,
11274       /*regx1=*/1,
11275       /*skip=*/0);
11276 
11277   TestVectorPermutationInstruction(
11278       ExecVslidedownvx,
11279       ExecMaskedVslidedownvx,
11280       {{17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11281        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11282        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11283        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11284        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11285        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11286        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11287        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11288       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11289        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11290        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11291        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11292        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11293        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11294        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11295        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11296       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11297        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11298        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11299        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11300        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11301        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11302        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11303        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11304       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11305        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11306        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11307        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11308        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11309        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11310        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11311        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11312       kVectorCalculationsSourceLegacy,
11313       /*vlmul=*/5,
11314       /*regx1=*/8,
11315       /*skip=*/0);
11316 
11317   // VLMUL = 6
11318   TestVectorPermutationInstruction(
11319       ExecVslidedownvx,
11320       ExecMaskedVslidedownvx,
11321       {{2, 4, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11322        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11323        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11324        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11325        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11326        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11327        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11328        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11329       {{0x0604, 0x0a09, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11330        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11331        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11332        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11333        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11334        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11335        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11336        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11337       {{0x0e0c'0a09, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11338        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11339        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11340        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11341        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11342        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11343        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11344        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11345       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11346        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11347        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11348        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11349        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11350        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11351        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11352        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11353       kVectorCalculationsSourceLegacy,
11354       /*vlmul=*/6,
11355       /*regx1=*/1,
11356       /*skip=*/0);
11357 
11358   TestVectorPermutationInstruction(
11359       ExecVslidedownvx,
11360       ExecMaskedVslidedownvx,
11361       {{17, 18, 20, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11362        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11363        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11364        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11365        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11366        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11367        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11368        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11369       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11370        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11371        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11372        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11373        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11374        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11375        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11376        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11377       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11378        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11379        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11380        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11381        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11382        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11383        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11384        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11385       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11386        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11387        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11388        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11389        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11390        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11391        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11392        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11393       kVectorCalculationsSourceLegacy,
11394       /*vlmul=*/6,
11395       /*regx1=*/8,
11396       /*skip=*/0);
11397 
11398   // VLMUL = 7
11399   TestVectorPermutationInstruction(
11400       ExecVslidedownvx,
11401       ExecMaskedVslidedownvx,
11402       {{2, 4, 6, 9, 10, 12, 14, 17, 0, 0, 0, 0, 0, 0, 0, 0},
11403        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11404        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11405        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11406        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11407        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11408        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11409        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11410       {{0x0604, 0x0a09, 0x0e0c, 0x1211, 0x0000, 0x0000, 0x0000, 0x0000},
11411        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11412        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11413        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11414        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11415        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11416        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11417        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11418       {{0x0e0c'0a09, 0x1614'1211, 0x0000'0000, 0x0000'0000},
11419        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11420        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11421        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11422        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11423        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11424        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11425        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11426       {{0x1e1c'1a18'1614'1211, 0x0000'0000'0000'0000},
11427        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11428        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11429        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11430        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11431        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11432        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11433        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11434       kVectorCalculationsSourceLegacy,
11435       /*vlmul=*/7,
11436       /*regx1=*/1,
11437       /*skip=*/0);
11438 
11439   TestVectorPermutationInstruction(
11440       ExecVslidedownvx,
11441       ExecMaskedVslidedownvx,
11442       {{17, 18, 20, 22, 24, 26, 28, 30, 0, 0, 0, 0, 0, 0, 0, 0},
11443        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11444        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11445        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11446        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11447        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11448        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11449        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11450       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11451        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11452        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11453        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11454        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11455        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11456        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11457        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11458       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11459        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11460        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11461        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11462        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11463        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11464        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11465        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11466       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11467        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11468        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11469        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11470        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11471        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11472        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11473        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11474       kVectorCalculationsSourceLegacy,
11475       /*vlmul=*/7,
11476       /*regx1=*/8,
11477       /*skip=*/0);
11478 }
11479 
ExecVslideupvi()11480 [[gnu::naked]] void ExecVslideupvi() {
11481   asm("vslideup.vi  v8, v24, 0\n\t"
11482       "ret\n\t");
11483 }
11484 
ExecMaskedVslideupvi()11485 [[gnu::naked]] void ExecMaskedVslideupvi() {
11486   asm("vslideup.vi  v8, v24, 0, v0.t\n\t"
11487       "ret\n\t");
11488 }
11489 
ExecVslideupvx()11490 [[gnu::naked]] void ExecVslideupvx() {
11491   asm("vslideup.vx  v8, v24, t0\n\t"
11492       "ret\n\t");
11493 }
11494 
ExecMaskedVslideupvx()11495 [[gnu::naked]] void ExecMaskedVslideupvx() {
11496   asm("vslideup.vx  v8, v24, t0, v0.t\n\t"
11497       "ret\n\t");
11498 }
11499 
TEST(InlineAsmTestRiscv64,TestVslideup)11500 TEST(InlineAsmTestRiscv64, TestVslideup) {
11501   // With slide offset equal zero, this is equivalent to Vmv.
11502   TestVectorInstruction(
11503       ExecVslideupvi,
11504       ExecMaskedVslideupvi,
11505       {{0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28, 30},
11506        {32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60, 62},
11507        {64, 66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92, 94},
11508        {96, 98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124, 126},
11509        {128, 130, 132, 134, 137, 138, 140, 142, 145, 146, 148, 150, 152, 154, 156, 158},
11510        {160, 162, 164, 166, 169, 170, 172, 174, 177, 178, 180, 182, 184, 186, 188, 190},
11511        {192, 194, 196, 198, 201, 202, 204, 206, 209, 210, 212, 214, 216, 218, 220, 222},
11512        {224, 226, 228, 230, 233, 234, 236, 238, 241, 242, 244, 246, 248, 250, 252, 254}},
11513       {{0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
11514        {0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
11515        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
11516        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
11517        {0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c},
11518        {0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc},
11519        {0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc},
11520        {0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8, 0xfefc}},
11521       {{0x0604'0200, 0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18},
11522        {0x2624'2220, 0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38},
11523        {0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
11524        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
11525        {0x8684'8280, 0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98},
11526        {0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8},
11527        {0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1, 0xdedc'dad8},
11528        {0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1, 0xfefc'faf8}},
11529       {{0x0e0c'0a09'0604'0200, 0x1e1c'1a18'1614'1211},
11530        {0x2e2c'2a29'2624'2220, 0x3e3c'3a38'3634'3231},
11531        {0x4e4c'4a49'4644'4240, 0x5e5c'5a58'5654'5251},
11532        {0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271},
11533        {0x8e8c'8a89'8684'8280, 0x9e9c'9a98'9694'9291},
11534        {0xaeac'aaa9'a6a4'a2a0, 0xbebc'bab8'b6b4'b2b1},
11535        {0xcecc'cac9'c6c4'c2c0, 0xdedc'dad8'd6d4'd2d1},
11536        {0xeeec'eae9'e6e4'e2e0, 0xfefc'faf8'f6f4'f2f1}},
11537       kVectorCalculationsSourceLegacy);
11538 
11539   // VLMUL = 0.
11540   TestVectorPermutationInstruction(
11541       ExecVslideupvx,
11542       ExecMaskedVslideupvx,
11543       {{85, 0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28},
11544        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11545        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11546        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11547        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11548        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11549        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11550        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11551       {{0x5555, 0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18},
11552        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11553        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11554        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11555        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11556        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11557        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11558        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11559       {{0x5555'5555, 0x0604'0200, 0x0e0c'0a09, 0x1614'1211},
11560        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11561        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11562        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11563        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11564        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11565        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11566        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11567       {{0x5555'5555'5555'5555, 0x0e0c'0a09'0604'0200},
11568        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11569        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11570        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11571        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11572        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11573        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11574        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11575       kVectorCalculationsSourceLegacy,
11576       /*vlmul=*/0,
11577       /*regx1=*/1,
11578       /*skip=*/1);
11579   TestVectorPermutationInstruction(
11580       ExecVslideupvx,
11581       ExecMaskedVslideupvx,
11582       {{85, 85, 85, 85, 85, 85, 85, 85, 0, 2, 4, 6, 9, 10, 12, 14},
11583        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11584        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11585        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11586        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11587        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11588        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11589        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11590       {{0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555},
11591        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11592        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11593        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11594        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11595        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11596        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11597        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11598       {{0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11599        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11600        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11601        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11602        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11603        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11604        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11605        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11606       {{0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11607        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11608        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11609        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11610        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11611        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11612        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11613        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11614       kVectorCalculationsSourceLegacy,
11615       /*vlmul=*/0,
11616       /*regx1=*/8,
11617       /*skip=*/8);
11618 
11619   // VLMUL = 1
11620   TestVectorPermutationInstruction(
11621       ExecVslideupvx,
11622       ExecMaskedVslideupvx,
11623       {{85, 0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28},
11624        {30, 32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60},
11625        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11626        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11627        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11628        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11629        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11630        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11631       {{0x5555, 0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18},
11632        {0x1e1c, 0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38},
11633        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11634        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11635        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11636        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11637        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11638        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11639       {{0x5555'5555, 0x0604'0200, 0x0e0c'0a09, 0x1614'1211},
11640        {0x1e1c'1a18, 0x2624'2220, 0x2e2c'2a29, 0x3634'3231},
11641        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11642        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11643        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11644        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11645        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11646        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11647       {{0x5555'5555'5555'5555, 0x0e0c'0a09'0604'0200},
11648        {0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
11649        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11650        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11651        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11652        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11653        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11654        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11655       kVectorCalculationsSourceLegacy,
11656       /*vlmul=*/1,
11657       /*regx1=*/1,
11658       /*skip=*/1);
11659   TestVectorPermutationInstruction(
11660       ExecVslideupvx,
11661       ExecMaskedVslideupvx,
11662       {{85, 85, 85, 85, 85, 85, 85, 85, 0, 2, 4, 6, 9, 10, 12, 14},
11663        {17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 42, 44, 46},
11664        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11665        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11666        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11667        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11668        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11669        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11670       {{0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555},
11671        {0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
11672        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11673        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11674        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11675        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11676        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11677        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11678       {{0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11679        {0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11680        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11681        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11682        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11683        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11684        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11685        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11686       {{0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11687        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11688        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11689        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11690        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11691        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11692        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11693        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11694       kVectorCalculationsSourceLegacy,
11695       /*vlmul=*/1,
11696       /*regx1=*/8,
11697       /*skip=*/8);
11698 
11699   // VLMUL = 2
11700   TestVectorPermutationInstruction(
11701       ExecVslideupvx,
11702       ExecMaskedVslideupvx,
11703       {{85, 0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28},
11704        {30, 32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60},
11705        {62, 64, 66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92},
11706        {94, 96, 98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124},
11707        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11708        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11709        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11710        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11711       {{0x5555, 0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18},
11712        {0x1e1c, 0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38},
11713        {0x3e3c, 0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58},
11714        {0x5e5c, 0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78},
11715        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11716        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11717        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11718        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11719       {{0x5555'5555, 0x0604'0200, 0x0e0c'0a09, 0x1614'1211},
11720        {0x1e1c'1a18, 0x2624'2220, 0x2e2c'2a29, 0x3634'3231},
11721        {0x3e3c'3a38, 0x4644'4240, 0x4e4c'4a49, 0x5654'5251},
11722        {0x5e5c'5a58, 0x6664'6260, 0x6e6c'6a69, 0x7674'7271},
11723        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11724        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11725        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11726        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11727       {{0x5555'5555'5555'5555, 0x0e0c'0a09'0604'0200},
11728        {0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
11729        {0x3e3c'3a38'3634'3231, 0x4e4c'4a49'4644'4240},
11730        {0x5e5c'5a58'5654'5251, 0x6e6c'6a69'6664'6260},
11731        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11732        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11733        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11734        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11735       kVectorCalculationsSourceLegacy,
11736       /*vlmul=*/2,
11737       /*regx1=*/1,
11738       /*skip=*/1);
11739 
11740   TestVectorPermutationInstruction(
11741       ExecVslideupvx,
11742       ExecMaskedVslideupvx,
11743       {{85, 85, 85, 85, 85, 85, 85, 85, 0, 2, 4, 6, 9, 10, 12, 14},
11744        {17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 42, 44, 46},
11745        {49, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 73, 74, 76, 78},
11746        {81, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 105, 106, 108, 110},
11747        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11748        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11749        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11750        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11751       {{0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555},
11752        {0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
11753        {0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
11754        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
11755        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11756        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11757        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11758        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11759       {{0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11760        {0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11761        {0x0604'0200, 0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18},
11762        {0x2624'2220, 0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38},
11763        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11764        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11765        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11766        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11767       {{0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11768        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11769        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11770        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11771        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11772        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11773        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11774        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11775       kVectorCalculationsSourceLegacy,
11776       /*vlmul=*/2,
11777       /*regx1=*/8,
11778       /*skip=*/8);
11779 
11780   // VLMUL = 3
11781   TestVectorPermutationInstruction(
11782       ExecVslideupvx,
11783       ExecMaskedVslideupvx,
11784       {{85, 0, 2, 4, 6, 9, 10, 12, 14, 17, 18, 20, 22, 24, 26, 28},
11785        {30, 32, 34, 36, 38, 41, 42, 44, 46, 49, 50, 52, 54, 56, 58, 60},
11786        {62, 64, 66, 68, 70, 73, 74, 76, 78, 81, 82, 84, 86, 88, 90, 92},
11787        {94, 96, 98, 100, 102, 105, 106, 108, 110, 113, 114, 116, 118, 120, 122, 124},
11788        {126, 128, 130, 132, 134, 137, 138, 140, 142, 145, 146, 148, 150, 152, 154, 156},
11789        {158, 160, 162, 164, 166, 169, 170, 172, 174, 177, 178, 180, 182, 184, 186, 188},
11790        {190, 192, 194, 196, 198, 201, 202, 204, 206, 209, 210, 212, 214, 216, 218, 220},
11791        {222, 224, 226, 228, 230, 233, 234, 236, 238, 241, 242, 244, 246, 248, 250, 252}},
11792       {{0x5555, 0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18},
11793        {0x1e1c, 0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38},
11794        {0x3e3c, 0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58},
11795        {0x5e5c, 0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78},
11796        {0x7e7c, 0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98},
11797        {0x9e9c, 0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8},
11798        {0xbebc, 0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8},
11799        {0xdedc, 0xe2e0, 0xe6e4, 0xeae9, 0xeeec, 0xf2f1, 0xf6f4, 0xfaf8}},
11800       {{0x5555'5555, 0x0604'0200, 0x0e0c'0a09, 0x1614'1211},
11801        {0x1e1c'1a18, 0x2624'2220, 0x2e2c'2a29, 0x3634'3231},
11802        {0x3e3c'3a38, 0x4644'4240, 0x4e4c'4a49, 0x5654'5251},
11803        {0x5e5c'5a58, 0x6664'6260, 0x6e6c'6a69, 0x7674'7271},
11804        {0x7e7c'7a78, 0x8684'8280, 0x8e8c'8a89, 0x9694'9291},
11805        {0x9e9c'9a98, 0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1},
11806        {0xbebc'bab8, 0xc6c4'c2c0, 0xcecc'cac9, 0xd6d4'd2d1},
11807        {0xdedc'dad8, 0xe6e4'e2e0, 0xeeec'eae9, 0xf6f4'f2f1}},
11808       {{0x5555'5555'5555'5555, 0x0e0c'0a09'0604'0200},
11809        {0x1e1c'1a18'1614'1211, 0x2e2c'2a29'2624'2220},
11810        {0x3e3c'3a38'3634'3231, 0x4e4c'4a49'4644'4240},
11811        {0x5e5c'5a58'5654'5251, 0x6e6c'6a69'6664'6260},
11812        {0x7e7c'7a78'7674'7271, 0x8e8c'8a89'8684'8280},
11813        {0x9e9c'9a98'9694'9291, 0xaeac'aaa9'a6a4'a2a0},
11814        {0xbebc'bab8'b6b4'b2b1, 0xcecc'cac9'c6c4'c2c0},
11815        {0xdedc'dad8'd6d4'd2d1, 0xeeec'eae9'e6e4'e2e0}},
11816       kVectorCalculationsSourceLegacy,
11817       /*vlmul=*/3,
11818       /*regx1=*/1,
11819       /*skip=*/1);
11820 
11821   TestVectorPermutationInstruction(
11822       ExecVslideupvx,
11823       ExecMaskedVslideupvx,
11824       {{85, 85, 85, 85, 85, 85, 85, 85, 0, 2, 4, 6, 9, 10, 12, 14},
11825        {17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 41, 42, 44, 46},
11826        {49, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 73, 74, 76, 78},
11827        {81, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 105, 106, 108, 110},
11828        {113, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 137, 138, 140, 142},
11829        {145, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 169, 170, 172, 174},
11830        {177, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 201, 202, 204, 206},
11831        {209, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 233, 234, 236, 238}},
11832       {{0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555},
11833        {0x0200, 0x0604, 0x0a09, 0x0e0c, 0x1211, 0x1614, 0x1a18, 0x1e1c},
11834        {0x2220, 0x2624, 0x2a29, 0x2e2c, 0x3231, 0x3634, 0x3a38, 0x3e3c},
11835        {0x4240, 0x4644, 0x4a49, 0x4e4c, 0x5251, 0x5654, 0x5a58, 0x5e5c},
11836        {0x6260, 0x6664, 0x6a69, 0x6e6c, 0x7271, 0x7674, 0x7a78, 0x7e7c},
11837        {0x8280, 0x8684, 0x8a89, 0x8e8c, 0x9291, 0x9694, 0x9a98, 0x9e9c},
11838        {0xa2a0, 0xa6a4, 0xaaa9, 0xaeac, 0xb2b1, 0xb6b4, 0xbab8, 0xbebc},
11839        {0xc2c0, 0xc6c4, 0xcac9, 0xcecc, 0xd2d1, 0xd6d4, 0xdad8, 0xdedc}},
11840       {{0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11841        {0x5555'5555, 0x5555'5555, 0x5555'5555, 0x5555'5555},
11842        {0x0604'0200, 0x0e0c'0a09, 0x1614'1211, 0x1e1c'1a18},
11843        {0x2624'2220, 0x2e2c'2a29, 0x3634'3231, 0x3e3c'3a38},
11844        {0x4644'4240, 0x4e4c'4a49, 0x5654'5251, 0x5e5c'5a58},
11845        {0x6664'6260, 0x6e6c'6a69, 0x7674'7271, 0x7e7c'7a78},
11846        {0x8684'8280, 0x8e8c'8a89, 0x9694'9291, 0x9e9c'9a98},
11847        {0xa6a4'a2a0, 0xaeac'aaa9, 0xb6b4'b2b1, 0xbebc'bab8}},
11848       {{0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11849        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11850        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11851        {0x5555'5555'5555'5555, 0x5555'5555'5555'5555},
11852        {0x0e0c'0a09'0604'0200, 0x1e1c'1a18'1614'1211},
11853        {0x2e2c'2a29'2624'2220, 0x3e3c'3a38'3634'3231},
11854        {0x4e4c'4a49'4644'4240, 0x5e5c'5a58'5654'5251},
11855        {0x6e6c'6a69'6664'6260, 0x7e7c'7a78'7674'7271}},
11856       kVectorCalculationsSourceLegacy,
11857       /*vlmul=*/3,
11858       /*regx1=*/8,
11859       /*skip=*/8);
11860 
11861   // VLMUL = 4
11862   TestVectorPermutationInstruction(
11863       ExecVslideupvx,
11864       ExecMaskedVslideupvx,
11865       {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11866        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11867        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11868        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11869        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11870        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11871        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11872        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11873       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11874        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11875        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11876        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11877        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11878        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11879        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11880        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11881       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11882        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11883        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11884        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11885        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11886        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11887        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11888        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11889       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11890        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11891        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11892        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11893        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11894        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11895        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11896        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11897       kVectorCalculationsSourceLegacy,
11898       /*vlmul=*/4,
11899       /*regx1=*/1,
11900       /*skip=*/1);
11901 
11902   TestVectorPermutationInstruction(
11903       ExecVslideupvx,
11904       ExecMaskedVslideupvx,
11905       {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11906        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11907        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11908        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11909        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11910        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11911        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11912        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11913       {{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11914        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11915        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11916        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11917        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11918        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11919        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11920        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11921       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11922        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11923        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11924        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11925        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11926        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11927        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11928        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11929       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11930        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11931        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11932        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11933        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11934        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11935        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11936        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11937       kVectorCalculationsSourceLegacy,
11938       /*vlmul=*/4,
11939       /*regx1=*/8,
11940       /*skip=*/8);
11941 
11942   // VLMUL = 5
11943   TestVectorPermutationInstruction(
11944       ExecVslideupvx,
11945       ExecMaskedVslideupvx,
11946       {{85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11947        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11948        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11949        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11950        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11951        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11952        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11953        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11954       {{0x5555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11955        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11956        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11957        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11958        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11959        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11960        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11961        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
11962       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11963        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11964        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11965        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11966        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11967        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11968        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
11969        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
11970       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11971        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11972        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11973        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11974        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11975        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11976        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
11977        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
11978       kVectorCalculationsSourceLegacy,
11979       /*vlmul=*/5,
11980       /*regx1=*/1,
11981       /*skip=*/1);
11982 
11983   TestVectorPermutationInstruction(
11984       ExecVslideupvx,
11985       ExecMaskedVslideupvx,
11986       {{85, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11987        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11988        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11989        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11990        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11991        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11992        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
11993        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
11994       {{0x5555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11995        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11996        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11997        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11998        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
11999        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12000        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12001        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
12002       {{0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12003        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12004        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12005        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12006        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12007        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12008        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12009        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
12010       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12011        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12012        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12013        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12014        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12015        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12016        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12017        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
12018       kVectorCalculationsSourceLegacy,
12019       /*vlmul=*/5,
12020       /*regx1=*/8,
12021       /*skip=*/8);
12022 
12023   // VLMUL = 6
12024   TestVectorPermutationInstruction(
12025       ExecVslideupvx,
12026       ExecMaskedVslideupvx,
12027       {{85, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12028        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12029        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12030        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12031        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12032        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12033        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12034        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
12035       {{0x5555, 0x0200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12036        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12037        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12038        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12039        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12040        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12041        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12042        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
12043       {{0x5555'5555, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12044        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12045        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12046        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12047        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12048        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12049        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12050        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
12051       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12052        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12053        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12054        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12055        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12056        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12057        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12058        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
12059       kVectorCalculationsSourceLegacy,
12060       /*vlmul=*/6,
12061       /*regx1=*/1,
12062       /*skip=*/1);
12063 
12064   TestVectorPermutationInstruction(
12065       ExecVslideupvx,
12066       ExecMaskedVslideupvx,
12067       {{85, 85, 85, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12068        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12069        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12070        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12071        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12072        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12073        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12074        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
12075       {{0x5555, 0x5555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12076        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12077        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12078        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12079        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12080        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12081        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12082        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
12083       {{0x5555'5555, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12084        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12085        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12086        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12087        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12088        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12089        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12090        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
12091       {{0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12092        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12093        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12094        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12095        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12096        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12097        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12098        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
12099       kVectorCalculationsSourceLegacy,
12100       /*vlmul=*/6,
12101       /*regx1=*/8,
12102       /*skip=*/8);
12103 
12104   // VLMUL = 7
12105   TestVectorPermutationInstruction(
12106       ExecVslideupvx,
12107       ExecMaskedVslideupvx,
12108       {{85, 0, 2, 4, 6, 9, 10, 12, 0, 0, 0, 0, 0, 0, 0, 0},
12109        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12110        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12111        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12112        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12113        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12114        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12115        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
12116       {{0x5555, 0x0200, 0x0604, 0x0a09, 0x0000, 0x0000, 0x0000, 0x0000},
12117        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12118        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12119        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12120        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12121        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12122        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12123        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
12124       {{0x5555'5555, 0x0604'0200, 0x0000'0000, 0x0000'0000},
12125        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12126        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12127        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12128        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12129        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12130        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12131        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
12132       {{0x5555'5555'5555'5555, 0x0000'0000'0000'0000},
12133        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12134        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12135        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12136        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12137        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12138        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12139        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
12140       kVectorCalculationsSourceLegacy,
12141       /*vlmul=*/7,
12142       /*regx1=*/1,
12143       /*skip=*/1);
12144 
12145   TestVectorPermutationInstruction(
12146       ExecVslideupvx,
12147       ExecMaskedVslideupvx,
12148       {{85, 85, 85, 85, 85, 85, 85, 85, 0, 0, 0, 0, 0, 0, 0, 0},
12149        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12150        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12151        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12152        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12153        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12154        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
12155        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
12156       {{0x5555, 0x5555, 0x5555, 0x5555, 0x0000, 0x0000, 0x0000, 0x0000},
12157        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12158        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12159        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12160        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12161        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12162        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
12163        {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}},
12164       {{0x5555'5555, 0x5555'5555, 0x0000'0000, 0x0000'0000},
12165        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12166        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12167        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12168        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12169        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12170        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000},
12171        {0x0000'0000, 0x0000'0000, 0x0000'0000, 0x0000'0000}},
12172       {{0x5555'5555'5555'5555, 0x0000'0000'0000'0000},
12173        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12174        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12175        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12176        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12177        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12178        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000},
12179        {0x0000'0000'0000'0000, 0x0000'0000'0000'0000}},
12180       kVectorCalculationsSourceLegacy,
12181       /*vlmul=*/7,
12182       /*regx1=*/8,
12183       /*skip=*/8);
12184 }
12185