1cc1dc7a3Sopenharmony_ci// SPDX-License-Identifier: Apache-2.0
2cc1dc7a3Sopenharmony_ci// ----------------------------------------------------------------------------
3cc1dc7a3Sopenharmony_ci// Copyright 2020-2024 Arm Limited
4cc1dc7a3Sopenharmony_ci//
5cc1dc7a3Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); you may not
6cc1dc7a3Sopenharmony_ci// use this file except in compliance with the License. You may obtain a copy
7cc1dc7a3Sopenharmony_ci// of the License at:
8cc1dc7a3Sopenharmony_ci//
9cc1dc7a3Sopenharmony_ci//     http://www.apache.org/licenses/LICENSE-2.0
10cc1dc7a3Sopenharmony_ci//
11cc1dc7a3Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software
12cc1dc7a3Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13cc1dc7a3Sopenharmony_ci// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14cc1dc7a3Sopenharmony_ci// License for the specific language governing permissions and limitations
15cc1dc7a3Sopenharmony_ci// under the License.
16cc1dc7a3Sopenharmony_ci// ----------------------------------------------------------------------------
17cc1dc7a3Sopenharmony_ci
18cc1dc7a3Sopenharmony_ci/**
19cc1dc7a3Sopenharmony_ci * @brief Unit tests for the vectorized SIMD functionality.
20cc1dc7a3Sopenharmony_ci */
21cc1dc7a3Sopenharmony_ci
22cc1dc7a3Sopenharmony_ci#include <limits>
23cc1dc7a3Sopenharmony_ci
24cc1dc7a3Sopenharmony_ci#include "gtest/gtest.h"
25cc1dc7a3Sopenharmony_ci
26cc1dc7a3Sopenharmony_ci#include "../astcenc_internal.h"
27cc1dc7a3Sopenharmony_ci#include "../astcenc_vecmathlib.h"
28cc1dc7a3Sopenharmony_ci
29cc1dc7a3Sopenharmony_cinamespace astcenc
30cc1dc7a3Sopenharmony_ci{
31cc1dc7a3Sopenharmony_ci
32cc1dc7a3Sopenharmony_ci// Misc utility tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33cc1dc7a3Sopenharmony_ci
34cc1dc7a3Sopenharmony_cistatic unsigned int round_down(unsigned int x)
35cc1dc7a3Sopenharmony_ci{
36cc1dc7a3Sopenharmony_ci	unsigned int remainder = x % ASTCENC_SIMD_WIDTH;
37cc1dc7a3Sopenharmony_ci	return x - remainder;
38cc1dc7a3Sopenharmony_ci}
39cc1dc7a3Sopenharmony_ci
40cc1dc7a3Sopenharmony_cistatic unsigned int round_up(unsigned int x)
41cc1dc7a3Sopenharmony_ci{
42cc1dc7a3Sopenharmony_ci	unsigned int remainder = x % ASTCENC_SIMD_WIDTH;
43cc1dc7a3Sopenharmony_ci	if (!remainder)
44cc1dc7a3Sopenharmony_ci	{
45cc1dc7a3Sopenharmony_ci		return x;
46cc1dc7a3Sopenharmony_ci	}
47cc1dc7a3Sopenharmony_ci
48cc1dc7a3Sopenharmony_ci	return x - remainder + ASTCENC_SIMD_WIDTH;
49cc1dc7a3Sopenharmony_ci}
50cc1dc7a3Sopenharmony_ci
51cc1dc7a3Sopenharmony_ci/** @brief Test VLA loop limit round down. */
52cc1dc7a3Sopenharmony_ciTEST(misc, RoundDownVLA)
53cc1dc7a3Sopenharmony_ci{
54cc1dc7a3Sopenharmony_ci	// Static ones which are valid for all VLA widths
55cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(0),  0u);
56cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(8),  8u);
57cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(16), 16u);
58cc1dc7a3Sopenharmony_ci
59cc1dc7a3Sopenharmony_ci	// Variable ones which depend on VLA width
60cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(3),   round_down(3));
61cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(5),   round_down(5));
62cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(7),   round_down(7));
63cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_down_to_simd_multiple_vla(231), round_down(231));
64cc1dc7a3Sopenharmony_ci}
65cc1dc7a3Sopenharmony_ci
66cc1dc7a3Sopenharmony_ci/** @brief Test VLA loop limit round up. */
67cc1dc7a3Sopenharmony_ciTEST(misc, RoundUpVLA)
68cc1dc7a3Sopenharmony_ci{
69cc1dc7a3Sopenharmony_ci	// Static ones which are valid for all VLA widths
70cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(0),  0u);
71cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(8),  8u);
72cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(16), 16u);
73cc1dc7a3Sopenharmony_ci
74cc1dc7a3Sopenharmony_ci	// Variable ones which depend on VLA width
75cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(3),   round_up(3));
76cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(5),   round_up(5));
77cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(7),   round_up(7));
78cc1dc7a3Sopenharmony_ci	EXPECT_EQ(round_up_to_simd_multiple_vla(231), round_up(231));
79cc1dc7a3Sopenharmony_ci}
80cc1dc7a3Sopenharmony_ci
81cc1dc7a3Sopenharmony_ci#if ASTCENC_SIMD_WIDTH == 1
82cc1dc7a3Sopenharmony_ci
83cc1dc7a3Sopenharmony_ci// VLA (1-wide) tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
84cc1dc7a3Sopenharmony_ci
85cc1dc7a3Sopenharmony_ci/** @brief Test VLA change_sign. */
86cc1dc7a3Sopenharmony_ciTEST(vfloat, ChangeSign)
87cc1dc7a3Sopenharmony_ci{
88cc1dc7a3Sopenharmony_ci	vfloat a0(-1.0f);
89cc1dc7a3Sopenharmony_ci	vfloat b0(-1.0f);
90cc1dc7a3Sopenharmony_ci	vfloat r0 = change_sign(a0, b0);
91cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r0.lane<0>(), 1.0f);
92cc1dc7a3Sopenharmony_ci
93cc1dc7a3Sopenharmony_ci	vfloat a1( 1.0f);
94cc1dc7a3Sopenharmony_ci	vfloat b1(-1.0f);
95cc1dc7a3Sopenharmony_ci	vfloat r1 = change_sign(a1, b1);
96cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), -1.0f);
97cc1dc7a3Sopenharmony_ci
98cc1dc7a3Sopenharmony_ci	vfloat a2(-3.12f);
99cc1dc7a3Sopenharmony_ci	vfloat b2( 3.12f);
100cc1dc7a3Sopenharmony_ci	vfloat r2 = change_sign(a2, b2);
101cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), -3.12f);
102cc1dc7a3Sopenharmony_ci
103cc1dc7a3Sopenharmony_ci	vfloat a3( 3.12f);
104cc1dc7a3Sopenharmony_ci	vfloat b3( 3.12f);
105cc1dc7a3Sopenharmony_ci	vfloat r3 = change_sign(a3, b3);
106cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r3.lane<0>(), 3.12f);
107cc1dc7a3Sopenharmony_ci}
108cc1dc7a3Sopenharmony_ci
109cc1dc7a3Sopenharmony_ci/** @brief Test VLA atan. */
110cc1dc7a3Sopenharmony_ciTEST(vfloat, Atan)
111cc1dc7a3Sopenharmony_ci{
112cc1dc7a3Sopenharmony_ci	vfloat a0(-0.15f);
113cc1dc7a3Sopenharmony_ci	vfloat r0 = atan(a0);
114cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r0.lane<0>(), -0.149061f, 0.005f);
115cc1dc7a3Sopenharmony_ci
116cc1dc7a3Sopenharmony_ci	vfloat a1(0.0f);
117cc1dc7a3Sopenharmony_ci	vfloat r1 = atan(a1);
118cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r1.lane<0>(),  0.000000f, 0.005f);
119cc1dc7a3Sopenharmony_ci
120cc1dc7a3Sopenharmony_ci	vfloat a2(0.9f);
121cc1dc7a3Sopenharmony_ci	vfloat r2 = atan(a2);
122cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r2.lane<0>(),  0.733616f, 0.005f);
123cc1dc7a3Sopenharmony_ci
124cc1dc7a3Sopenharmony_ci	vfloat a3(2.1f);
125cc1dc7a3Sopenharmony_ci	vfloat r3 = atan(a3);
126cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r3.lane<0>(),  1.123040f, 0.005f);
127cc1dc7a3Sopenharmony_ci}
128cc1dc7a3Sopenharmony_ci
129cc1dc7a3Sopenharmony_ci/** @brief Test VLA atan2. */
130cc1dc7a3Sopenharmony_ciTEST(vfloat, Atan2)
131cc1dc7a3Sopenharmony_ci{
132cc1dc7a3Sopenharmony_ci	vfloat a0(-0.15f);
133cc1dc7a3Sopenharmony_ci	vfloat b0( 1.15f);
134cc1dc7a3Sopenharmony_ci	vfloat r0 = atan2(a0, b0);
135cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r0.lane<0>(), -0.129816f, 0.005f);
136cc1dc7a3Sopenharmony_ci
137cc1dc7a3Sopenharmony_ci	vfloat a1( 0.0f);
138cc1dc7a3Sopenharmony_ci	vfloat b1(-3.0f);
139cc1dc7a3Sopenharmony_ci	vfloat r1 = atan2(a1, b1);
140cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r1.lane<0>(),  3.141592f, 0.005f);
141cc1dc7a3Sopenharmony_ci
142cc1dc7a3Sopenharmony_ci	vfloat a2( 0.9f);
143cc1dc7a3Sopenharmony_ci	vfloat b2(-0.9f);
144cc1dc7a3Sopenharmony_ci	vfloat r2 = atan2(a2, b2);
145cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r2.lane<0>(),  2.360342f, 0.005f);
146cc1dc7a3Sopenharmony_ci
147cc1dc7a3Sopenharmony_ci	vfloat a3( 2.1f);
148cc1dc7a3Sopenharmony_ci	vfloat b3( 1.1f);
149cc1dc7a3Sopenharmony_ci	vfloat r3 = atan2(a3, b3);
150cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r3.lane<0>(),  1.084357f, 0.005f);
151cc1dc7a3Sopenharmony_ci}
152cc1dc7a3Sopenharmony_ci
153cc1dc7a3Sopenharmony_ci#elif ASTCENC_SIMD_WIDTH == 4
154cc1dc7a3Sopenharmony_ci
155cc1dc7a3Sopenharmony_ci// VLA (4-wide) tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
156cc1dc7a3Sopenharmony_ci
157cc1dc7a3Sopenharmony_ci/** @brief Test VLA change_sign. */
158cc1dc7a3Sopenharmony_ciTEST(vfloat, ChangeSign)
159cc1dc7a3Sopenharmony_ci{
160cc1dc7a3Sopenharmony_ci	vfloat a(-1.0f,  1.0f, -3.12f, 3.12f);
161cc1dc7a3Sopenharmony_ci	vfloat b(-1.0f, -1.0f,  3.12f, 3.12f);
162cc1dc7a3Sopenharmony_ci	vfloat r = change_sign(a, b);
163cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(),  1.0f);
164cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), -1.0f);
165cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), -3.12f);
166cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(),  3.12f);
167cc1dc7a3Sopenharmony_ci}
168cc1dc7a3Sopenharmony_ci
169cc1dc7a3Sopenharmony_ci/** @brief Test VLA atan. */
170cc1dc7a3Sopenharmony_ciTEST(vfloat, Atan)
171cc1dc7a3Sopenharmony_ci{
172cc1dc7a3Sopenharmony_ci	vfloat a(-0.15f, 0.0f, 0.9f, 2.1f);
173cc1dc7a3Sopenharmony_ci	vfloat r = atan(a);
174cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<0>(), -0.149061f, 0.005f);
175cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<1>(),  0.000000f, 0.005f);
176cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<2>(),  0.733616f, 0.005f);
177cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<3>(),  1.123040f, 0.005f);
178cc1dc7a3Sopenharmony_ci}
179cc1dc7a3Sopenharmony_ci
180cc1dc7a3Sopenharmony_ci/** @brief Test VLA atan2. */
181cc1dc7a3Sopenharmony_ciTEST(vfloat, Atan2)
182cc1dc7a3Sopenharmony_ci{
183cc1dc7a3Sopenharmony_ci	vfloat a(-0.15f, 0.0f, 0.9f, 2.1f);
184cc1dc7a3Sopenharmony_ci	vfloat b(1.15f, -3.0f, -0.9f, 1.1f);
185cc1dc7a3Sopenharmony_ci	vfloat r = atan2(a, b);
186cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<0>(), -0.129816f, 0.005f);
187cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<1>(),  3.141592f, 0.005f);
188cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<2>(),  2.360342f, 0.005f);
189cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<3>(),  1.084357f, 0.005f);
190cc1dc7a3Sopenharmony_ci}
191cc1dc7a3Sopenharmony_ci
192cc1dc7a3Sopenharmony_ci#elif ASTCENC_SIMD_WIDTH == 8
193cc1dc7a3Sopenharmony_ci
194cc1dc7a3Sopenharmony_ci// VLA (8-wide) tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
195cc1dc7a3Sopenharmony_ci
196cc1dc7a3Sopenharmony_ci/** @brief Test VLA change_sign. */
197cc1dc7a3Sopenharmony_ciTEST(vfloat, ChangeSign)
198cc1dc7a3Sopenharmony_ci{
199cc1dc7a3Sopenharmony_ci	vfloat a(-1.0f,  1.0f, -3.12f, 3.12f, -1.0f,  1.0f, -3.12f, 3.12f);
200cc1dc7a3Sopenharmony_ci	vfloat b(-1.0f, -1.0f,  3.12f, 3.12f, -1.0f, -1.0f,  3.12f, 3.12f);
201cc1dc7a3Sopenharmony_ci	vfloat r = change_sign(a, b);
202cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(),  1.0f);
203cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), -1.0f);
204cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), -3.12f);
205cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(),  3.12f);
206cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(),  1.0f);
207cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), -1.0f);
208cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), -3.12f);
209cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(),  3.12f);
210cc1dc7a3Sopenharmony_ci}
211cc1dc7a3Sopenharmony_ci
212cc1dc7a3Sopenharmony_ci/** @brief Test VLA atan. */
213cc1dc7a3Sopenharmony_ciTEST(vfloat, Atan)
214cc1dc7a3Sopenharmony_ci{
215cc1dc7a3Sopenharmony_ci	vfloat a(-0.15f, 0.0f, 0.9f, 2.1f, -0.15f, 0.0f, 0.9f, 2.1f);
216cc1dc7a3Sopenharmony_ci	vfloat r = atan(a);
217cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<0>(), -0.149061f, 0.005f);
218cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<1>(),  0.000000f, 0.005f);
219cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<2>(),  0.733616f, 0.005f);
220cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<3>(),  1.123040f, 0.005f);
221cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<4>(), -0.149061f, 0.005f);
222cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<5>(),  0.000000f, 0.005f);
223cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<6>(),  0.733616f, 0.005f);
224cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<7>(),  1.123040f, 0.005f);
225cc1dc7a3Sopenharmony_ci}
226cc1dc7a3Sopenharmony_ci
227cc1dc7a3Sopenharmony_ci/** @brief Test VLA atan2. */
228cc1dc7a3Sopenharmony_ciTEST(vfloat, Atan2)
229cc1dc7a3Sopenharmony_ci{
230cc1dc7a3Sopenharmony_ci	vfloat a(-0.15f, 0.0f, 0.9f, 2.1f, -0.15f, 0.0f, 0.9f, 2.1f);
231cc1dc7a3Sopenharmony_ci	vfloat b(1.15f, -3.0f, -0.9f, 1.1f, 1.15f, -3.0f, -0.9f, 1.1f);
232cc1dc7a3Sopenharmony_ci	vfloat r = atan2(a, b);
233cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<0>(), -0.129816f, 0.005f);
234cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<1>(),  3.141592f, 0.005f);
235cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<2>(),  2.360342f, 0.005f);
236cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<3>(),  1.084357f, 0.005f);
237cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<4>(), -0.129816f, 0.005f);
238cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<5>(),  3.141592f, 0.005f);
239cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<6>(),  2.360342f, 0.005f);
240cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<7>(),  1.084357f, 0.005f);
241cc1dc7a3Sopenharmony_ci}
242cc1dc7a3Sopenharmony_ci
243cc1dc7a3Sopenharmony_ci#endif
244cc1dc7a3Sopenharmony_ci
245cc1dc7a3Sopenharmony_cistatic const float qnan = std::numeric_limits<float>::quiet_NaN();
246cc1dc7a3Sopenharmony_ci
247cc1dc7a3Sopenharmony_cialignas(32) static const float f32_data[9] {
248cc1dc7a3Sopenharmony_ci	0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f
249cc1dc7a3Sopenharmony_ci};
250cc1dc7a3Sopenharmony_ci
251cc1dc7a3Sopenharmony_cialignas(32) static const int s32_data[9] {
252cc1dc7a3Sopenharmony_ci	0, 1, 2, 3, 4, 5 , 6, 7, 8
253cc1dc7a3Sopenharmony_ci};
254cc1dc7a3Sopenharmony_ci
255cc1dc7a3Sopenharmony_cialignas(32) static const uint8_t u8_data[9] {
256cc1dc7a3Sopenharmony_ci	0, 1, 2, 3, 4, 5 , 6, 7, 8
257cc1dc7a3Sopenharmony_ci};
258cc1dc7a3Sopenharmony_ci
259cc1dc7a3Sopenharmony_ci// VFLOAT4 tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
260cc1dc7a3Sopenharmony_ci
261cc1dc7a3Sopenharmony_ci/** @brief Test unaligned vfloat4 data load. */
262cc1dc7a3Sopenharmony_ciTEST(vfloat4, UnalignedLoad)
263cc1dc7a3Sopenharmony_ci{
264cc1dc7a3Sopenharmony_ci	vfloat4 a(&(f32_data[1]));
265cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f);
266cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f);
267cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f);
268cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f);
269cc1dc7a3Sopenharmony_ci}
270cc1dc7a3Sopenharmony_ci
271cc1dc7a3Sopenharmony_ci/** @brief Test scalar duplicated vfloat4 load. */
272cc1dc7a3Sopenharmony_ciTEST(vfloat4, ScalarDupLoad)
273cc1dc7a3Sopenharmony_ci{
274cc1dc7a3Sopenharmony_ci	vfloat4 a(1.1f);
275cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.1f);
276cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1.1f);
277cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 1.1f);
278cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 1.1f);
279cc1dc7a3Sopenharmony_ci}
280cc1dc7a3Sopenharmony_ci
281cc1dc7a3Sopenharmony_ci/** @brief Test scalar vfloat4 load. */
282cc1dc7a3Sopenharmony_ciTEST(vfloat4, ScalarLoad)
283cc1dc7a3Sopenharmony_ci{
284cc1dc7a3Sopenharmony_ci	vfloat4 a(1.1f, 2.2f, 3.3f, 4.4f);
285cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.1f);
286cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.2f);
287cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.3f);
288cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.4f);
289cc1dc7a3Sopenharmony_ci}
290cc1dc7a3Sopenharmony_ci
291cc1dc7a3Sopenharmony_ci/** @brief Test copy vfloat4 load. */
292cc1dc7a3Sopenharmony_ciTEST(vfloat4, CopyLoad)
293cc1dc7a3Sopenharmony_ci{
294cc1dc7a3Sopenharmony_ci	vfloat4 s(1.1f, 2.2f, 3.3f, 4.4f);
295cc1dc7a3Sopenharmony_ci	vfloat4 a(s.m);
296cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.1f);
297cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.2f);
298cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.3f);
299cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.4f);
300cc1dc7a3Sopenharmony_ci}
301cc1dc7a3Sopenharmony_ci
302cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 scalar lane set. */
303cc1dc7a3Sopenharmony_ciTEST(vfloat4, SetLane)
304cc1dc7a3Sopenharmony_ci{
305cc1dc7a3Sopenharmony_ci	vfloat4 a(0.0f);
306cc1dc7a3Sopenharmony_ci
307cc1dc7a3Sopenharmony_ci	a.set_lane<0>(1.0f);
308cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f);
309cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0.0f);
310cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0.0f);
311cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0.0f);
312cc1dc7a3Sopenharmony_ci
313cc1dc7a3Sopenharmony_ci	a.set_lane<1>(2.0f);
314cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f);
315cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f);
316cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0.0f);
317cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0.0f);
318cc1dc7a3Sopenharmony_ci
319cc1dc7a3Sopenharmony_ci	a.set_lane<2>(3.0f);
320cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f);
321cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f);
322cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f);
323cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0.0f);
324cc1dc7a3Sopenharmony_ci
325cc1dc7a3Sopenharmony_ci	a.set_lane<3>(4.0f);
326cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f);
327cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f);
328cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f);
329cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f);
330cc1dc7a3Sopenharmony_ci}
331cc1dc7a3Sopenharmony_ci
332cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 zero. */
333cc1dc7a3Sopenharmony_ciTEST(vfloat4, Zero)
334cc1dc7a3Sopenharmony_ci{
335cc1dc7a3Sopenharmony_ci	vfloat4 a = vfloat4::zero();
336cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0.0f);
337cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0.0f);
338cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0.0f);
339cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0.0f);
340cc1dc7a3Sopenharmony_ci}
341cc1dc7a3Sopenharmony_ci
342cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 load1. */
343cc1dc7a3Sopenharmony_ciTEST(vfloat4, Load1)
344cc1dc7a3Sopenharmony_ci{
345cc1dc7a3Sopenharmony_ci	float s = 3.14f;
346cc1dc7a3Sopenharmony_ci	vfloat4 a = vfloat4::load1(&s);
347cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3.14f);
348cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 3.14f);
349cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.14f);
350cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3.14f);
351cc1dc7a3Sopenharmony_ci}
352cc1dc7a3Sopenharmony_ci
353cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 loada. */
354cc1dc7a3Sopenharmony_ciTEST(vfloat4, Loada)
355cc1dc7a3Sopenharmony_ci{
356cc1dc7a3Sopenharmony_ci	vfloat4 a = vfloat4::loada(&(f32_data[0]));
357cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0.0f);
358cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1.0f);
359cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2.0f);
360cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3.0f);
361cc1dc7a3Sopenharmony_ci}
362cc1dc7a3Sopenharmony_ci
363cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 lane_id. */
364cc1dc7a3Sopenharmony_ciTEST(vfloat4, LaneID)
365cc1dc7a3Sopenharmony_ci{
366cc1dc7a3Sopenharmony_ci	vfloat4 a = vfloat4::lane_id();
367cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0.0f);
368cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1.0f);
369cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2.0f);
370cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3.0f);
371cc1dc7a3Sopenharmony_ci}
372cc1dc7a3Sopenharmony_ci
373cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 swz to float4. */
374cc1dc7a3Sopenharmony_ciTEST(vfloat4, swz4)
375cc1dc7a3Sopenharmony_ci{
376cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
377cc1dc7a3Sopenharmony_ci	vfloat4 r = a.swz<0, 3, 2, 1>();
378cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
379cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4.0f);
380cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
381cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 2.0f);
382cc1dc7a3Sopenharmony_ci
383cc1dc7a3Sopenharmony_ci	r = a.swz<3, 1, 1, 0>();
384cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 4.0f);
385cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
386cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 2.0f);
387cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 1.0f);
388cc1dc7a3Sopenharmony_ci}
389cc1dc7a3Sopenharmony_ci
390cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 swz to float3. */
391cc1dc7a3Sopenharmony_ciTEST(vfloat4, swz3)
392cc1dc7a3Sopenharmony_ci{
393cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
394cc1dc7a3Sopenharmony_ci	vfloat4 r = a.swz<0, 3, 2>();
395cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
396cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4.0f);
397cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
398cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.0f);
399cc1dc7a3Sopenharmony_ci
400cc1dc7a3Sopenharmony_ci	r = a.swz<3, 1, 1>();
401cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 4.0f);
402cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
403cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 2.0f);
404cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.0f);
405cc1dc7a3Sopenharmony_ci}
406cc1dc7a3Sopenharmony_ci
407cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 swz to float2. */
408cc1dc7a3Sopenharmony_ciTEST(vfloat4, swz2)
409cc1dc7a3Sopenharmony_ci{
410cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
411cc1dc7a3Sopenharmony_ci	vfloat4 r = a.swz<0, 3>();
412cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
413cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4.0f);
414cc1dc7a3Sopenharmony_ci
415cc1dc7a3Sopenharmony_ci	r = a.swz<2, 1>();
416cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 3.0f);
417cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
418cc1dc7a3Sopenharmony_ci}
419cc1dc7a3Sopenharmony_ci
420cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 add. */
421cc1dc7a3Sopenharmony_ciTEST(vfloat4, vadd)
422cc1dc7a3Sopenharmony_ci{
423cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
424cc1dc7a3Sopenharmony_ci	vfloat4 b(0.1f, 0.2f, 0.3f, 0.4f);
425cc1dc7a3Sopenharmony_ci	a = a + b;
426cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f + 0.1f);
427cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f + 0.2f);
428cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f + 0.3f);
429cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f + 0.4f);
430cc1dc7a3Sopenharmony_ci}
431cc1dc7a3Sopenharmony_ci
432cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 self-add. */
433cc1dc7a3Sopenharmony_ciTEST(vfloat4, vselfadd1)
434cc1dc7a3Sopenharmony_ci{
435cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
436cc1dc7a3Sopenharmony_ci	vfloat4 b(0.1f, 0.2f, 0.3f, 0.4f);
437cc1dc7a3Sopenharmony_ci
438cc1dc7a3Sopenharmony_ci	// Test increment by another variable
439cc1dc7a3Sopenharmony_ci	a += b;
440cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f + 0.1f);
441cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f + 0.2f);
442cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f + 0.3f);
443cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f + 0.4f);
444cc1dc7a3Sopenharmony_ci
445cc1dc7a3Sopenharmony_ci	// Test increment by an expression
446cc1dc7a3Sopenharmony_ci	a += b + b;
447cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(a.lane<0>(), 1.0f + 0.3f, 0.001f);
448cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(a.lane<1>(), 2.0f + 0.6f, 0.001f);
449cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(a.lane<2>(), 3.0f + 0.9f, 0.001f);
450cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(a.lane<3>(), 4.0f + 1.2f, 0.001f);
451cc1dc7a3Sopenharmony_ci}
452cc1dc7a3Sopenharmony_ci
453cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 sub. */
454cc1dc7a3Sopenharmony_ciTEST(vfloat4, vsub)
455cc1dc7a3Sopenharmony_ci{
456cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
457cc1dc7a3Sopenharmony_ci	vfloat4 b(0.1f, 0.2f, 0.3f, 0.4f);
458cc1dc7a3Sopenharmony_ci	a = a - b;
459cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f - 0.1f);
460cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f - 0.2f);
461cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f - 0.3f);
462cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f - 0.4f);
463cc1dc7a3Sopenharmony_ci}
464cc1dc7a3Sopenharmony_ci
465cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 mul. */
466cc1dc7a3Sopenharmony_ciTEST(vfloat4, vmul)
467cc1dc7a3Sopenharmony_ci{
468cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
469cc1dc7a3Sopenharmony_ci	vfloat4 b(0.1f, 0.2f, 0.3f, 0.4f);
470cc1dc7a3Sopenharmony_ci	a = a * b;
471cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f * 0.1f);
472cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f * 0.2f);
473cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f * 0.3f);
474cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f * 0.4f);
475cc1dc7a3Sopenharmony_ci}
476cc1dc7a3Sopenharmony_ci
477cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 mul. */
478cc1dc7a3Sopenharmony_ciTEST(vfloat4, vsmul)
479cc1dc7a3Sopenharmony_ci{
480cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
481cc1dc7a3Sopenharmony_ci	float b = 3.14f;
482cc1dc7a3Sopenharmony_ci	a = a * b;
483cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f * 3.14f);
484cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f * 3.14f);
485cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f * 3.14f);
486cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f * 3.14f);
487cc1dc7a3Sopenharmony_ci}
488cc1dc7a3Sopenharmony_ci
489cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 mul. */
490cc1dc7a3Sopenharmony_ciTEST(vfloat4, svmul)
491cc1dc7a3Sopenharmony_ci{
492cc1dc7a3Sopenharmony_ci	float a = 3.14f;
493cc1dc7a3Sopenharmony_ci	vfloat4 b(1.0f, 2.0f, 3.0f, 4.0f);
494cc1dc7a3Sopenharmony_ci	b = a * b;
495cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<0>(), 3.14f * 1.0f);
496cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<1>(), 3.14f * 2.0f);
497cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<2>(), 3.14f * 3.0f);
498cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<3>(), 3.14f * 4.0f);
499cc1dc7a3Sopenharmony_ci}
500cc1dc7a3Sopenharmony_ci
501cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 div. */
502cc1dc7a3Sopenharmony_ciTEST(vfloat4, vdiv)
503cc1dc7a3Sopenharmony_ci{
504cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
505cc1dc7a3Sopenharmony_ci	vfloat4 b(0.1f, 0.2f, 0.3f, 0.4f);
506cc1dc7a3Sopenharmony_ci	a = a / b;
507cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f / 0.1f);
508cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f / 0.2f);
509cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f / 0.3f);
510cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f / 0.4f);
511cc1dc7a3Sopenharmony_ci}
512cc1dc7a3Sopenharmony_ci
513cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 div. */
514cc1dc7a3Sopenharmony_ciTEST(vfloat4, vsdiv)
515cc1dc7a3Sopenharmony_ci{
516cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
517cc1dc7a3Sopenharmony_ci	float b = 0.3f;
518cc1dc7a3Sopenharmony_ci	a = a / b;
519cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f / 0.3f);
520cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f / 0.3f);
521cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f / 0.3f);
522cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f / 0.3f);
523cc1dc7a3Sopenharmony_ci}
524cc1dc7a3Sopenharmony_ci
525cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 div. */
526cc1dc7a3Sopenharmony_ciTEST(vfloat4, svdiv)
527cc1dc7a3Sopenharmony_ci{
528cc1dc7a3Sopenharmony_ci	float a = 3.0f;
529cc1dc7a3Sopenharmony_ci	vfloat4 b(0.1f, 0.2f, 0.3f, 0.4f);
530cc1dc7a3Sopenharmony_ci	b = a / b;
531cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<0>(), 3.0f / 0.1f);
532cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<1>(), 3.0f / 0.2f);
533cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<2>(), 3.0f / 0.3f);
534cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<3>(), 3.0f / 0.4f);
535cc1dc7a3Sopenharmony_ci}
536cc1dc7a3Sopenharmony_ci
537cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 ceq. */
538cc1dc7a3Sopenharmony_ciTEST(vfloat4, ceq)
539cc1dc7a3Sopenharmony_ci{
540cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.0f, 2.0f, 3.0f, 4.0f);
541cc1dc7a3Sopenharmony_ci	vfloat4 b1(0.1f, 0.2f, 0.3f, 0.4f);
542cc1dc7a3Sopenharmony_ci	vmask4 r1 = a1 == b1;
543cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r1));
544cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r1));
545cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r1));
546cc1dc7a3Sopenharmony_ci
547cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.0f, 2.0f, 3.0f, 4.0f);
548cc1dc7a3Sopenharmony_ci	vfloat4 b2(1.0f, 0.2f, 0.3f, 0.4f);
549cc1dc7a3Sopenharmony_ci	vmask4 r2 = a2 == b2;
550cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x1u, mask(r2));
551cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
552cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
553cc1dc7a3Sopenharmony_ci
554cc1dc7a3Sopenharmony_ci	vfloat4 a3(1.0f, 2.0f, 3.0f, 4.0f);
555cc1dc7a3Sopenharmony_ci	vfloat4 b3(1.0f, 0.2f, 3.0f, 0.4f);
556cc1dc7a3Sopenharmony_ci	vmask4 r3 = a3 == b3;
557cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x5u, mask(r3));
558cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
559cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
560cc1dc7a3Sopenharmony_ci
561cc1dc7a3Sopenharmony_ci	vfloat4 a4(1.0f, 2.0f, 3.0f, 4.0f);
562cc1dc7a3Sopenharmony_ci	vmask4 r4 = a4 == a4;
563cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFu, mask(r4));
564cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r4));
565cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r4));
566cc1dc7a3Sopenharmony_ci}
567cc1dc7a3Sopenharmony_ci
568cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 cne. */
569cc1dc7a3Sopenharmony_ciTEST(vfloat4, cne)
570cc1dc7a3Sopenharmony_ci{
571cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.0f, 2.0f, 3.0f, 4.0f);
572cc1dc7a3Sopenharmony_ci	vfloat4 b1(0.1f, 0.2f, 0.3f, 0.4f);
573cc1dc7a3Sopenharmony_ci	vmask4 r1 = a1 != b1;
574cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFu, mask(r1));
575cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r1));
576cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r1));
577cc1dc7a3Sopenharmony_ci
578cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.0f, 2.0f, 3.0f, 4.0f);
579cc1dc7a3Sopenharmony_ci	vfloat4 b2(1.0f, 0.2f, 0.3f, 0.4f);
580cc1dc7a3Sopenharmony_ci	vmask4 r2 = a2 != b2;
581cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xEu, mask(r2));
582cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
583cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
584cc1dc7a3Sopenharmony_ci
585cc1dc7a3Sopenharmony_ci	vfloat4 a3(1.0f, 2.0f, 3.0f, 4.0f);
586cc1dc7a3Sopenharmony_ci	vfloat4 b3(1.0f, 0.2f, 3.0f, 0.4f);
587cc1dc7a3Sopenharmony_ci	vmask4 r3 = a3 != b3;
588cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAu, mask(r3));
589cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
590cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
591cc1dc7a3Sopenharmony_ci
592cc1dc7a3Sopenharmony_ci	vfloat4 a4(1.0f, 2.0f, 3.0f, 4.0f);
593cc1dc7a3Sopenharmony_ci	vmask4 r4 = a4 != a4;
594cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r4));
595cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r4));
596cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r4));
597cc1dc7a3Sopenharmony_ci}
598cc1dc7a3Sopenharmony_ci
599cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 clt. */
600cc1dc7a3Sopenharmony_ciTEST(vfloat4, clt)
601cc1dc7a3Sopenharmony_ci{
602cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
603cc1dc7a3Sopenharmony_ci	vfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);
604cc1dc7a3Sopenharmony_ci	vmask4 r = a < b;
605cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAu, mask(r));
606cc1dc7a3Sopenharmony_ci}
607cc1dc7a3Sopenharmony_ci
608cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 cle. */
609cc1dc7a3Sopenharmony_ciTEST(vfloat4, cle)
610cc1dc7a3Sopenharmony_ci{
611cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
612cc1dc7a3Sopenharmony_ci	vfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);
613cc1dc7a3Sopenharmony_ci	vmask4 r = a <= b;
614cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xEu, mask(r));
615cc1dc7a3Sopenharmony_ci}
616cc1dc7a3Sopenharmony_ci
617cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 cgt. */
618cc1dc7a3Sopenharmony_ciTEST(vfloat4, cgt)
619cc1dc7a3Sopenharmony_ci{
620cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
621cc1dc7a3Sopenharmony_ci	vfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);
622cc1dc7a3Sopenharmony_ci	vmask4 r = a > b;
623cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x1u, mask(r));
624cc1dc7a3Sopenharmony_ci}
625cc1dc7a3Sopenharmony_ci
626cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 cge. */
627cc1dc7a3Sopenharmony_ciTEST(vfloat4, cge)
628cc1dc7a3Sopenharmony_ci{
629cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
630cc1dc7a3Sopenharmony_ci	vfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);
631cc1dc7a3Sopenharmony_ci	vmask4 r = a >= b;
632cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x5u, mask(r));
633cc1dc7a3Sopenharmony_ci}
634cc1dc7a3Sopenharmony_ci
635cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 min. */
636cc1dc7a3Sopenharmony_ciTEST(vfloat4, min)
637cc1dc7a3Sopenharmony_ci{
638cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
639cc1dc7a3Sopenharmony_ci	vfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);
640cc1dc7a3Sopenharmony_ci	vfloat4 r = min(a, b);
641cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.9f);
642cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
643cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
644cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
645cc1dc7a3Sopenharmony_ci
646cc1dc7a3Sopenharmony_ci	float c = 0.3f;
647cc1dc7a3Sopenharmony_ci	r = min(a, c);
648cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.3f);
649cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0.3f);
650cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 0.3f);
651cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.3f);
652cc1dc7a3Sopenharmony_ci
653cc1dc7a3Sopenharmony_ci	float d = 1.5f;
654cc1dc7a3Sopenharmony_ci	r = min(a, d);
655cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
656cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 1.5f);
657cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 1.5f);
658cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 1.5f);
659cc1dc7a3Sopenharmony_ci}
660cc1dc7a3Sopenharmony_ci
661cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 max. */
662cc1dc7a3Sopenharmony_ciTEST(vfloat4, max)
663cc1dc7a3Sopenharmony_ci{
664cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
665cc1dc7a3Sopenharmony_ci	vfloat4 b(0.9f, 2.1f, 3.0f, 4.1f);
666cc1dc7a3Sopenharmony_ci	vfloat4 r = max(a, b);
667cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
668cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.1f);
669cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
670cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.1f);
671cc1dc7a3Sopenharmony_ci
672cc1dc7a3Sopenharmony_ci	float c = 4.3f;
673cc1dc7a3Sopenharmony_ci	r = max(a, c);
674cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 4.3f);
675cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4.3f);
676cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 4.3f);
677cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.3f);
678cc1dc7a3Sopenharmony_ci
679cc1dc7a3Sopenharmony_ci	float d = 1.5f;
680cc1dc7a3Sopenharmony_ci	r = max(a, d);
681cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.5f);
682cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
683cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
684cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
685cc1dc7a3Sopenharmony_ci}
686cc1dc7a3Sopenharmony_ci
687cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 clamp. */
688cc1dc7a3Sopenharmony_ciTEST(vfloat4, clamp)
689cc1dc7a3Sopenharmony_ci{
690cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.0f, 2.0f, 3.0f, 4.0f);
691cc1dc7a3Sopenharmony_ci	vfloat4 r1 = clamp(2.1f, 3.0f, a1);
692cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 2.1f);
693cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 2.1f);
694cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 3.0f);
695cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3.0f);
696cc1dc7a3Sopenharmony_ci
697cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.0f, 2.0f, qnan, 4.0f);
698cc1dc7a3Sopenharmony_ci	vfloat4 r2 = clamp(2.1f, 3.0f, a2);
699cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 2.1f);
700cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2.1f);
701cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 2.1f);
702cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 3.0f);
703cc1dc7a3Sopenharmony_ci}
704cc1dc7a3Sopenharmony_ci
705cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 clampz. */
706cc1dc7a3Sopenharmony_ciTEST(vfloat4, clampz)
707cc1dc7a3Sopenharmony_ci{
708cc1dc7a3Sopenharmony_ci	vfloat4 a1(-1.0f, 0.0f, 0.1f, 4.0f);
709cc1dc7a3Sopenharmony_ci	vfloat4 r1 = clampz(3.0f, a1);
710cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 0.0f);
711cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 0.0f);
712cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 0.1f);
713cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3.0f);
714cc1dc7a3Sopenharmony_ci
715cc1dc7a3Sopenharmony_ci	vfloat4 a2(-1.0f, 0.0f, qnan, 4.0f);
716cc1dc7a3Sopenharmony_ci	vfloat4 r2 = clampz(3.0f, a2);
717cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 0.0f);
718cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 0.0f);
719cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 0.0f);
720cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 3.0f);
721cc1dc7a3Sopenharmony_ci}
722cc1dc7a3Sopenharmony_ci
723cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 clampz. */
724cc1dc7a3Sopenharmony_ciTEST(vfloat4, clampzo)
725cc1dc7a3Sopenharmony_ci{
726cc1dc7a3Sopenharmony_ci	vfloat4 a1(-1.0f, 0.0f, 0.1f, 4.0f);
727cc1dc7a3Sopenharmony_ci	vfloat4 r1 = clampzo(a1);
728cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 0.0f);
729cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 0.0f);
730cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 0.1f);
731cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.0f);
732cc1dc7a3Sopenharmony_ci
733cc1dc7a3Sopenharmony_ci	vfloat4 a2(-1.0f, 0.0f, qnan, 4.0f);
734cc1dc7a3Sopenharmony_ci	vfloat4 r2 = clampzo(a2);
735cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 0.0f);
736cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 0.0f);
737cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 0.0f);
738cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 1.0f);
739cc1dc7a3Sopenharmony_ci}
740cc1dc7a3Sopenharmony_ci
741cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 abs. */
742cc1dc7a3Sopenharmony_ciTEST(vfloat4, abs)
743cc1dc7a3Sopenharmony_ci{
744cc1dc7a3Sopenharmony_ci	vfloat4 a(-1.0f, 0.0f, 0.1f, 4.0f);
745cc1dc7a3Sopenharmony_ci	vfloat4 r = abs(a);
746cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
747cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0.0f);
748cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 0.1f);
749cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
750cc1dc7a3Sopenharmony_ci}
751cc1dc7a3Sopenharmony_ci
752cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 round. */
753cc1dc7a3Sopenharmony_ciTEST(vfloat4, round)
754cc1dc7a3Sopenharmony_ci{
755cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
756cc1dc7a3Sopenharmony_ci	vfloat4 r1 = round(a1);
757cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 1.0f);
758cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 2.0f);
759cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2.0f);
760cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 4.0f);
761cc1dc7a3Sopenharmony_ci
762cc1dc7a3Sopenharmony_ci	vfloat4 a2(-2.5f, -2.5f, -3.5f, -3.5f);
763cc1dc7a3Sopenharmony_ci	vfloat4 r2 = round(a2);
764cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), -2.0f);
765cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), -4.0f);
766cc1dc7a3Sopenharmony_ci}
767cc1dc7a3Sopenharmony_ci
768cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hmin. */
769cc1dc7a3Sopenharmony_ciTEST(vfloat4, hmin)
770cc1dc7a3Sopenharmony_ci{
771cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
772cc1dc7a3Sopenharmony_ci	vfloat4 r1 = hmin(a1);
773cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 1.1f);
774cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 1.1f);
775cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 1.1f);
776cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.1f);
777cc1dc7a3Sopenharmony_ci
778cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.1f, 1.5f, 1.6f, 0.2f);
779cc1dc7a3Sopenharmony_ci	vfloat4 r2 = hmin(a2);
780cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 0.2f);
781cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 0.2f);
782cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 0.2f);
783cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 0.2f);
784cc1dc7a3Sopenharmony_ci}
785cc1dc7a3Sopenharmony_ci
786cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hmin_s. */
787cc1dc7a3Sopenharmony_ciTEST(vfloat4, hmin_s)
788cc1dc7a3Sopenharmony_ci{
789cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
790cc1dc7a3Sopenharmony_ci	float r1 = hmin_s(a1);
791cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 1.1f);
792cc1dc7a3Sopenharmony_ci
793cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.1f, 1.5f, 1.6f, 0.2f);
794cc1dc7a3Sopenharmony_ci	float r2 = hmin_s(a2);
795cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 0.2f);
796cc1dc7a3Sopenharmony_ci}
797cc1dc7a3Sopenharmony_ci
798cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hmin_rgb_s. */
799cc1dc7a3Sopenharmony_ciTEST(vfloat4, hmin_rgb_s)
800cc1dc7a3Sopenharmony_ci{
801cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 0.2f);
802cc1dc7a3Sopenharmony_ci	float r1 = hmin_rgb_s(a1);
803cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 1.1f);
804cc1dc7a3Sopenharmony_ci
805cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.5f, 0.9f, 1.6f, 1.2f);
806cc1dc7a3Sopenharmony_ci	float r2 = hmin_rgb_s(a2);
807cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 0.9f);
808cc1dc7a3Sopenharmony_ci}
809cc1dc7a3Sopenharmony_ci
810cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hmax. */
811cc1dc7a3Sopenharmony_ciTEST(vfloat4, hmax)
812cc1dc7a3Sopenharmony_ci{
813cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
814cc1dc7a3Sopenharmony_ci	vfloat4 r1 = hmax(a1);
815cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
816cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 4.0f);
817cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 4.0f);
818cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 4.0f);
819cc1dc7a3Sopenharmony_ci
820cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.1f, 1.5f, 1.6f, 0.2f);
821cc1dc7a3Sopenharmony_ci	vfloat4 r2 = hmax(a2);
822cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1.6f);
823cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 1.6f);
824cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 1.6f);
825cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 1.6f);
826cc1dc7a3Sopenharmony_ci}
827cc1dc7a3Sopenharmony_ci
828cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hmax_s. */
829cc1dc7a3Sopenharmony_ciTEST(vfloat4, hmax_s)
830cc1dc7a3Sopenharmony_ci{
831cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
832cc1dc7a3Sopenharmony_ci	float r1 = hmax_s(a1);
833cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 4.0f);
834cc1dc7a3Sopenharmony_ci
835cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.1f, 1.5f, 1.6f, 0.2f);
836cc1dc7a3Sopenharmony_ci	float r2 = hmax_s(a2);
837cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 1.6f);
838cc1dc7a3Sopenharmony_ci}
839cc1dc7a3Sopenharmony_ci
840cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hadd_s. */
841cc1dc7a3Sopenharmony_ciTEST(vfloat4, hadd_s)
842cc1dc7a3Sopenharmony_ci{
843cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
844cc1dc7a3Sopenharmony_ci	float sum = 1.1f + 1.5f + 1.6f + 4.0f;
845cc1dc7a3Sopenharmony_ci	float r = hadd_s(a1);
846cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r, sum, 0.005f);
847cc1dc7a3Sopenharmony_ci}
848cc1dc7a3Sopenharmony_ci
849cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 hadd_rgb_s. */
850cc1dc7a3Sopenharmony_ciTEST(vfloat4, hadd_rgb_s)
851cc1dc7a3Sopenharmony_ci{
852cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.1f, 1.5f, 1.6f, 4.0f);
853cc1dc7a3Sopenharmony_ci	float sum = 1.1f + 1.5f + 1.6f;
854cc1dc7a3Sopenharmony_ci	float r = hadd_rgb_s(a1);
855cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r, sum, 0.005f);
856cc1dc7a3Sopenharmony_ci}
857cc1dc7a3Sopenharmony_ci
858cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 sqrt. */
859cc1dc7a3Sopenharmony_ciTEST(vfloat4, sqrt)
860cc1dc7a3Sopenharmony_ci{
861cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
862cc1dc7a3Sopenharmony_ci	vfloat4 r = sqrt(a);
863cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), std::sqrt(1.0f));
864cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), std::sqrt(2.0f));
865cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), std::sqrt(3.0f));
866cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), std::sqrt(4.0f));
867cc1dc7a3Sopenharmony_ci}
868cc1dc7a3Sopenharmony_ci
869cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 select. */
870cc1dc7a3Sopenharmony_ciTEST(vfloat4, select)
871cc1dc7a3Sopenharmony_ci{
872cc1dc7a3Sopenharmony_ci	vfloat4 m1(1.0f, 1.0f, 1.0f, 1.0f);
873cc1dc7a3Sopenharmony_ci	vfloat4 m2(1.0f, 2.0f, 1.0f, 2.0f);
874cc1dc7a3Sopenharmony_ci	vmask4 cond = m1 == m2;
875cc1dc7a3Sopenharmony_ci
876cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 3.0f, 3.0f, 1.0f);
877cc1dc7a3Sopenharmony_ci	vfloat4 b(4.0f, 2.0f, 2.0f, 4.0f);
878cc1dc7a3Sopenharmony_ci
879cc1dc7a3Sopenharmony_ci	// Select in one direction
880cc1dc7a3Sopenharmony_ci	vfloat4 r1 = select(a, b, cond);
881cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
882cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3.0f);
883cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2.0f);
884cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.0f);
885cc1dc7a3Sopenharmony_ci
886cc1dc7a3Sopenharmony_ci	// Select in the other
887cc1dc7a3Sopenharmony_ci	vfloat4 r2 = select(b, a, cond);
888cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1.0f);
889cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2.0f);
890cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 3.0f);
891cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 4.0f);
892cc1dc7a3Sopenharmony_ci}
893cc1dc7a3Sopenharmony_ci
894cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 select MSB only. */
895cc1dc7a3Sopenharmony_ciTEST(vfloat4, select_msb)
896cc1dc7a3Sopenharmony_ci{
897cc1dc7a3Sopenharmony_ci	int msb_set = static_cast<int>(0x80000000);
898cc1dc7a3Sopenharmony_ci	vint4 msb(msb_set, 0, msb_set, 0);
899cc1dc7a3Sopenharmony_ci	vmask4 cond(msb.m);
900cc1dc7a3Sopenharmony_ci
901cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 3.0f, 3.0f, 1.0f);
902cc1dc7a3Sopenharmony_ci	vfloat4 b(4.0f, 2.0f, 2.0f, 4.0f);
903cc1dc7a3Sopenharmony_ci
904cc1dc7a3Sopenharmony_ci	// Select in one direction
905cc1dc7a3Sopenharmony_ci	vfloat4 r1 = select_msb(a, b, cond);
906cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
907cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3.0f);
908cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2.0f);
909cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.0f);
910cc1dc7a3Sopenharmony_ci
911cc1dc7a3Sopenharmony_ci	// Select in the other
912cc1dc7a3Sopenharmony_ci	vfloat4 r2 = select_msb(b, a, cond);
913cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1.0f);
914cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2.0f);
915cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 3.0f);
916cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 4.0f);
917cc1dc7a3Sopenharmony_ci}
918cc1dc7a3Sopenharmony_ci
919cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 gatherf. */
920cc1dc7a3Sopenharmony_ciTEST(vfloat4, gatherf)
921cc1dc7a3Sopenharmony_ci{
922cc1dc7a3Sopenharmony_ci	vint4 indices(0, 4, 3, 2);
923cc1dc7a3Sopenharmony_ci	vfloat4 r = gatherf(f32_data, indices);
924cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.0f);
925cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4.0f);
926cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
927cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 2.0f);
928cc1dc7a3Sopenharmony_ci}
929cc1dc7a3Sopenharmony_ci
930cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 storea. */
931cc1dc7a3Sopenharmony_ciTEST(vfloat4, storea)
932cc1dc7a3Sopenharmony_ci{
933cc1dc7a3Sopenharmony_ci	ASTCENC_ALIGNAS float out[4];
934cc1dc7a3Sopenharmony_ci	vfloat4 a(f32_data);
935cc1dc7a3Sopenharmony_ci	storea(a, out);
936cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[0], 0.0f);
937cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 1.0f);
938cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 2.0f);
939cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 3.0f);
940cc1dc7a3Sopenharmony_ci}
941cc1dc7a3Sopenharmony_ci
942cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 store. */
943cc1dc7a3Sopenharmony_ciTEST(vfloat4, store)
944cc1dc7a3Sopenharmony_ci{
945cc1dc7a3Sopenharmony_ci	ASTCENC_ALIGNAS float out[5];
946cc1dc7a3Sopenharmony_ci	vfloat4 a(f32_data);
947cc1dc7a3Sopenharmony_ci	store(a, &(out[1]));
948cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 0.0f);
949cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 1.0f);
950cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 2.0f);
951cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[4], 3.0f);
952cc1dc7a3Sopenharmony_ci}
953cc1dc7a3Sopenharmony_ci
954cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 dot. */
955cc1dc7a3Sopenharmony_ciTEST(vfloat4, dot)
956cc1dc7a3Sopenharmony_ci{
957cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.0f, 2.0f, 4.0f, 8.0f);
958cc1dc7a3Sopenharmony_ci	vfloat4 b1(1.0f, 0.5f, 0.25f, 0.125f);
959cc1dc7a3Sopenharmony_ci	vfloat4 r1 = dot(a1, b1);
960cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
961cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 4.0f);
962cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 4.0f);
963cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 4.0f);
964cc1dc7a3Sopenharmony_ci
965cc1dc7a3Sopenharmony_ci	// These values will fail to add to the same value if reassociated
966cc1dc7a3Sopenharmony_ci	float l0 =          141.2540435791015625f;
967cc1dc7a3Sopenharmony_ci	float l1 =      5345345.5000000000000000f;
968cc1dc7a3Sopenharmony_ci	float l2 =       234234.7031250000000000f;
969cc1dc7a3Sopenharmony_ci	float l3 = 124353454080.0000000000000000f;
970cc1dc7a3Sopenharmony_ci
971cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.0f, 1.0f, 1.0f, 1.0f);
972cc1dc7a3Sopenharmony_ci	vfloat4 b2(l0, l1, l2, l3);
973cc1dc7a3Sopenharmony_ci	vfloat4 r2 = dot(a2, b2);
974cc1dc7a3Sopenharmony_ci
975cc1dc7a3Sopenharmony_ci	// Test that reassociation causes a failure with the numbers we chose
976cc1dc7a3Sopenharmony_ci	EXPECT_FALSE(any(r2 == vfloat4(l0 + l1 + l2 + l3)));
977cc1dc7a3Sopenharmony_ci
978cc1dc7a3Sopenharmony_ci	// Test that the sum works, for the association pattern we want used
979cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(r2 == vfloat4((l0 + l2) + (l1 + l3))));
980cc1dc7a3Sopenharmony_ci}
981cc1dc7a3Sopenharmony_ci
982cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 dot_s. */
983cc1dc7a3Sopenharmony_ciTEST(vfloat4, dot_s)
984cc1dc7a3Sopenharmony_ci{
985cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.0f, 2.0f, 4.0f, 8.0f);
986cc1dc7a3Sopenharmony_ci	vfloat4 b1(1.0f, 0.5f, 0.25f, 0.125f);
987cc1dc7a3Sopenharmony_ci	float r1 = dot_s(a1, b1);
988cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 4.0f);
989cc1dc7a3Sopenharmony_ci
990cc1dc7a3Sopenharmony_ci	// These values will fail to add to the same value if reassociated
991cc1dc7a3Sopenharmony_ci	float l0 =          141.2540435791015625f;
992cc1dc7a3Sopenharmony_ci	float l1 =      5345345.5000000000000000f;
993cc1dc7a3Sopenharmony_ci	float l2 =       234234.7031250000000000f;
994cc1dc7a3Sopenharmony_ci	float l3 = 124353454080.0000000000000000f;
995cc1dc7a3Sopenharmony_ci
996cc1dc7a3Sopenharmony_ci	vfloat4 a2(1.0f, 1.0f, 1.0f, 1.0f);
997cc1dc7a3Sopenharmony_ci	vfloat4 b2(l0, l1, l2, l3);
998cc1dc7a3Sopenharmony_ci	float r2 = dot_s(a2, b2);
999cc1dc7a3Sopenharmony_ci
1000cc1dc7a3Sopenharmony_ci	// Test that reassociation causes a failure with the numbers we chose
1001cc1dc7a3Sopenharmony_ci	EXPECT_NE(r2, l0 + l1 + l2 + l3);
1002cc1dc7a3Sopenharmony_ci
1003cc1dc7a3Sopenharmony_ci	// Test that the sum works, for the association pattern we want used
1004cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, (l0 + l2) + (l1 + l3));
1005cc1dc7a3Sopenharmony_ci}
1006cc1dc7a3Sopenharmony_ci
1007cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 dot3. */
1008cc1dc7a3Sopenharmony_ciTEST(vfloat4, dot3)
1009cc1dc7a3Sopenharmony_ci{
1010cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 4.0f, 8.0f);
1011cc1dc7a3Sopenharmony_ci	vfloat4 b(1.0f, 0.5f, 0.25f, 0.125f);
1012cc1dc7a3Sopenharmony_ci	vfloat4 r = dot3(a, b);
1013cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 3.0f);
1014cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 3.0f);
1015cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
1016cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.0f);
1017cc1dc7a3Sopenharmony_ci}
1018cc1dc7a3Sopenharmony_ci
1019cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 dot3_s. */
1020cc1dc7a3Sopenharmony_ciTEST(vfloat4, dot3_s)
1021cc1dc7a3Sopenharmony_ci{
1022cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 4.0f, 8.0f);
1023cc1dc7a3Sopenharmony_ci	vfloat4 b(1.0f, 0.5f, 0.25f, 0.125f);
1024cc1dc7a3Sopenharmony_ci	float r = dot3_s(a, b);
1025cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r, 3.0f);
1026cc1dc7a3Sopenharmony_ci}
1027cc1dc7a3Sopenharmony_ci
1028cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 normalize. */
1029cc1dc7a3Sopenharmony_ciTEST(vfloat4, normalize)
1030cc1dc7a3Sopenharmony_ci{
1031cc1dc7a3Sopenharmony_ci	vfloat4 a(1.0f, 2.0f, 3.0f, 4.0f);
1032cc1dc7a3Sopenharmony_ci	vfloat4 r = normalize(a);
1033cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<0>(), 1.0f / astc::sqrt(30.0f), 0.0005f);
1034cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<1>(), 2.0f / astc::sqrt(30.0f), 0.0005f);
1035cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<2>(), 3.0f / astc::sqrt(30.0f), 0.0005f);
1036cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r.lane<3>(), 4.0f / astc::sqrt(30.0f), 0.0005f);
1037cc1dc7a3Sopenharmony_ci}
1038cc1dc7a3Sopenharmony_ci
1039cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 normalize_safe. */
1040cc1dc7a3Sopenharmony_ciTEST(vfloat4, normalize_safe)
1041cc1dc7a3Sopenharmony_ci{
1042cc1dc7a3Sopenharmony_ci	vfloat4 s(-1.0f, -1.0f, -1.0f, -1.0f);
1043cc1dc7a3Sopenharmony_ci
1044cc1dc7a3Sopenharmony_ci	vfloat4 a1(1.0f, 2.0f, 3.0f, 4.0f);
1045cc1dc7a3Sopenharmony_ci	vfloat4 r1 = normalize_safe(a1, s);
1046cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r1.lane<0>(), 1.0f / astc::sqrt(30.0f), 0.0005f);
1047cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r1.lane<1>(), 2.0f / astc::sqrt(30.0f), 0.0005f);
1048cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r1.lane<2>(), 3.0f / astc::sqrt(30.0f), 0.0005f);
1049cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r1.lane<3>(), 4.0f / astc::sqrt(30.0f), 0.0005f);
1050cc1dc7a3Sopenharmony_ci
1051cc1dc7a3Sopenharmony_ci	vfloat4 a2(0.0f, 0.0f, 0.0f, 0.0f);
1052cc1dc7a3Sopenharmony_ci	vfloat4 r2 = normalize_safe(a2, s);
1053cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), -1.0f);
1054cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), -1.0f);
1055cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), -1.0f);
1056cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), -1.0f);
1057cc1dc7a3Sopenharmony_ci}
1058cc1dc7a3Sopenharmony_ci
1059cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 float_to_int. */
1060cc1dc7a3Sopenharmony_ciTEST(vfloat4, float_to_int)
1061cc1dc7a3Sopenharmony_ci{
1062cc1dc7a3Sopenharmony_ci	vfloat4 a(1.1f, 1.5f, -1.6f, 4.0f);
1063cc1dc7a3Sopenharmony_ci	vint4 r = float_to_int(a);
1064cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1);
1065cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 1);
1066cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), -1);
1067cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4);
1068cc1dc7a3Sopenharmony_ci}
1069cc1dc7a3Sopenharmony_ci
1070cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 round. */
1071cc1dc7a3Sopenharmony_ciTEST(vfloat4, float_to_int_rtn)
1072cc1dc7a3Sopenharmony_ci{
1073cc1dc7a3Sopenharmony_ci	vfloat4 a(1.1f, 1.5f, 1.6f, 4.0f);
1074cc1dc7a3Sopenharmony_ci	vint4 r = float_to_int_rtn(a);
1075cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1);
1076cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2);
1077cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 2);
1078cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4);
1079cc1dc7a3Sopenharmony_ci}
1080cc1dc7a3Sopenharmony_ci
1081cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 round. */
1082cc1dc7a3Sopenharmony_ciTEST(vfloat4, int_to_float)
1083cc1dc7a3Sopenharmony_ci{
1084cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1085cc1dc7a3Sopenharmony_ci	vfloat4 r = int_to_float(a);
1086cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
1087cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
1088cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
1089cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
1090cc1dc7a3Sopenharmony_ci}
1091cc1dc7a3Sopenharmony_ci
1092cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 float to fp16 conversion. */
1093cc1dc7a3Sopenharmony_ciTEST(vfloat4, float_to_float16)
1094cc1dc7a3Sopenharmony_ci{
1095cc1dc7a3Sopenharmony_ci	vfloat4 a(1.5, 234.5, 345345.0, qnan);
1096cc1dc7a3Sopenharmony_ci	vint4 r = float_to_float16(a);
1097cc1dc7a3Sopenharmony_ci
1098cc1dc7a3Sopenharmony_ci	// Normal numbers
1099cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0x3E00);
1100cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0x5B54);
1101cc1dc7a3Sopenharmony_ci
1102cc1dc7a3Sopenharmony_ci	// Large numbers convert to infinity
1103cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 0x7C00);
1104cc1dc7a3Sopenharmony_ci
1105cc1dc7a3Sopenharmony_ci	// NaN must convert to any valid NaN encoding
1106cc1dc7a3Sopenharmony_ci	EXPECT_EQ((r.lane<3>() >> 10) & 0x1F, 0x1F); // Exponent must be all 1s
1107cc1dc7a3Sopenharmony_ci	EXPECT_NE(r.lane<3>() & (0x3FF), 0);         // Mantissa must be non-zero
1108cc1dc7a3Sopenharmony_ci}
1109cc1dc7a3Sopenharmony_ci
1110cc1dc7a3Sopenharmony_ci/** @brief Test float to fp16 conversion. */
1111cc1dc7a3Sopenharmony_ciTEST(sfloat, float_to_float16)
1112cc1dc7a3Sopenharmony_ci{
1113cc1dc7a3Sopenharmony_ci	int r = float_to_float16(234.5);
1114cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r, 0x5B54);
1115cc1dc7a3Sopenharmony_ci}
1116cc1dc7a3Sopenharmony_ci
1117cc1dc7a3Sopenharmony_ci/** @brief Test vfloat4 fp16 to float conversion. */
1118cc1dc7a3Sopenharmony_ciTEST(vfloat4, float16_to_float)
1119cc1dc7a3Sopenharmony_ci{	vint4 a(0x3E00, 0x5B54, 0x7C00, 0xFFFF);
1120cc1dc7a3Sopenharmony_ci	vfloat4 r = float16_to_float(a);
1121cc1dc7a3Sopenharmony_ci
1122cc1dc7a3Sopenharmony_ci	// Normal numbers
1123cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.5);
1124cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 234.5);
1125cc1dc7a3Sopenharmony_ci
1126cc1dc7a3Sopenharmony_ci	// Infinities must be preserved
1127cc1dc7a3Sopenharmony_ci	EXPECT_NE(std::isinf(r.lane<2>()), 0);
1128cc1dc7a3Sopenharmony_ci
1129cc1dc7a3Sopenharmony_ci	// NaNs must be preserved
1130cc1dc7a3Sopenharmony_ci	EXPECT_NE(std::isnan(r.lane<3>()), 0);
1131cc1dc7a3Sopenharmony_ci}
1132cc1dc7a3Sopenharmony_ci
1133cc1dc7a3Sopenharmony_ci/** @brief Test fp16 to float conversion. */
1134cc1dc7a3Sopenharmony_ciTEST(sfloat, float16_to_float)
1135cc1dc7a3Sopenharmony_ci{
1136cc1dc7a3Sopenharmony_ci	float r = float16_to_float(0x5B54);
1137cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r, 234.5);
1138cc1dc7a3Sopenharmony_ci}
1139cc1dc7a3Sopenharmony_ci
1140cc1dc7a3Sopenharmony_ci// VINT4 tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1141cc1dc7a3Sopenharmony_ci
1142cc1dc7a3Sopenharmony_ci/** @brief Test unaligned vint4 data load. */
1143cc1dc7a3Sopenharmony_ciTEST(vint4, UnalignedLoad)
1144cc1dc7a3Sopenharmony_ci{
1145cc1dc7a3Sopenharmony_ci	vint4 a(&(s32_data[1]));
1146cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1147cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1148cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
1149cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
1150cc1dc7a3Sopenharmony_ci}
1151cc1dc7a3Sopenharmony_ci
1152cc1dc7a3Sopenharmony_ci/** @brief Test unaligned vint4 data load. */
1153cc1dc7a3Sopenharmony_ciTEST(vint4, UnalignedLoad8)
1154cc1dc7a3Sopenharmony_ci{
1155cc1dc7a3Sopenharmony_ci	vint4 a(&(u8_data[1]));
1156cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1157cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1158cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
1159cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
1160cc1dc7a3Sopenharmony_ci}
1161cc1dc7a3Sopenharmony_ci
1162cc1dc7a3Sopenharmony_ci/** @brief Test scalar duplicated vint4 load. */
1163cc1dc7a3Sopenharmony_ciTEST(vint4, ScalarDupLoad)
1164cc1dc7a3Sopenharmony_ci{
1165cc1dc7a3Sopenharmony_ci	vint4 a(42);
1166cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 42);
1167cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 42);
1168cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 42);
1169cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 42);
1170cc1dc7a3Sopenharmony_ci}
1171cc1dc7a3Sopenharmony_ci
1172cc1dc7a3Sopenharmony_ci/** @brief Test scalar vint4 load. */
1173cc1dc7a3Sopenharmony_ciTEST(vint4, ScalarLoad)
1174cc1dc7a3Sopenharmony_ci{
1175cc1dc7a3Sopenharmony_ci	vint4 a(11, 22, 33, 44);
1176cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 11);
1177cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 22);
1178cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 33);
1179cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 44);
1180cc1dc7a3Sopenharmony_ci}
1181cc1dc7a3Sopenharmony_ci
1182cc1dc7a3Sopenharmony_ci/** @brief Test copy vint4 load. */
1183cc1dc7a3Sopenharmony_ciTEST(vint4, CopyLoad)
1184cc1dc7a3Sopenharmony_ci{
1185cc1dc7a3Sopenharmony_ci	vint4 s(11, 22, 33, 44);
1186cc1dc7a3Sopenharmony_ci	vint4 a(s.m);
1187cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 11);
1188cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 22);
1189cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 33);
1190cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 44);
1191cc1dc7a3Sopenharmony_ci}
1192cc1dc7a3Sopenharmony_ci
1193cc1dc7a3Sopenharmony_ci/** @brief Test vint4 scalar lane set. */
1194cc1dc7a3Sopenharmony_ciTEST(int4, SetLane)
1195cc1dc7a3Sopenharmony_ci{
1196cc1dc7a3Sopenharmony_ci	vint4 a(0);
1197cc1dc7a3Sopenharmony_ci
1198cc1dc7a3Sopenharmony_ci	a.set_lane<0>(1);
1199cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1200cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0);
1201cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0);
1202cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0);
1203cc1dc7a3Sopenharmony_ci
1204cc1dc7a3Sopenharmony_ci	a.set_lane<1>(2);
1205cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1206cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1207cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0);
1208cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0);
1209cc1dc7a3Sopenharmony_ci
1210cc1dc7a3Sopenharmony_ci	a.set_lane<2>(3);
1211cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1212cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1213cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
1214cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0);
1215cc1dc7a3Sopenharmony_ci
1216cc1dc7a3Sopenharmony_ci	a.set_lane<3>(4);
1217cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1218cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1219cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
1220cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
1221cc1dc7a3Sopenharmony_ci}
1222cc1dc7a3Sopenharmony_ci
1223cc1dc7a3Sopenharmony_ci/** @brief Test vint4 zero. */
1224cc1dc7a3Sopenharmony_ciTEST(vint4, Zero)
1225cc1dc7a3Sopenharmony_ci{
1226cc1dc7a3Sopenharmony_ci	vint4 a = vint4::zero();
1227cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
1228cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0);
1229cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0);
1230cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0);
1231cc1dc7a3Sopenharmony_ci}
1232cc1dc7a3Sopenharmony_ci
1233cc1dc7a3Sopenharmony_ci/** @brief Test vint4 load1. */
1234cc1dc7a3Sopenharmony_ciTEST(vint4, Load1)
1235cc1dc7a3Sopenharmony_ci{
1236cc1dc7a3Sopenharmony_ci	int s = 42;
1237cc1dc7a3Sopenharmony_ci	vint4 a = vint4::load1(&s);
1238cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 42);
1239cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 42);
1240cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 42);
1241cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 42);
1242cc1dc7a3Sopenharmony_ci}
1243cc1dc7a3Sopenharmony_ci
1244cc1dc7a3Sopenharmony_ci/** @brief Test vint4 loada. */
1245cc1dc7a3Sopenharmony_ciTEST(vint4, Loada)
1246cc1dc7a3Sopenharmony_ci{
1247cc1dc7a3Sopenharmony_ci	vint4 a = vint4::loada(&(s32_data[0]));
1248cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
1249cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
1250cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2);
1251cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3);
1252cc1dc7a3Sopenharmony_ci}
1253cc1dc7a3Sopenharmony_ci
1254cc1dc7a3Sopenharmony_ci/** @brief Test vint4 lane_id. */
1255cc1dc7a3Sopenharmony_ciTEST(vint4, LaneID)
1256cc1dc7a3Sopenharmony_ci{
1257cc1dc7a3Sopenharmony_ci	vint4 a = vint4::lane_id();
1258cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
1259cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
1260cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2);
1261cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3);
1262cc1dc7a3Sopenharmony_ci}
1263cc1dc7a3Sopenharmony_ci
1264cc1dc7a3Sopenharmony_ci/** @brief Test vint4 add. */
1265cc1dc7a3Sopenharmony_ciTEST(vint4, vadd)
1266cc1dc7a3Sopenharmony_ci{
1267cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1268cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 4, 5);
1269cc1dc7a3Sopenharmony_ci	a = a + b;
1270cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 + 2);
1271cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 + 3);
1272cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3 + 4);
1273cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 + 5);
1274cc1dc7a3Sopenharmony_ci}
1275cc1dc7a3Sopenharmony_ci
1276cc1dc7a3Sopenharmony_ci/** @brief Test vint4 self-add. */
1277cc1dc7a3Sopenharmony_ciTEST(vint4, vselfadd)
1278cc1dc7a3Sopenharmony_ci{
1279cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1280cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 4, 5);
1281cc1dc7a3Sopenharmony_ci	a += b;
1282cc1dc7a3Sopenharmony_ci
1283cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 + 2);
1284cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 + 3);
1285cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3 + 4);
1286cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 + 5);
1287cc1dc7a3Sopenharmony_ci}
1288cc1dc7a3Sopenharmony_ci
1289cc1dc7a3Sopenharmony_ci/** @brief Test vint4 add. */
1290cc1dc7a3Sopenharmony_ciTEST(vint4, vsadd)
1291cc1dc7a3Sopenharmony_ci{
1292cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1293cc1dc7a3Sopenharmony_ci	int b = 5;
1294cc1dc7a3Sopenharmony_ci	a = a + b;
1295cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 + 5);
1296cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 + 5);
1297cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3 + 5);
1298cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 + 5);
1299cc1dc7a3Sopenharmony_ci}
1300cc1dc7a3Sopenharmony_ci
1301cc1dc7a3Sopenharmony_ci/** @brief Test vint4 sub. */
1302cc1dc7a3Sopenharmony_ciTEST(vint4, vsub)
1303cc1dc7a3Sopenharmony_ci{
1304cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, 4);
1305cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 3, 5);
1306cc1dc7a3Sopenharmony_ci	a = a - b;
1307cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 - 2);
1308cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 - 3);
1309cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4 - 3);
1310cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 - 5);
1311cc1dc7a3Sopenharmony_ci}
1312cc1dc7a3Sopenharmony_ci
1313cc1dc7a3Sopenharmony_ci/** @brief Test vint4 sub. */
1314cc1dc7a3Sopenharmony_ciTEST(vint4, vssub)
1315cc1dc7a3Sopenharmony_ci{
1316cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, 4);
1317cc1dc7a3Sopenharmony_ci	int b = 5;
1318cc1dc7a3Sopenharmony_ci	a = a - b;
1319cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 - 5);
1320cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 - 5);
1321cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4 - 5);
1322cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 - 5);
1323cc1dc7a3Sopenharmony_ci}
1324cc1dc7a3Sopenharmony_ci
1325cc1dc7a3Sopenharmony_ci/** @brief Test vint4 mul. */
1326cc1dc7a3Sopenharmony_ciTEST(vint4, vmul)
1327cc1dc7a3Sopenharmony_ci{
1328cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, 4);
1329cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 3, 5);
1330cc1dc7a3Sopenharmony_ci	a = a * b;
1331cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 * 2);
1332cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 * 3);
1333cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4 * 3);
1334cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 * 5);
1335cc1dc7a3Sopenharmony_ci}
1336cc1dc7a3Sopenharmony_ci
1337cc1dc7a3Sopenharmony_ci/** @brief Test vint4 mul. */
1338cc1dc7a3Sopenharmony_ciTEST(vint4, vsmul)
1339cc1dc7a3Sopenharmony_ci{
1340cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, 4);
1341cc1dc7a3Sopenharmony_ci	a = a * 3;
1342cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 * 3);
1343cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 * 3);
1344cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4 * 3);
1345cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 * 3);
1346cc1dc7a3Sopenharmony_ci
1347cc1dc7a3Sopenharmony_ci	vint4 b(1, 2, -4, 4);
1348cc1dc7a3Sopenharmony_ci	b = b * -3;
1349cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<0>(), 1 * -3);
1350cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<1>(), 2 * -3);
1351cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<2>(), -4 * -3);
1352cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<3>(), 4 * -3);
1353cc1dc7a3Sopenharmony_ci}
1354cc1dc7a3Sopenharmony_ci
1355cc1dc7a3Sopenharmony_ci/** @brief Test vint4 bitwise invert. */
1356cc1dc7a3Sopenharmony_ciTEST(vint4, bit_invert)
1357cc1dc7a3Sopenharmony_ci{
1358cc1dc7a3Sopenharmony_ci	vint4 a(-1, 0, 1, 2);
1359cc1dc7a3Sopenharmony_ci	a = ~a;
1360cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), ~-1);
1361cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), ~0);
1362cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), ~1);
1363cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), ~2);
1364cc1dc7a3Sopenharmony_ci}
1365cc1dc7a3Sopenharmony_ci
1366cc1dc7a3Sopenharmony_ci/** @brief Test vint4 bitwise or. */
1367cc1dc7a3Sopenharmony_ciTEST(vint4, bit_vor)
1368cc1dc7a3Sopenharmony_ci{
1369cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1370cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 4, 5);
1371cc1dc7a3Sopenharmony_ci	a = a | b;
1372cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3);
1373cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 3);
1374cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 7);
1375cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 5);
1376cc1dc7a3Sopenharmony_ci}
1377cc1dc7a3Sopenharmony_ci
1378cc1dc7a3Sopenharmony_ciTEST(vint4, bit_vsor)
1379cc1dc7a3Sopenharmony_ci{
1380cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1381cc1dc7a3Sopenharmony_ci	int b = 2;
1382cc1dc7a3Sopenharmony_ci	a = a | b;
1383cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3);
1384cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1385cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
1386cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 6);
1387cc1dc7a3Sopenharmony_ci}
1388cc1dc7a3Sopenharmony_ci
1389cc1dc7a3Sopenharmony_ci/** @brief Test vint4 bitwise and. */
1390cc1dc7a3Sopenharmony_ciTEST(vint4, bit_vand)
1391cc1dc7a3Sopenharmony_ci{
1392cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1393cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 4, 5);
1394cc1dc7a3Sopenharmony_ci	a = a & b;
1395cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
1396cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1397cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0);
1398cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
1399cc1dc7a3Sopenharmony_ci}
1400cc1dc7a3Sopenharmony_ci
1401cc1dc7a3Sopenharmony_ci/** @brief Test vint4 bitwise and. */
1402cc1dc7a3Sopenharmony_ciTEST(vint4, bit_vsand)
1403cc1dc7a3Sopenharmony_ci{
1404cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1405cc1dc7a3Sopenharmony_ci	int b = 2;
1406cc1dc7a3Sopenharmony_ci	a = a & b;
1407cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
1408cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1409cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2);
1410cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0);
1411cc1dc7a3Sopenharmony_ci}
1412cc1dc7a3Sopenharmony_ci
1413cc1dc7a3Sopenharmony_ci/** @brief Test vint4 bitwise xor. */
1414cc1dc7a3Sopenharmony_ciTEST(vint4, bit_vxor)
1415cc1dc7a3Sopenharmony_ci{
1416cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1417cc1dc7a3Sopenharmony_ci	vint4 b(2, 3, 4, 5);
1418cc1dc7a3Sopenharmony_ci	a = a ^ b;
1419cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3);
1420cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
1421cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 7);
1422cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 1);
1423cc1dc7a3Sopenharmony_ci}
1424cc1dc7a3Sopenharmony_ci
1425cc1dc7a3Sopenharmony_ci/** @brief Test vint4 bitwise xor. */
1426cc1dc7a3Sopenharmony_ciTEST(vint4, bit_vsxor)
1427cc1dc7a3Sopenharmony_ci{
1428cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1429cc1dc7a3Sopenharmony_ci	int b = 2;
1430cc1dc7a3Sopenharmony_ci	a = a ^ b;
1431cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3);
1432cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0);
1433cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 1);
1434cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 6);
1435cc1dc7a3Sopenharmony_ci}
1436cc1dc7a3Sopenharmony_ci
1437cc1dc7a3Sopenharmony_ci/** @brief Test vint4 ceq. */
1438cc1dc7a3Sopenharmony_ciTEST(vint4, ceq)
1439cc1dc7a3Sopenharmony_ci{
1440cc1dc7a3Sopenharmony_ci	vint4 a1(1, 2, 3, 4);
1441cc1dc7a3Sopenharmony_ci	vint4 b1(0, 1, 2, 3);
1442cc1dc7a3Sopenharmony_ci	vmask4 r1 = a1 == b1;
1443cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r1));
1444cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r1));
1445cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r1));
1446cc1dc7a3Sopenharmony_ci
1447cc1dc7a3Sopenharmony_ci	vint4 a2(1, 2, 3, 4);
1448cc1dc7a3Sopenharmony_ci	vint4 b2(1, 0, 0, 0);
1449cc1dc7a3Sopenharmony_ci	vmask4 r2 = a2 == b2;
1450cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x1u, mask(r2));
1451cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
1452cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
1453cc1dc7a3Sopenharmony_ci
1454cc1dc7a3Sopenharmony_ci	vint4 a3(1, 2, 3, 4);
1455cc1dc7a3Sopenharmony_ci	vint4 b3(1, 0, 3, 0);
1456cc1dc7a3Sopenharmony_ci	vmask4 r3 = a3 == b3;
1457cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x5u, mask(r3));
1458cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
1459cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
1460cc1dc7a3Sopenharmony_ci
1461cc1dc7a3Sopenharmony_ci	vint4 a4(1, 2, 3, 4);
1462cc1dc7a3Sopenharmony_ci	vmask4 r4 = a4 == a4;
1463cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFu, mask(r4));
1464cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r4));
1465cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r4));
1466cc1dc7a3Sopenharmony_ci}
1467cc1dc7a3Sopenharmony_ci
1468cc1dc7a3Sopenharmony_ci/** @brief Test vint4 cne. */
1469cc1dc7a3Sopenharmony_ciTEST(vint4, cne)
1470cc1dc7a3Sopenharmony_ci{
1471cc1dc7a3Sopenharmony_ci	vint4 a1(1, 2, 3, 4);
1472cc1dc7a3Sopenharmony_ci	vint4 b1(0, 1, 2, 3);
1473cc1dc7a3Sopenharmony_ci	vmask4 r1 = a1 != b1;
1474cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFu, mask(r1));
1475cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r1));
1476cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r1));
1477cc1dc7a3Sopenharmony_ci
1478cc1dc7a3Sopenharmony_ci	vint4 a2(1, 2, 3, 4);
1479cc1dc7a3Sopenharmony_ci	vint4 b2(1, 0, 0, 0);
1480cc1dc7a3Sopenharmony_ci	vmask4 r2 = a2 != b2;
1481cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xEu, mask(r2));
1482cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
1483cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
1484cc1dc7a3Sopenharmony_ci
1485cc1dc7a3Sopenharmony_ci	vint4 a3(1, 2, 3, 4);
1486cc1dc7a3Sopenharmony_ci	vint4 b3(1, 0, 3, 0);
1487cc1dc7a3Sopenharmony_ci	vmask4 r3 = a3 != b3;
1488cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAu, mask(r3));
1489cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
1490cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
1491cc1dc7a3Sopenharmony_ci
1492cc1dc7a3Sopenharmony_ci	vint4 a4(1, 2, 3, 4);
1493cc1dc7a3Sopenharmony_ci	vmask4 r4 = a4 != a4;
1494cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r4));
1495cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r4));
1496cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r4));
1497cc1dc7a3Sopenharmony_ci}
1498cc1dc7a3Sopenharmony_ci
1499cc1dc7a3Sopenharmony_ci/** @brief Test vint4 clt. */
1500cc1dc7a3Sopenharmony_ciTEST(vint4, clt)
1501cc1dc7a3Sopenharmony_ci{
1502cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1503cc1dc7a3Sopenharmony_ci	vint4 b(0, 3, 3, 5);
1504cc1dc7a3Sopenharmony_ci	vmask4 r = a < b;
1505cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAu, mask(r));
1506cc1dc7a3Sopenharmony_ci}
1507cc1dc7a3Sopenharmony_ci
1508cc1dc7a3Sopenharmony_ci/** @brief Test vint4 cgt. */
1509cc1dc7a3Sopenharmony_ciTEST(vint4, cle)
1510cc1dc7a3Sopenharmony_ci{
1511cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1512cc1dc7a3Sopenharmony_ci	vint4 b(0, 3, 3, 5);
1513cc1dc7a3Sopenharmony_ci	vmask4 r = a > b;
1514cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x1u, mask(r));
1515cc1dc7a3Sopenharmony_ci}
1516cc1dc7a3Sopenharmony_ci
1517cc1dc7a3Sopenharmony_ci/** @brief Test vint4 lsl. */
1518cc1dc7a3Sopenharmony_ciTEST(vint4, lsl)
1519cc1dc7a3Sopenharmony_ci{
1520cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, 4);
1521cc1dc7a3Sopenharmony_ci	a = lsl<0>(a);
1522cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
1523cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
1524cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4);
1525cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
1526cc1dc7a3Sopenharmony_ci
1527cc1dc7a3Sopenharmony_ci	a = lsl<1>(a);
1528cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 2);
1529cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 4);
1530cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 8);
1531cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 8);
1532cc1dc7a3Sopenharmony_ci
1533cc1dc7a3Sopenharmony_ci	a = lsl<2>(a);
1534cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 8);
1535cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 16);
1536cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 32);
1537cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 32);
1538cc1dc7a3Sopenharmony_ci}
1539cc1dc7a3Sopenharmony_ci
1540cc1dc7a3Sopenharmony_ci/** @brief Test vint4 lsr. */
1541cc1dc7a3Sopenharmony_ciTEST(vint4, lsr)
1542cc1dc7a3Sopenharmony_ci{
1543cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, -4);
1544cc1dc7a3Sopenharmony_ci	a = lsr<0>(a);
1545cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  1);
1546cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  2);
1547cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  4);
1548cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(),  static_cast<int>(0xFFFFFFFC));
1549cc1dc7a3Sopenharmony_ci
1550cc1dc7a3Sopenharmony_ci	a = lsr<1>(a);
1551cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
1552cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  1);
1553cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  2);
1554cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(),  0x7FFFFFFE);
1555cc1dc7a3Sopenharmony_ci
1556cc1dc7a3Sopenharmony_ci	a = lsr<2>(a);
1557cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
1558cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  0);
1559cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  0);
1560cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(),  0x1FFFFFFF);
1561cc1dc7a3Sopenharmony_ci}
1562cc1dc7a3Sopenharmony_ci
1563cc1dc7a3Sopenharmony_ci/** @brief Test vint4 asr. */
1564cc1dc7a3Sopenharmony_ciTEST(vint4, asr)
1565cc1dc7a3Sopenharmony_ci{
1566cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 4, -4);
1567cc1dc7a3Sopenharmony_ci	a = asr<0>(a);
1568cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  1);
1569cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  2);
1570cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  4);
1571cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), -4);
1572cc1dc7a3Sopenharmony_ci
1573cc1dc7a3Sopenharmony_ci	a = asr<1>(a);
1574cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
1575cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  1);
1576cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  2);
1577cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), -2);
1578cc1dc7a3Sopenharmony_ci
1579cc1dc7a3Sopenharmony_ci	// Note - quirk of asr is that you will get "stuck" at -1
1580cc1dc7a3Sopenharmony_ci	a = asr<2>(a);
1581cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
1582cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  0);
1583cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  0);
1584cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), -1);
1585cc1dc7a3Sopenharmony_ci}
1586cc1dc7a3Sopenharmony_ci
1587cc1dc7a3Sopenharmony_ci/** @brief Test vint4 min. */
1588cc1dc7a3Sopenharmony_ciTEST(vint4, min)
1589cc1dc7a3Sopenharmony_ci{
1590cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1591cc1dc7a3Sopenharmony_ci	vint4 b(0, 3, 3, 5);
1592cc1dc7a3Sopenharmony_ci	vint4 r = min(a, b);
1593cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0);
1594cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2);
1595cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
1596cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4);
1597cc1dc7a3Sopenharmony_ci}
1598cc1dc7a3Sopenharmony_ci
1599cc1dc7a3Sopenharmony_ci/** @brief Test vint4 max. */
1600cc1dc7a3Sopenharmony_ciTEST(vint4, max)
1601cc1dc7a3Sopenharmony_ci{
1602cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1603cc1dc7a3Sopenharmony_ci	vint4 b(0, 3, 3, 5);
1604cc1dc7a3Sopenharmony_ci	vint4 r = max(a, b);
1605cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1);
1606cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 3);
1607cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
1608cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 5);
1609cc1dc7a3Sopenharmony_ci}
1610cc1dc7a3Sopenharmony_ci
1611cc1dc7a3Sopenharmony_ci/** @brief Test vint4 clamp. */
1612cc1dc7a3Sopenharmony_ciTEST(vint4, clamp)
1613cc1dc7a3Sopenharmony_ci{
1614cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1615cc1dc7a3Sopenharmony_ci	vint4 r = clamp(2, 3, a);
1616cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 2);
1617cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2);
1618cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
1619cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 3);
1620cc1dc7a3Sopenharmony_ci}
1621cc1dc7a3Sopenharmony_ci
1622cc1dc7a3Sopenharmony_ci/** @brief Test vint4 hmin. */
1623cc1dc7a3Sopenharmony_ciTEST(vint4, hmin)
1624cc1dc7a3Sopenharmony_ci{
1625cc1dc7a3Sopenharmony_ci	vint4 a1(1, 2, 1, 2);
1626cc1dc7a3Sopenharmony_ci	vint4 r1 = hmin(a1);
1627cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 1);
1628cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 1);
1629cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 1);
1630cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1);
1631cc1dc7a3Sopenharmony_ci
1632cc1dc7a3Sopenharmony_ci	vint4 a2(1, 2, -1, 5);
1633cc1dc7a3Sopenharmony_ci	vint4 r2 = hmin(a2);
1634cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), -1);
1635cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), -1);
1636cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), -1);
1637cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), -1);
1638cc1dc7a3Sopenharmony_ci}
1639cc1dc7a3Sopenharmony_ci
1640cc1dc7a3Sopenharmony_ci/** @brief Test vint4 hmax. */
1641cc1dc7a3Sopenharmony_ciTEST(vint4, hmax)
1642cc1dc7a3Sopenharmony_ci{
1643cc1dc7a3Sopenharmony_ci	vint4 a1(1, 3, 1, 2);
1644cc1dc7a3Sopenharmony_ci	vint4 r1 = hmax(a1);
1645cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 3);
1646cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3);
1647cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 3);
1648cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3);
1649cc1dc7a3Sopenharmony_ci
1650cc1dc7a3Sopenharmony_ci	vint4 a2(1, 2, -1, 5);
1651cc1dc7a3Sopenharmony_ci	vint4 r2 = hmax(a2);
1652cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 5);
1653cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 5);
1654cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 5);
1655cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 5);
1656cc1dc7a3Sopenharmony_ci}
1657cc1dc7a3Sopenharmony_ci
1658cc1dc7a3Sopenharmony_ci/** @brief Test vint4 hadd_s. */
1659cc1dc7a3Sopenharmony_ciTEST(vint4, hadd_s)
1660cc1dc7a3Sopenharmony_ci{
1661cc1dc7a3Sopenharmony_ci	vint4 a1(1, 3, 5, 7);
1662cc1dc7a3Sopenharmony_ci	int r1 = hadd_s(a1);
1663cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 16);
1664cc1dc7a3Sopenharmony_ci
1665cc1dc7a3Sopenharmony_ci	vint4 a2(1, 2, -1, 5);
1666cc1dc7a3Sopenharmony_ci	int r2 = hadd_s(a2);
1667cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 7);
1668cc1dc7a3Sopenharmony_ci}
1669cc1dc7a3Sopenharmony_ci
1670cc1dc7a3Sopenharmony_ci/** @brief Test vint4 hadd_rgb_s. */
1671cc1dc7a3Sopenharmony_ciTEST(vint4, hadd_rgb_s)
1672cc1dc7a3Sopenharmony_ci{
1673cc1dc7a3Sopenharmony_ci	vint4 a1(1, 3, 5, 7);
1674cc1dc7a3Sopenharmony_ci	int r1 = hadd_rgb_s(a1);
1675cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 9);
1676cc1dc7a3Sopenharmony_ci
1677cc1dc7a3Sopenharmony_ci	vint4 a2(1, 2, -1, 5);
1678cc1dc7a3Sopenharmony_ci	int r2 = hadd_rgb_s(a2);
1679cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 2);
1680cc1dc7a3Sopenharmony_ci}
1681cc1dc7a3Sopenharmony_ci
1682cc1dc7a3Sopenharmony_ci/** @brief Test vint4 clz. */
1683cc1dc7a3Sopenharmony_ciTEST(vint4, clz)
1684cc1dc7a3Sopenharmony_ci{
1685cc1dc7a3Sopenharmony_ci	int msb_set = static_cast<int>(0x80000000);
1686cc1dc7a3Sopenharmony_ci	vint4 a1(msb_set, 0x40000000, 0x20000000, 0x10000000);
1687cc1dc7a3Sopenharmony_ci	vint4 r1 = clz(a1);
1688cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 0);
1689cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 1);
1690cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2);
1691cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3);
1692cc1dc7a3Sopenharmony_ci
1693cc1dc7a3Sopenharmony_ci	vint4 a2(0x0, 0x1, 0x2, 0x4);
1694cc1dc7a3Sopenharmony_ci	vint4 r2 = clz(a2);
1695cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 32);
1696cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 31);
1697cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 30);
1698cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 29);
1699cc1dc7a3Sopenharmony_ci}
1700cc1dc7a3Sopenharmony_ci
1701cc1dc7a3Sopenharmony_ci/** @brief Test vint4 two_to_the_n. */
1702cc1dc7a3Sopenharmony_ciTEST(vint4, two_to_the_n)
1703cc1dc7a3Sopenharmony_ci{
1704cc1dc7a3Sopenharmony_ci	vint4 a1(0, 1, 2, 3);
1705cc1dc7a3Sopenharmony_ci	vint4 r1 = two_to_the_n(a1);
1706cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 1 << 0);
1707cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 1 << 1);
1708cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 1 << 2);
1709cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1 << 3);
1710cc1dc7a3Sopenharmony_ci
1711cc1dc7a3Sopenharmony_ci	vint4 a2(27, 28, 29, 30);
1712cc1dc7a3Sopenharmony_ci	vint4 r2 = two_to_the_n(a2);
1713cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1 << 27);
1714cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 1 << 28);
1715cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 1 << 29);
1716cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 1 << 30);
1717cc1dc7a3Sopenharmony_ci
1718cc1dc7a3Sopenharmony_ci	// Shifts higher than 30 are not allowed as it overflows the int type;
1719cc1dc7a3Sopenharmony_ci	// and results in implementation-defined behavior because of how we
1720cc1dc7a3Sopenharmony_ci	// generate the shifted result in two_to_the_n().
1721cc1dc7a3Sopenharmony_ci	// -  Shift by 31 shifts into sign bit
1722cc1dc7a3Sopenharmony_ci	// -  Shift by 32 shifts off the end
1723cc1dc7a3Sopenharmony_ci}
1724cc1dc7a3Sopenharmony_ci
1725cc1dc7a3Sopenharmony_ci/** @brief Test vint4 storea. */
1726cc1dc7a3Sopenharmony_ciTEST(vint4, storea)
1727cc1dc7a3Sopenharmony_ci{
1728cc1dc7a3Sopenharmony_ci	ASTCENC_ALIGNAS int out[4];
1729cc1dc7a3Sopenharmony_ci	vint4 a(s32_data);
1730cc1dc7a3Sopenharmony_ci	storea(a, out);
1731cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[0], 0);
1732cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 1);
1733cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 2);
1734cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 3);
1735cc1dc7a3Sopenharmony_ci}
1736cc1dc7a3Sopenharmony_ci
1737cc1dc7a3Sopenharmony_ci/** @brief Test vint4 store. */
1738cc1dc7a3Sopenharmony_ciTEST(vint4, store)
1739cc1dc7a3Sopenharmony_ci{
1740cc1dc7a3Sopenharmony_ci	ASTCENC_ALIGNAS int out[5];
1741cc1dc7a3Sopenharmony_ci	vint4 a(s32_data);
1742cc1dc7a3Sopenharmony_ci	store(a, &(out[1]));
1743cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 0);
1744cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 1);
1745cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 2);
1746cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[4], 3);
1747cc1dc7a3Sopenharmony_ci}
1748cc1dc7a3Sopenharmony_ci
1749cc1dc7a3Sopenharmony_ci/** @brief Test vint4 store_nbytes. */
1750cc1dc7a3Sopenharmony_ciTEST(vint4, store_nbytes)
1751cc1dc7a3Sopenharmony_ci{
1752cc1dc7a3Sopenharmony_ci	ASTCENC_ALIGNAS int out;
1753cc1dc7a3Sopenharmony_ci	vint4 a(42, 314, 75, 90);
1754cc1dc7a3Sopenharmony_ci	store_nbytes(a, reinterpret_cast<uint8_t*>(&out));
1755cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out, 42);
1756cc1dc7a3Sopenharmony_ci}
1757cc1dc7a3Sopenharmony_ci
1758cc1dc7a3Sopenharmony_ci/** @brief Test vint4 store_lanes_masked. */
1759cc1dc7a3Sopenharmony_ciTEST(vint4, store_lanes_masked)
1760cc1dc7a3Sopenharmony_ci{
1761cc1dc7a3Sopenharmony_ci	uint8_t resulta[16] { 0 };
1762cc1dc7a3Sopenharmony_ci
1763cc1dc7a3Sopenharmony_ci	// Store nothing
1764cc1dc7a3Sopenharmony_ci	vmask4 mask1 = vint4(0) == vint4(1);
1765cc1dc7a3Sopenharmony_ci	vint4 data1 = vint4(1);
1766cc1dc7a3Sopenharmony_ci
1767cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta, data1, mask1);
1768cc1dc7a3Sopenharmony_ci	vint4 result1v = vint4::load(resulta);
1769cc1dc7a3Sopenharmony_ci	vint4 expect1v = vint4::zero();
1770cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result1v == expect1v));
1771cc1dc7a3Sopenharmony_ci
1772cc1dc7a3Sopenharmony_ci	// Store half
1773cc1dc7a3Sopenharmony_ci	vmask4 mask2 = vint4(1, 1, 0, 0) == vint4(1);
1774cc1dc7a3Sopenharmony_ci	vint4 data2 = vint4(2);
1775cc1dc7a3Sopenharmony_ci
1776cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta, data2, mask2);
1777cc1dc7a3Sopenharmony_ci	vint4 result2v = vint4::load(resulta);
1778cc1dc7a3Sopenharmony_ci	vint4 expect2v = vint4(2, 2, 0, 0);
1779cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result2v == expect2v));
1780cc1dc7a3Sopenharmony_ci
1781cc1dc7a3Sopenharmony_ci	// Store all
1782cc1dc7a3Sopenharmony_ci	vmask4 mask3 = vint4(1) == vint4(1);
1783cc1dc7a3Sopenharmony_ci	vint4 data3 = vint4(3);
1784cc1dc7a3Sopenharmony_ci
1785cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta, data3, mask3);
1786cc1dc7a3Sopenharmony_ci	vint4 result3v = vint4::load(resulta);
1787cc1dc7a3Sopenharmony_ci	vint4 expect3v = vint4(3);
1788cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result3v == expect3v));
1789cc1dc7a3Sopenharmony_ci}
1790cc1dc7a3Sopenharmony_ci
1791cc1dc7a3Sopenharmony_ci/** @brief Test vint4 store_lanes_masked to unaligned address. */
1792cc1dc7a3Sopenharmony_ciTEST(vint4, store_lanes_masked_unaligned)
1793cc1dc7a3Sopenharmony_ci{
1794cc1dc7a3Sopenharmony_ci	uint8_t resulta[17] { 0 };
1795cc1dc7a3Sopenharmony_ci
1796cc1dc7a3Sopenharmony_ci	// Store nothing
1797cc1dc7a3Sopenharmony_ci	vmask4 mask1 = vint4(0) == vint4(1);
1798cc1dc7a3Sopenharmony_ci	vint4 data1 = vint4(1);
1799cc1dc7a3Sopenharmony_ci
1800cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta + 1, data1, mask1);
1801cc1dc7a3Sopenharmony_ci	vint4 result1v = vint4::load(resulta + 1);
1802cc1dc7a3Sopenharmony_ci	vint4 expect1v = vint4::zero();
1803cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result1v == expect1v));
1804cc1dc7a3Sopenharmony_ci
1805cc1dc7a3Sopenharmony_ci	// Store half
1806cc1dc7a3Sopenharmony_ci	vmask4 mask2 = vint4(1, 1, 0, 0) == vint4(1);
1807cc1dc7a3Sopenharmony_ci	vint4 data2 = vint4(2);
1808cc1dc7a3Sopenharmony_ci
1809cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta + 1, data2, mask2);
1810cc1dc7a3Sopenharmony_ci	vint4 result2v = vint4::load(resulta + 1);
1811cc1dc7a3Sopenharmony_ci	vint4 expect2v = vint4(2, 2, 0, 0);
1812cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result2v == expect2v));
1813cc1dc7a3Sopenharmony_ci
1814cc1dc7a3Sopenharmony_ci	// Store all
1815cc1dc7a3Sopenharmony_ci	vmask4 mask3 = vint4(1) == vint4(1);
1816cc1dc7a3Sopenharmony_ci	vint4 data3 = vint4(3);
1817cc1dc7a3Sopenharmony_ci
1818cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta + 1, data3, mask3);
1819cc1dc7a3Sopenharmony_ci	vint4 result3v = vint4::load(resulta + 1);
1820cc1dc7a3Sopenharmony_ci	vint4 expect3v = vint4(3);
1821cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result3v == expect3v));
1822cc1dc7a3Sopenharmony_ci}
1823cc1dc7a3Sopenharmony_ci
1824cc1dc7a3Sopenharmony_ci/** @brief Test vint4 gatheri. */
1825cc1dc7a3Sopenharmony_ciTEST(vint4, gatheri)
1826cc1dc7a3Sopenharmony_ci{
1827cc1dc7a3Sopenharmony_ci	vint4 indices(0, 4, 3, 2);
1828cc1dc7a3Sopenharmony_ci	vint4 r = gatheri(s32_data, indices);
1829cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0);
1830cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4);
1831cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
1832cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 2);
1833cc1dc7a3Sopenharmony_ci}
1834cc1dc7a3Sopenharmony_ci
1835cc1dc7a3Sopenharmony_ci/** @brief Test vint4 pack_low_bytes. */
1836cc1dc7a3Sopenharmony_ciTEST(vint4, pack_low_bytes)
1837cc1dc7a3Sopenharmony_ci{
1838cc1dc7a3Sopenharmony_ci	vint4 a(1, 2, 3, 4);
1839cc1dc7a3Sopenharmony_ci	vint4 r = pack_low_bytes(a);
1840cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), (4 << 24) | (3 << 16) | (2  << 8) | (1 << 0));
1841cc1dc7a3Sopenharmony_ci}
1842cc1dc7a3Sopenharmony_ci
1843cc1dc7a3Sopenharmony_ci/** @brief Test vint4 select. */
1844cc1dc7a3Sopenharmony_ciTEST(vint4, select)
1845cc1dc7a3Sopenharmony_ci{
1846cc1dc7a3Sopenharmony_ci	vint4 m1(1, 1, 1, 1);
1847cc1dc7a3Sopenharmony_ci	vint4 m2(1, 2, 1, 2);
1848cc1dc7a3Sopenharmony_ci	vmask4 cond = m1 == m2;
1849cc1dc7a3Sopenharmony_ci
1850cc1dc7a3Sopenharmony_ci	vint4 a(1, 3, 3, 1);
1851cc1dc7a3Sopenharmony_ci	vint4 b(4, 2, 2, 4);
1852cc1dc7a3Sopenharmony_ci
1853cc1dc7a3Sopenharmony_ci	vint4 r1 = select(a, b, cond);
1854cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4);
1855cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3);
1856cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2);
1857cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1);
1858cc1dc7a3Sopenharmony_ci
1859cc1dc7a3Sopenharmony_ci	vint4 r2 = select(b, a, cond);
1860cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1);
1861cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2);
1862cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 3);
1863cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 4);
1864cc1dc7a3Sopenharmony_ci}
1865cc1dc7a3Sopenharmony_ci
1866cc1dc7a3Sopenharmony_ci// VMASK4 tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1867cc1dc7a3Sopenharmony_ci/** @brief Test vmask4 scalar literal constructor. */
1868cc1dc7a3Sopenharmony_ciTEST(vmask4, scalar_literal_construct)
1869cc1dc7a3Sopenharmony_ci{
1870cc1dc7a3Sopenharmony_ci	vfloat4 m1a(0.0f, 0.0f, 0.0f, 0.0f);
1871cc1dc7a3Sopenharmony_ci	vfloat4 m1b(1.0f, 1.0f, 1.0f, 1.0f);
1872cc1dc7a3Sopenharmony_ci	vmask4 m1(true);
1873cc1dc7a3Sopenharmony_ci
1874cc1dc7a3Sopenharmony_ci	vfloat4 r = select(m1a, m1b, m1);
1875cc1dc7a3Sopenharmony_ci
1876cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
1877cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 1.0f);
1878cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 1.0f);
1879cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 1.0f);
1880cc1dc7a3Sopenharmony_ci
1881cc1dc7a3Sopenharmony_ci	r = select(m1b, m1a, m1);
1882cc1dc7a3Sopenharmony_ci
1883cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.0f);
1884cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0.0f);
1885cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 0.0f);
1886cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.0f);
1887cc1dc7a3Sopenharmony_ci}
1888cc1dc7a3Sopenharmony_ci
1889cc1dc7a3Sopenharmony_ci/** @brief Test vmask4 literal constructor. */
1890cc1dc7a3Sopenharmony_ciTEST(vmask4, literal_construct)
1891cc1dc7a3Sopenharmony_ci{
1892cc1dc7a3Sopenharmony_ci	vfloat4 m1a(0.0f, 0.0f, 0.0f, 0.0f);
1893cc1dc7a3Sopenharmony_ci	vfloat4 m1b(1.0f, 1.0f, 1.0f, 1.0f);
1894cc1dc7a3Sopenharmony_ci	vmask4 m1(true, false, true, false);
1895cc1dc7a3Sopenharmony_ci
1896cc1dc7a3Sopenharmony_ci	vfloat4 r = select(m1a, m1b, m1);
1897cc1dc7a3Sopenharmony_ci
1898cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
1899cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0.0f);
1900cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 1.0f);
1901cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.0f);
1902cc1dc7a3Sopenharmony_ci}
1903cc1dc7a3Sopenharmony_ci
1904cc1dc7a3Sopenharmony_ci/** @brief Test vmask4 or. */
1905cc1dc7a3Sopenharmony_ciTEST(vmask4, or)
1906cc1dc7a3Sopenharmony_ci{
1907cc1dc7a3Sopenharmony_ci	vfloat4 m1a(0, 1, 0, 1);
1908cc1dc7a3Sopenharmony_ci	vfloat4 m1b(1, 1, 1, 1);
1909cc1dc7a3Sopenharmony_ci	vmask4 m1 = m1a == m1b;
1910cc1dc7a3Sopenharmony_ci
1911cc1dc7a3Sopenharmony_ci	vfloat4 m2a(1, 1, 0, 0);
1912cc1dc7a3Sopenharmony_ci	vfloat4 m2b(1, 1, 1, 1);
1913cc1dc7a3Sopenharmony_ci	vmask4 m2 = m2a == m2b;
1914cc1dc7a3Sopenharmony_ci
1915cc1dc7a3Sopenharmony_ci	vmask4 r = m1 | m2;
1916cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0xBu);
1917cc1dc7a3Sopenharmony_ci}
1918cc1dc7a3Sopenharmony_ci
1919cc1dc7a3Sopenharmony_ci/** @brief Test vmask4 and. */
1920cc1dc7a3Sopenharmony_ciTEST(vmask4, and)
1921cc1dc7a3Sopenharmony_ci{
1922cc1dc7a3Sopenharmony_ci	vfloat4 m1a(0, 1, 0, 1);
1923cc1dc7a3Sopenharmony_ci	vfloat4 m1b(1, 1, 1, 1);
1924cc1dc7a3Sopenharmony_ci	vmask4 m1 = m1a == m1b;
1925cc1dc7a3Sopenharmony_ci
1926cc1dc7a3Sopenharmony_ci	vfloat4 m2a(1, 1, 0, 0);
1927cc1dc7a3Sopenharmony_ci	vfloat4 m2b(1, 1, 1, 1);
1928cc1dc7a3Sopenharmony_ci	vmask4 m2 = m2a == m2b;
1929cc1dc7a3Sopenharmony_ci
1930cc1dc7a3Sopenharmony_ci	vmask4 r = m1 & m2;
1931cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0x2u);
1932cc1dc7a3Sopenharmony_ci}
1933cc1dc7a3Sopenharmony_ci
1934cc1dc7a3Sopenharmony_ci/** @brief Test vmask4 xor. */
1935cc1dc7a3Sopenharmony_ciTEST(vmask4, xor)
1936cc1dc7a3Sopenharmony_ci{
1937cc1dc7a3Sopenharmony_ci	vfloat4 m1a(0, 1, 0, 1);
1938cc1dc7a3Sopenharmony_ci	vfloat4 m1b(1, 1, 1, 1);
1939cc1dc7a3Sopenharmony_ci	vmask4 m1 = m1a == m1b;
1940cc1dc7a3Sopenharmony_ci
1941cc1dc7a3Sopenharmony_ci	vfloat4 m2a(1, 1, 0, 0);
1942cc1dc7a3Sopenharmony_ci	vfloat4 m2b(1, 1, 1, 1);
1943cc1dc7a3Sopenharmony_ci	vmask4 m2 = m2a == m2b;
1944cc1dc7a3Sopenharmony_ci
1945cc1dc7a3Sopenharmony_ci	vmask4 r = m1 ^ m2;
1946cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0x9u);
1947cc1dc7a3Sopenharmony_ci}
1948cc1dc7a3Sopenharmony_ci
1949cc1dc7a3Sopenharmony_ci/** @brief Test vmask4 not. */
1950cc1dc7a3Sopenharmony_ciTEST(vmask4, not)
1951cc1dc7a3Sopenharmony_ci{
1952cc1dc7a3Sopenharmony_ci	vfloat4 m1a(0, 1, 0, 1);
1953cc1dc7a3Sopenharmony_ci	vfloat4 m1b(1, 1, 1, 1);
1954cc1dc7a3Sopenharmony_ci	vmask4 m1 = m1a == m1b;
1955cc1dc7a3Sopenharmony_ci	vmask4 r = ~m1;
1956cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0x5u);
1957cc1dc7a3Sopenharmony_ci}
1958cc1dc7a3Sopenharmony_ci
1959cc1dc7a3Sopenharmony_ci/** @brief Test vint4 table permute. */
1960cc1dc7a3Sopenharmony_ciTEST(vint4, vtable_8bt_32bi_32entry)
1961cc1dc7a3Sopenharmony_ci{
1962cc1dc7a3Sopenharmony_ci	vint4 table0(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f);
1963cc1dc7a3Sopenharmony_ci	vint4 table1(0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f);
1964cc1dc7a3Sopenharmony_ci
1965cc1dc7a3Sopenharmony_ci	vint4 table0p, table1p;
1966cc1dc7a3Sopenharmony_ci	vtable_prepare(table0, table1, table0p, table1p);
1967cc1dc7a3Sopenharmony_ci
1968cc1dc7a3Sopenharmony_ci	vint4 index(0, 7, 4, 31);
1969cc1dc7a3Sopenharmony_ci
1970cc1dc7a3Sopenharmony_ci	vint4 result = vtable_8bt_32bi(table0p, table1p, index);
1971cc1dc7a3Sopenharmony_ci
1972cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<0>(),  3);
1973cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<1>(),  4);
1974cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<2>(),  7);
1975cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<3>(), 28);
1976cc1dc7a3Sopenharmony_ci}
1977cc1dc7a3Sopenharmony_ci
1978cc1dc7a3Sopenharmony_ci/** @brief Test vint4 table permute. */
1979cc1dc7a3Sopenharmony_ciTEST(vint4, vtable_8bt_32bi_64entry)
1980cc1dc7a3Sopenharmony_ci{
1981cc1dc7a3Sopenharmony_ci	vint4 table0(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f);
1982cc1dc7a3Sopenharmony_ci	vint4 table1(0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f);
1983cc1dc7a3Sopenharmony_ci	vint4 table2(0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f);
1984cc1dc7a3Sopenharmony_ci	vint4 table3(0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f);
1985cc1dc7a3Sopenharmony_ci
1986cc1dc7a3Sopenharmony_ci	vint4 table0p, table1p, table2p, table3p;
1987cc1dc7a3Sopenharmony_ci	vtable_prepare(table0, table1, table2, table3, table0p, table1p, table2p, table3p);
1988cc1dc7a3Sopenharmony_ci
1989cc1dc7a3Sopenharmony_ci	vint4 index(0, 7, 38, 63);
1990cc1dc7a3Sopenharmony_ci
1991cc1dc7a3Sopenharmony_ci	vint4 result = vtable_8bt_32bi(table0p, table1p, table2p, table3p, index);
1992cc1dc7a3Sopenharmony_ci
1993cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<0>(),  3);
1994cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<1>(),  4);
1995cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<2>(), 37);
1996cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<3>(), 60);
1997cc1dc7a3Sopenharmony_ci}
1998cc1dc7a3Sopenharmony_ci
1999cc1dc7a3Sopenharmony_ci/** @brief Test vint4 rgba byte interleave. */
2000cc1dc7a3Sopenharmony_ciTEST(vint4, interleave_rgba8)
2001cc1dc7a3Sopenharmony_ci{
2002cc1dc7a3Sopenharmony_ci	vint4 r(0x01, 0x11, 0x21, 0x31);
2003cc1dc7a3Sopenharmony_ci	vint4 g(0x02, 0x12, 0x22, 0x32);
2004cc1dc7a3Sopenharmony_ci	vint4 b(0x03, 0x13, 0x23, 0x33);
2005cc1dc7a3Sopenharmony_ci	vint4 a(0x04, 0x14, 0x24, 0x34);
2006cc1dc7a3Sopenharmony_ci
2007cc1dc7a3Sopenharmony_ci	vint4 result = interleave_rgba8(r, g, b, a);
2008cc1dc7a3Sopenharmony_ci
2009cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<0>(), 0x04030201);
2010cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<1>(), 0x14131211);
2011cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<2>(), 0x24232221);
2012cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<3>(), 0x34333231);
2013cc1dc7a3Sopenharmony_ci}
2014cc1dc7a3Sopenharmony_ci
2015cc1dc7a3Sopenharmony_ci# if ASTCENC_SIMD_WIDTH == 8
2016cc1dc7a3Sopenharmony_ci
2017cc1dc7a3Sopenharmony_ci// VFLOAT8 tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2018cc1dc7a3Sopenharmony_ci
2019cc1dc7a3Sopenharmony_ci/** @brief Test unaligned vfloat8 data load. */
2020cc1dc7a3Sopenharmony_ciTEST(vfloat8, UnalignedLoad)
2021cc1dc7a3Sopenharmony_ci{
2022cc1dc7a3Sopenharmony_ci	vfloat8 a(&(f32_data[1]));
2023cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f);
2024cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f);
2025cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f);
2026cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f);
2027cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.0f);
2028cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.0f);
2029cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.0f);
2030cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.0f);
2031cc1dc7a3Sopenharmony_ci}
2032cc1dc7a3Sopenharmony_ci
2033cc1dc7a3Sopenharmony_ci/** @brief Test scalar duplicated vfloat8 load. */
2034cc1dc7a3Sopenharmony_ciTEST(vfloat8, ScalarDupLoad)
2035cc1dc7a3Sopenharmony_ci{
2036cc1dc7a3Sopenharmony_ci	vfloat8 a(1.1f);
2037cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.1f);
2038cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1.1f);
2039cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 1.1f);
2040cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 1.1f);
2041cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1.1f);
2042cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 1.1f);
2043cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 1.1f);
2044cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 1.1f);
2045cc1dc7a3Sopenharmony_ci}
2046cc1dc7a3Sopenharmony_ci
2047cc1dc7a3Sopenharmony_ci/** @brief Test scalar vfloat8 load. */
2048cc1dc7a3Sopenharmony_ciTEST(vfloat8, ScalarLoad)
2049cc1dc7a3Sopenharmony_ci{
2050cc1dc7a3Sopenharmony_ci	vfloat8 a(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f);
2051cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.1f);
2052cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.2f);
2053cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.3f);
2054cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.4f);
2055cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.5f);
2056cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.6f);
2057cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.7f);
2058cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.8f);
2059cc1dc7a3Sopenharmony_ci}
2060cc1dc7a3Sopenharmony_ci
2061cc1dc7a3Sopenharmony_ci/** @brief Test copy vfloat8 load. */
2062cc1dc7a3Sopenharmony_ciTEST(vfloat8, CopyLoad)
2063cc1dc7a3Sopenharmony_ci{
2064cc1dc7a3Sopenharmony_ci	vfloat8 s(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f);
2065cc1dc7a3Sopenharmony_ci	vfloat8 a(s.m);
2066cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.1f);
2067cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.2f);
2068cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.3f);
2069cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.4f);
2070cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.5f);
2071cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.6f);
2072cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.7f);
2073cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.8f);
2074cc1dc7a3Sopenharmony_ci}
2075cc1dc7a3Sopenharmony_ci
2076cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 zero. */
2077cc1dc7a3Sopenharmony_ciTEST(vfloat8, Zero)
2078cc1dc7a3Sopenharmony_ci{
2079cc1dc7a3Sopenharmony_ci	vfloat8 a = vfloat8::zero();
2080cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0.0f);
2081cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0.0f);
2082cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0.0f);
2083cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0.0f);
2084cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 0.0f);
2085cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 0.0f);
2086cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 0.0f);
2087cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 0.0f);
2088cc1dc7a3Sopenharmony_ci}
2089cc1dc7a3Sopenharmony_ci
2090cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 load1. */
2091cc1dc7a3Sopenharmony_ciTEST(vfloat8, Load1)
2092cc1dc7a3Sopenharmony_ci{
2093cc1dc7a3Sopenharmony_ci	float s = 3.14f;
2094cc1dc7a3Sopenharmony_ci	vfloat8 a = vfloat8::load1(&s);
2095cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3.14f);
2096cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 3.14f);
2097cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.14f);
2098cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3.14f);
2099cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 3.14f);
2100cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 3.14f);
2101cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 3.14f);
2102cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 3.14f);
2103cc1dc7a3Sopenharmony_ci}
2104cc1dc7a3Sopenharmony_ci
2105cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 loada. */
2106cc1dc7a3Sopenharmony_ciTEST(vfloat8, Loada)
2107cc1dc7a3Sopenharmony_ci{
2108cc1dc7a3Sopenharmony_ci	vfloat8 a = vfloat8::loada(&(f32_data[0]));
2109cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0.0f);
2110cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1.0f);
2111cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2.0f);
2112cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3.0f);
2113cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 4.0f);
2114cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 5.0f);
2115cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 6.0f);
2116cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 7.0f);
2117cc1dc7a3Sopenharmony_ci}
2118cc1dc7a3Sopenharmony_ci
2119cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 lane_id. */
2120cc1dc7a3Sopenharmony_ciTEST(vfloat8, LaneID)
2121cc1dc7a3Sopenharmony_ci{
2122cc1dc7a3Sopenharmony_ci	vfloat8 a = vfloat8::lane_id();
2123cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0.0f);
2124cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1.0f);
2125cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2.0f);
2126cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3.0f);
2127cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 4.0f);
2128cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 5.0f);
2129cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 6.0f);
2130cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 7.0f);
2131cc1dc7a3Sopenharmony_ci}
2132cc1dc7a3Sopenharmony_ci
2133cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 add. */
2134cc1dc7a3Sopenharmony_ciTEST(vfloat8, vadd)
2135cc1dc7a3Sopenharmony_ci{
2136cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2137cc1dc7a3Sopenharmony_ci	vfloat8 b(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2138cc1dc7a3Sopenharmony_ci	a = a + b;
2139cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f + 0.1f);
2140cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f + 0.2f);
2141cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f + 0.3f);
2142cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f + 0.4f);
2143cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.0f + 0.5f);
2144cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.0f + 0.6f);
2145cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.0f + 0.7f);
2146cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.0f + 0.8f);
2147cc1dc7a3Sopenharmony_ci}
2148cc1dc7a3Sopenharmony_ci
2149cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 sub. */
2150cc1dc7a3Sopenharmony_ciTEST(vfloat8, vsub)
2151cc1dc7a3Sopenharmony_ci{
2152cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2153cc1dc7a3Sopenharmony_ci	vfloat8 b(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2154cc1dc7a3Sopenharmony_ci	a = a - b;
2155cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f - 0.1f);
2156cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f - 0.2f);
2157cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f - 0.3f);
2158cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f - 0.4f);
2159cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.0f - 0.5f);
2160cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.0f - 0.6f);
2161cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.0f - 0.7f);
2162cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.0f - 0.8f);
2163cc1dc7a3Sopenharmony_ci}
2164cc1dc7a3Sopenharmony_ci
2165cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 mul. */
2166cc1dc7a3Sopenharmony_ciTEST(vfloat8, vmul)
2167cc1dc7a3Sopenharmony_ci{
2168cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2169cc1dc7a3Sopenharmony_ci	vfloat8 b(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2170cc1dc7a3Sopenharmony_ci	a = a * b;
2171cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f * 0.1f);
2172cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f * 0.2f);
2173cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f * 0.3f);
2174cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f * 0.4f);
2175cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.0f * 0.5f);
2176cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.0f * 0.6f);
2177cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.0f * 0.7f);
2178cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.0f * 0.8f);
2179cc1dc7a3Sopenharmony_ci}
2180cc1dc7a3Sopenharmony_ci
2181cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 mul. */
2182cc1dc7a3Sopenharmony_ciTEST(vfloat8, vsmul)
2183cc1dc7a3Sopenharmony_ci{
2184cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2185cc1dc7a3Sopenharmony_ci	float b = 3.14f;
2186cc1dc7a3Sopenharmony_ci	a = a * b;
2187cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f * 3.14f);
2188cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f * 3.14f);
2189cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f * 3.14f);
2190cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f * 3.14f);
2191cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.0f * 3.14f);
2192cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.0f * 3.14f);
2193cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.0f * 3.14f);
2194cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.0f * 3.14f);
2195cc1dc7a3Sopenharmony_ci}
2196cc1dc7a3Sopenharmony_ci
2197cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 mul. */
2198cc1dc7a3Sopenharmony_ciTEST(vfloat8, svmul)
2199cc1dc7a3Sopenharmony_ci{
2200cc1dc7a3Sopenharmony_ci	float a = 3.14f;
2201cc1dc7a3Sopenharmony_ci	vfloat8 b(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2202cc1dc7a3Sopenharmony_ci	b = a * b;
2203cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<0>(), 3.14f * 1.0f);
2204cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<1>(), 3.14f * 2.0f);
2205cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<2>(), 3.14f * 3.0f);
2206cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<3>(), 3.14f * 4.0f);
2207cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<4>(), 3.14f * 5.0f);
2208cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<5>(), 3.14f * 6.0f);
2209cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<6>(), 3.14f * 7.0f);
2210cc1dc7a3Sopenharmony_ci	EXPECT_EQ(b.lane<7>(), 3.14f * 8.0f);
2211cc1dc7a3Sopenharmony_ci}
2212cc1dc7a3Sopenharmony_ci
2213cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 div. */
2214cc1dc7a3Sopenharmony_ciTEST(vfloat8, vdiv)
2215cc1dc7a3Sopenharmony_ci{
2216cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2217cc1dc7a3Sopenharmony_ci	vfloat8 b(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2218cc1dc7a3Sopenharmony_ci	a = a / b;
2219cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1.0f / 0.1f);
2220cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2.0f / 0.2f);
2221cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3.0f / 0.3f);
2222cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4.0f / 0.4f);
2223cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5.0f / 0.5f);
2224cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6.0f / 0.6f);
2225cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7.0f / 0.7f);
2226cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8.0f / 0.8f);
2227cc1dc7a3Sopenharmony_ci}
2228cc1dc7a3Sopenharmony_ci
2229cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 div. */
2230cc1dc7a3Sopenharmony_ciTEST(vfloat8, vsdiv)
2231cc1dc7a3Sopenharmony_ci{
2232cc1dc7a3Sopenharmony_ci	vfloat8 a(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2233cc1dc7a3Sopenharmony_ci	float b = 3.14f;
2234cc1dc7a3Sopenharmony_ci	vfloat8 r = a / b;
2235cc1dc7a3Sopenharmony_ci
2236cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.1f / 3.14f);
2237cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0.2f / 3.14f);
2238cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 0.3f / 3.14f);
2239cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 0.4f / 3.14f);
2240cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 0.5f / 3.14f);
2241cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 0.6f / 3.14f);
2242cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 0.7f / 3.14f);
2243cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 0.8f / 3.14f);
2244cc1dc7a3Sopenharmony_ci}
2245cc1dc7a3Sopenharmony_ci
2246cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 div. */
2247cc1dc7a3Sopenharmony_ciTEST(vfloat8, svdiv)
2248cc1dc7a3Sopenharmony_ci{
2249cc1dc7a3Sopenharmony_ci	float a = 3.14f;
2250cc1dc7a3Sopenharmony_ci	vfloat8 b(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2251cc1dc7a3Sopenharmony_ci	vfloat8 r = a / b;
2252cc1dc7a3Sopenharmony_ci
2253cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 3.14f / 0.1f);
2254cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 3.14f / 0.2f);
2255cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.14f / 0.3f);
2256cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 3.14f / 0.4f);
2257cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 3.14f / 0.5f);
2258cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 3.14f / 0.6f);
2259cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3.14f / 0.7f);
2260cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 3.14f / 0.8f);
2261cc1dc7a3Sopenharmony_ci}
2262cc1dc7a3Sopenharmony_ci
2263cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 ceq. */
2264cc1dc7a3Sopenharmony_ciTEST(vfloat8, ceq)
2265cc1dc7a3Sopenharmony_ci{
2266cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2267cc1dc7a3Sopenharmony_ci	vfloat8 b1(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2268cc1dc7a3Sopenharmony_ci	vmask8 r1 = a1 == b1;
2269cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r1));
2270cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r1));
2271cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r1));
2272cc1dc7a3Sopenharmony_ci
2273cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2274cc1dc7a3Sopenharmony_ci	vfloat8 b2(1.0f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2275cc1dc7a3Sopenharmony_ci	vmask8 r2 = a2 == b2;
2276cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x1u, mask(r2));
2277cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
2278cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
2279cc1dc7a3Sopenharmony_ci
2280cc1dc7a3Sopenharmony_ci	vfloat8 a3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2281cc1dc7a3Sopenharmony_ci	vfloat8 b3(1.0f, 0.2f, 3.0f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2282cc1dc7a3Sopenharmony_ci	vmask8 r3 = a3 == b3;
2283cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x5u, mask(r3));
2284cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
2285cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
2286cc1dc7a3Sopenharmony_ci
2287cc1dc7a3Sopenharmony_ci	vfloat8 a4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2288cc1dc7a3Sopenharmony_ci	vmask8 r4 = a4 == a4;
2289cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFFu, mask(r4));
2290cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r4));
2291cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r4));
2292cc1dc7a3Sopenharmony_ci}
2293cc1dc7a3Sopenharmony_ci
2294cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 cne. */
2295cc1dc7a3Sopenharmony_ciTEST(vfloat8, cne)
2296cc1dc7a3Sopenharmony_ci{
2297cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2298cc1dc7a3Sopenharmony_ci	vfloat8 b1(0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2299cc1dc7a3Sopenharmony_ci	vmask8 r1 = a1 != b1;
2300cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFFu, mask(r1));
2301cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r1));
2302cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r1));
2303cc1dc7a3Sopenharmony_ci
2304cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2305cc1dc7a3Sopenharmony_ci	vfloat8 b2(1.0f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2306cc1dc7a3Sopenharmony_ci	vmask8 r2 = a2 != b2;
2307cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFEu, mask(r2));
2308cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
2309cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
2310cc1dc7a3Sopenharmony_ci
2311cc1dc7a3Sopenharmony_ci	vfloat8 a3(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2312cc1dc7a3Sopenharmony_ci	vfloat8 b3(1.0f, 0.2f, 3.0f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f);
2313cc1dc7a3Sopenharmony_ci	vmask8 r3 = a3 != b3;
2314cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFAu, mask(r3));
2315cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
2316cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
2317cc1dc7a3Sopenharmony_ci
2318cc1dc7a3Sopenharmony_ci	vfloat8 a4(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
2319cc1dc7a3Sopenharmony_ci	vmask8 r4 = a4 != a4;
2320cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r4));
2321cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r4));
2322cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r4));
2323cc1dc7a3Sopenharmony_ci}
2324cc1dc7a3Sopenharmony_ci
2325cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 clt. */
2326cc1dc7a3Sopenharmony_ciTEST(vfloat8, clt)
2327cc1dc7a3Sopenharmony_ci{
2328cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2329cc1dc7a3Sopenharmony_ci	vfloat8 b(0.9f, 2.1f, 3.0f, 4.1f, 0.9f, 2.1f, 3.0f, 4.1f);
2330cc1dc7a3Sopenharmony_ci	vmask8 r = a < b;
2331cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAAu, mask(r));
2332cc1dc7a3Sopenharmony_ci}
2333cc1dc7a3Sopenharmony_ci
2334cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 cle. */
2335cc1dc7a3Sopenharmony_ciTEST(vfloat8, cle)
2336cc1dc7a3Sopenharmony_ci{
2337cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2338cc1dc7a3Sopenharmony_ci	vfloat8 b(0.9f, 2.1f, 3.0f, 4.1f, 0.9f, 2.1f, 3.0f, 4.1f);
2339cc1dc7a3Sopenharmony_ci	vmask8 r = a <= b;
2340cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xEEu, mask(r));
2341cc1dc7a3Sopenharmony_ci}
2342cc1dc7a3Sopenharmony_ci
2343cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 cgt. */
2344cc1dc7a3Sopenharmony_ciTEST(vfloat8, cgt)
2345cc1dc7a3Sopenharmony_ci{
2346cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2347cc1dc7a3Sopenharmony_ci	vfloat8 b(0.9f, 2.1f, 3.0f, 4.1f, 0.9f, 2.1f, 3.0f, 4.1f);
2348cc1dc7a3Sopenharmony_ci	vmask8 r = a > b;
2349cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x11u, mask(r));
2350cc1dc7a3Sopenharmony_ci}
2351cc1dc7a3Sopenharmony_ci
2352cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 cge. */
2353cc1dc7a3Sopenharmony_ciTEST(vfloat8, cge)
2354cc1dc7a3Sopenharmony_ci{
2355cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2356cc1dc7a3Sopenharmony_ci	vfloat8 b(0.9f, 2.1f, 3.0f, 4.1f, 0.9f, 2.1f, 3.0f, 4.1f);
2357cc1dc7a3Sopenharmony_ci	vmask8 r = a >= b;
2358cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x55u, mask(r));
2359cc1dc7a3Sopenharmony_ci}
2360cc1dc7a3Sopenharmony_ci
2361cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 min. */
2362cc1dc7a3Sopenharmony_ciTEST(vfloat8, min)
2363cc1dc7a3Sopenharmony_ci{
2364cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2365cc1dc7a3Sopenharmony_ci	vfloat8 b(0.9f, 2.1f, 3.0f, 4.1f, 0.9f, 2.1f, 3.0f, 4.1f);
2366cc1dc7a3Sopenharmony_ci	vfloat8 r = min(a, b);
2367cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.9f);
2368cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
2369cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
2370cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
2371cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 0.9f);
2372cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 2.0f);
2373cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3.0f);
2374cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 4.0f);
2375cc1dc7a3Sopenharmony_ci}
2376cc1dc7a3Sopenharmony_ci
2377cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 max. */
2378cc1dc7a3Sopenharmony_ciTEST(vfloat8, max)
2379cc1dc7a3Sopenharmony_ci{
2380cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2381cc1dc7a3Sopenharmony_ci	vfloat8 b(0.9f, 2.1f, 3.0f, 4.1f, 0.9f, 2.1f, 3.0f, 4.1f);
2382cc1dc7a3Sopenharmony_ci	vfloat8 r = max(a, b);
2383cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
2384cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.1f);
2385cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
2386cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.1f);
2387cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 1.0f);
2388cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 2.1f);
2389cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3.0f);
2390cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 4.1f);
2391cc1dc7a3Sopenharmony_ci}
2392cc1dc7a3Sopenharmony_ci
2393cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 clamp. */
2394cc1dc7a3Sopenharmony_ciTEST(vfloat8, clamp)
2395cc1dc7a3Sopenharmony_ci{
2396cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2397cc1dc7a3Sopenharmony_ci	vfloat8 r1 = clamp(2.1f, 3.0f, a1);
2398cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 2.1f);
2399cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 2.1f);
2400cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 3.0f);
2401cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3.0f);
2402cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 2.1f);
2403cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 2.1f);
2404cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 3.0f);
2405cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 3.0f);
2406cc1dc7a3Sopenharmony_ci
2407cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.0f, 2.0f, qnan, 4.0f, 1.0f, 2.0f, qnan, 4.0f);
2408cc1dc7a3Sopenharmony_ci	vfloat8 r2 = clamp(2.1f, 3.0f, a2);
2409cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 2.1f);
2410cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2.1f);
2411cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 2.1f);
2412cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 3.0f);
2413cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 2.1f);
2414cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 2.1f);
2415cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 2.1f);
2416cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 3.0f);
2417cc1dc7a3Sopenharmony_ci}
2418cc1dc7a3Sopenharmony_ci
2419cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 clampz. */
2420cc1dc7a3Sopenharmony_ciTEST(vfloat8, clampz)
2421cc1dc7a3Sopenharmony_ci{
2422cc1dc7a3Sopenharmony_ci	vfloat8 a1(-1.0f, 0.0f, 0.1f, 4.0f, -1.0f, 0.0f, 0.1f, 4.0f);
2423cc1dc7a3Sopenharmony_ci	vfloat8 r1 = clampz(3.0f, a1);
2424cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 0.0f);
2425cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 0.0f);
2426cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 0.1f);
2427cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3.0f);
2428cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 0.0f);
2429cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 0.0f);
2430cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 0.1f);
2431cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 3.0f);
2432cc1dc7a3Sopenharmony_ci
2433cc1dc7a3Sopenharmony_ci	vfloat8 a2(-1.0f, 0.0f, qnan, 4.0f, -1.0f, 0.0f, qnan, 4.0f);
2434cc1dc7a3Sopenharmony_ci	vfloat8 r2 = clampz(3.0f, a2);
2435cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 0.0f);
2436cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 0.0f);
2437cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 0.0f);
2438cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 3.0f);
2439cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 0.0f);
2440cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 0.0f);
2441cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 0.0f);
2442cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 3.0f);
2443cc1dc7a3Sopenharmony_ci}
2444cc1dc7a3Sopenharmony_ci
2445cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 clampz. */
2446cc1dc7a3Sopenharmony_ciTEST(vfloat8, clampzo)
2447cc1dc7a3Sopenharmony_ci{
2448cc1dc7a3Sopenharmony_ci	vfloat8 a1(-1.0f, 0.0f, 0.1f, 4.0f, -1.0f, 0.0f, 0.1f, 4.0f);
2449cc1dc7a3Sopenharmony_ci	vfloat8 r1 = clampzo(a1);
2450cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 0.0f);
2451cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 0.0f);
2452cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 0.1f);
2453cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.0f);
2454cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 0.0f);
2455cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 0.0f);
2456cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 0.1f);
2457cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 1.0f);
2458cc1dc7a3Sopenharmony_ci
2459cc1dc7a3Sopenharmony_ci	vfloat8 a2(-1.0f, 0.0f, qnan, 4.0f, -1.0f, 0.0f, qnan, 4.0f);
2460cc1dc7a3Sopenharmony_ci	vfloat8 r2 = clampzo(a2);
2461cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 0.0f);
2462cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 0.0f);
2463cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 0.0f);
2464cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 1.0f);
2465cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 0.0f);
2466cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 0.0f);
2467cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 0.0f);
2468cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 1.0f);
2469cc1dc7a3Sopenharmony_ci}
2470cc1dc7a3Sopenharmony_ci
2471cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 abs. */
2472cc1dc7a3Sopenharmony_ciTEST(vfloat8, abs)
2473cc1dc7a3Sopenharmony_ci{
2474cc1dc7a3Sopenharmony_ci	vfloat8 a(-1.0f, 0.0f, 0.1f, 4.0f, -1.0f, 0.0f, 0.1f, 4.0f);
2475cc1dc7a3Sopenharmony_ci	vfloat8 r = abs(a);
2476cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
2477cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 0.0f);
2478cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 0.1f);
2479cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
2480cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 1.0f);
2481cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 0.0f);
2482cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 0.1f);
2483cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 4.0f);
2484cc1dc7a3Sopenharmony_ci}
2485cc1dc7a3Sopenharmony_ci
2486cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 round. */
2487cc1dc7a3Sopenharmony_ciTEST(vfloat8, round)
2488cc1dc7a3Sopenharmony_ci{
2489cc1dc7a3Sopenharmony_ci	vfloat8 a(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2490cc1dc7a3Sopenharmony_ci	vfloat8 r = round(a);
2491cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1.0f);
2492cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2.0f);
2493cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 2.0f);
2494cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4.0f);
2495cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 1.0f);
2496cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 2.0f);
2497cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 2.0f);
2498cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 4.0f);
2499cc1dc7a3Sopenharmony_ci}
2500cc1dc7a3Sopenharmony_ci
2501cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 hmin. */
2502cc1dc7a3Sopenharmony_ciTEST(vfloat8, hmin)
2503cc1dc7a3Sopenharmony_ci{
2504cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2505cc1dc7a3Sopenharmony_ci	vfloat8 r1 = hmin(a1);
2506cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 1.1f);
2507cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 1.1f);
2508cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 1.1f);
2509cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.1f);
2510cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 1.1f);
2511cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 1.1f);
2512cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 1.1f);
2513cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 1.1f);
2514cc1dc7a3Sopenharmony_ci
2515cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.1f, 1.5f, 1.6f, 0.2f, 1.1f, 1.5f, 1.6f, 0.2f);
2516cc1dc7a3Sopenharmony_ci	vfloat8 r2 = hmin(a2);
2517cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 0.2f);
2518cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 0.2f);
2519cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 0.2f);
2520cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 0.2f);
2521cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 0.2f);
2522cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 0.2f);
2523cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 0.2f);
2524cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 0.2f);
2525cc1dc7a3Sopenharmony_ci}
2526cc1dc7a3Sopenharmony_ci
2527cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 hmin_s. */
2528cc1dc7a3Sopenharmony_ciTEST(vfloat8, hmin_s)
2529cc1dc7a3Sopenharmony_ci{
2530cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2531cc1dc7a3Sopenharmony_ci	float r1 = hmin_s(a1);
2532cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 1.1f);
2533cc1dc7a3Sopenharmony_ci
2534cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.1f, 1.5f, 1.6f, 0.2f, 1.1f, 1.5f, 1.6f, 0.2f);
2535cc1dc7a3Sopenharmony_ci	float r2 = hmin_s(a2);
2536cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 0.2f);
2537cc1dc7a3Sopenharmony_ci}
2538cc1dc7a3Sopenharmony_ci
2539cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 hmax. */
2540cc1dc7a3Sopenharmony_ciTEST(vfloat8, hmax)
2541cc1dc7a3Sopenharmony_ci{
2542cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2543cc1dc7a3Sopenharmony_ci	vfloat8 r1 = hmax(a1);
2544cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
2545cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 4.0f);
2546cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 4.0f);
2547cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 4.0f);
2548cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 4.0f);
2549cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 4.0f);
2550cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 4.0f);
2551cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 4.0f);
2552cc1dc7a3Sopenharmony_ci
2553cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.1f, 1.5f, 1.6f, 0.2f, 1.1f, 1.5f, 1.6f, 0.2f);
2554cc1dc7a3Sopenharmony_ci	vfloat8 r2 = hmax(a2);
2555cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1.6f);
2556cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 1.6f);
2557cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 1.6f);
2558cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 1.6f);
2559cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 1.6f);
2560cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 1.6f);
2561cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 1.6f);
2562cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 1.6f);
2563cc1dc7a3Sopenharmony_ci}
2564cc1dc7a3Sopenharmony_ci
2565cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 hmax_s. */
2566cc1dc7a3Sopenharmony_ciTEST(vfloat8, hmax_s)
2567cc1dc7a3Sopenharmony_ci{
2568cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2569cc1dc7a3Sopenharmony_ci	float r1 = hmax_s(a1);
2570cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1, 4.0f);
2571cc1dc7a3Sopenharmony_ci
2572cc1dc7a3Sopenharmony_ci	vfloat8 a2(1.1f, 1.5f, 1.6f, 0.2f, 1.1f, 1.5f, 1.6f, 0.2f);
2573cc1dc7a3Sopenharmony_ci	float r2 = hmax_s(a2);
2574cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2, 1.6f);
2575cc1dc7a3Sopenharmony_ci}
2576cc1dc7a3Sopenharmony_ci
2577cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 hadd_s. */
2578cc1dc7a3Sopenharmony_ciTEST(vfloat8, hadd_s)
2579cc1dc7a3Sopenharmony_ci{
2580cc1dc7a3Sopenharmony_ci	vfloat8 a1(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2581cc1dc7a3Sopenharmony_ci	float sum = 1.1f + 1.5f + 1.6f + 4.0f + 1.1f + 1.5f + 1.6f + 4.0f;
2582cc1dc7a3Sopenharmony_ci	float r = hadd_s(a1);
2583cc1dc7a3Sopenharmony_ci	EXPECT_NEAR(r, sum, 0.005f);
2584cc1dc7a3Sopenharmony_ci}
2585cc1dc7a3Sopenharmony_ci
2586cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 sqrt. */
2587cc1dc7a3Sopenharmony_ciTEST(vfloat8, sqrt)
2588cc1dc7a3Sopenharmony_ci{
2589cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f);
2590cc1dc7a3Sopenharmony_ci	vfloat8 r = sqrt(a);
2591cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), std::sqrt(1.0f));
2592cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), std::sqrt(2.0f));
2593cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), std::sqrt(3.0f));
2594cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), std::sqrt(4.0f));
2595cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), std::sqrt(1.0f));
2596cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), std::sqrt(2.0f));
2597cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), std::sqrt(3.0f));
2598cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), std::sqrt(4.0f));
2599cc1dc7a3Sopenharmony_ci}
2600cc1dc7a3Sopenharmony_ci
2601cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 select. */
2602cc1dc7a3Sopenharmony_ciTEST(vfloat8, select)
2603cc1dc7a3Sopenharmony_ci{
2604cc1dc7a3Sopenharmony_ci	vfloat8 m1(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
2605cc1dc7a3Sopenharmony_ci	vfloat8 m2(1.0f, 2.0f, 1.0f, 2.0f, 1.0f, 2.0f, 1.0f, 2.0f);
2606cc1dc7a3Sopenharmony_ci	vmask8 cond = m1 == m2;
2607cc1dc7a3Sopenharmony_ci
2608cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 3.0f, 3.0f, 1.0f, 1.0f, 3.0f, 3.0f, 1.0);
2609cc1dc7a3Sopenharmony_ci	vfloat8 b(4.0f, 2.0f, 2.0f, 4.0f, 4.0f, 2.0f, 2.0f, 4.0);
2610cc1dc7a3Sopenharmony_ci
2611cc1dc7a3Sopenharmony_ci	// Select in one direction
2612cc1dc7a3Sopenharmony_ci	vfloat8 r1 = select(a, b, cond);
2613cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
2614cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3.0f);
2615cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2.0f);
2616cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.0f);
2617cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 4.0f);
2618cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 3.0f);
2619cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 2.0f);
2620cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 1.0f);
2621cc1dc7a3Sopenharmony_ci
2622cc1dc7a3Sopenharmony_ci	// Select in the other
2623cc1dc7a3Sopenharmony_ci	vfloat8 r2 = select(b, a, cond);
2624cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1.0f);
2625cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2.0f);
2626cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 3.0f);
2627cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 4.0f);
2628cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 1.0f);
2629cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 2.0f);
2630cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 3.0f);
2631cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 4.0f);
2632cc1dc7a3Sopenharmony_ci}
2633cc1dc7a3Sopenharmony_ci
2634cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 select MSB only. */
2635cc1dc7a3Sopenharmony_ciTEST(vfloat8, select_msb)
2636cc1dc7a3Sopenharmony_ci{
2637cc1dc7a3Sopenharmony_ci	int msb_set = static_cast<int>(0x80000000);
2638cc1dc7a3Sopenharmony_ci	vint8 msb(msb_set, 0, msb_set, 0, msb_set, 0, msb_set, 0);
2639cc1dc7a3Sopenharmony_ci	vmask8 cond(msb.m);
2640cc1dc7a3Sopenharmony_ci
2641cc1dc7a3Sopenharmony_ci	vfloat8 a(1.0f, 3.0f, 3.0f, 1.0f, 1.0f, 3.0f, 3.0f, 1.0f);
2642cc1dc7a3Sopenharmony_ci	vfloat8 b(4.0f, 2.0f, 2.0f, 4.0f, 4.0f, 2.0f, 2.0f, 4.0f);
2643cc1dc7a3Sopenharmony_ci
2644cc1dc7a3Sopenharmony_ci	// Select in one direction
2645cc1dc7a3Sopenharmony_ci	vfloat8 r1 = select(a, b, cond);
2646cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4.0f);
2647cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3.0f);
2648cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2.0f);
2649cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1.0f);
2650cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 4.0f);
2651cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 3.0f);
2652cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 2.0f);
2653cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 1.0f);
2654cc1dc7a3Sopenharmony_ci
2655cc1dc7a3Sopenharmony_ci	// Select in the other
2656cc1dc7a3Sopenharmony_ci	vfloat8 r2 = select(b, a, cond);
2657cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1.0f);
2658cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2.0f);
2659cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 3.0f);
2660cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 4.0f);
2661cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 1.0f);
2662cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 2.0f);
2663cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 3.0f);
2664cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 4.0f);
2665cc1dc7a3Sopenharmony_ci}
2666cc1dc7a3Sopenharmony_ci
2667cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 gatherf. */
2668cc1dc7a3Sopenharmony_ciTEST(vfloat8, gatherf)
2669cc1dc7a3Sopenharmony_ci{
2670cc1dc7a3Sopenharmony_ci	vint8 indices(0, 4, 3, 2, 7, 4, 3, 2);
2671cc1dc7a3Sopenharmony_ci	vfloat8 r = gatherf(f32_data, indices);
2672cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0.0f);
2673cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4.0f);
2674cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3.0f);
2675cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 2.0f);
2676cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 7.0f);
2677cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 4.0f);
2678cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3.0f);
2679cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 2.0f);
2680cc1dc7a3Sopenharmony_ci}
2681cc1dc7a3Sopenharmony_ci
2682cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 store. */
2683cc1dc7a3Sopenharmony_ciTEST(vfloat8, store)
2684cc1dc7a3Sopenharmony_ci{
2685cc1dc7a3Sopenharmony_ci	alignas(32) float out[9];
2686cc1dc7a3Sopenharmony_ci	vfloat8 a(f32_data);
2687cc1dc7a3Sopenharmony_ci	store(a, &(out[1]));
2688cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 0.0f);
2689cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 1.0f);
2690cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 2.0f);
2691cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[4], 3.0f);
2692cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[5], 4.0f);
2693cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[6], 5.0f);
2694cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[7], 6.0f);
2695cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[8], 7.0f);
2696cc1dc7a3Sopenharmony_ci}
2697cc1dc7a3Sopenharmony_ci
2698cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 storea. */
2699cc1dc7a3Sopenharmony_ciTEST(vfloat8, storea)
2700cc1dc7a3Sopenharmony_ci{
2701cc1dc7a3Sopenharmony_ci	alignas(32) float out[9];
2702cc1dc7a3Sopenharmony_ci	vfloat8 a(f32_data);
2703cc1dc7a3Sopenharmony_ci	store(a, out);
2704cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[0], 0.0f);
2705cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 1.0f);
2706cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 2.0f);
2707cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 3.0f);
2708cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[4], 4.0f);
2709cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[5], 5.0f);
2710cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[6], 6.0f);
2711cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[7], 7.0f);
2712cc1dc7a3Sopenharmony_ci}
2713cc1dc7a3Sopenharmony_ci
2714cc1dc7a3Sopenharmony_ci/** @brief Test vfloat8 float_to_int. */
2715cc1dc7a3Sopenharmony_ciTEST(vfloat8, float_to_int)
2716cc1dc7a3Sopenharmony_ci{
2717cc1dc7a3Sopenharmony_ci	vfloat8 a(1.1f, 1.5f, 1.6f, 4.0f, 1.1f, 1.5f, 1.6f, 4.0f);
2718cc1dc7a3Sopenharmony_ci	vint8 r = float_to_int(a);
2719cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1);
2720cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 1);
2721cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 1);
2722cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4);
2723cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 1);
2724cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 1);
2725cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 1);
2726cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 4);
2727cc1dc7a3Sopenharmony_ci}
2728cc1dc7a3Sopenharmony_ci
2729cc1dc7a3Sopenharmony_ci// vint8 tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2730cc1dc7a3Sopenharmony_ci
2731cc1dc7a3Sopenharmony_ci/** @brief Test unaligned vint8 data load. */
2732cc1dc7a3Sopenharmony_ciTEST(vint8, UnalignedLoad)
2733cc1dc7a3Sopenharmony_ci{
2734cc1dc7a3Sopenharmony_ci	vint8 a(&(s32_data[1]));
2735cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
2736cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
2737cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
2738cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
2739cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5);
2740cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6);
2741cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7);
2742cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8);
2743cc1dc7a3Sopenharmony_ci}
2744cc1dc7a3Sopenharmony_ci
2745cc1dc7a3Sopenharmony_ci/** @brief Test unaligned vint8 data load. */
2746cc1dc7a3Sopenharmony_ciTEST(vint8, UnalignedLoad8)
2747cc1dc7a3Sopenharmony_ci{
2748cc1dc7a3Sopenharmony_ci	vint8 a(&(u8_data[1]));
2749cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
2750cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
2751cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3);
2752cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
2753cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 5);
2754cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 6);
2755cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7);
2756cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 8);
2757cc1dc7a3Sopenharmony_ci}
2758cc1dc7a3Sopenharmony_ci
2759cc1dc7a3Sopenharmony_ci/** @brief Test scalar duplicated vint8 load. */
2760cc1dc7a3Sopenharmony_ciTEST(vint8, ScalarDupLoad)
2761cc1dc7a3Sopenharmony_ci{
2762cc1dc7a3Sopenharmony_ci	vint8 a(42);
2763cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 42);
2764cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 42);
2765cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 42);
2766cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 42);
2767cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 42);
2768cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 42);
2769cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 42);
2770cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 42);
2771cc1dc7a3Sopenharmony_ci}
2772cc1dc7a3Sopenharmony_ci
2773cc1dc7a3Sopenharmony_ci/** @brief Test scalar vint8 load. */
2774cc1dc7a3Sopenharmony_ciTEST(vint8, ScalarLoad)
2775cc1dc7a3Sopenharmony_ci{
2776cc1dc7a3Sopenharmony_ci	vint8 a(11, 22, 33, 44, 55, 66, 77, 88);
2777cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 11);
2778cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 22);
2779cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 33);
2780cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 44);
2781cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 55);
2782cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 66);
2783cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 77);
2784cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 88);
2785cc1dc7a3Sopenharmony_ci}
2786cc1dc7a3Sopenharmony_ci
2787cc1dc7a3Sopenharmony_ci/** @brief Test copy vint8 load. */
2788cc1dc7a3Sopenharmony_ciTEST(vint8, CopyLoad)
2789cc1dc7a3Sopenharmony_ci{
2790cc1dc7a3Sopenharmony_ci	vint8 s(11, 22, 33, 44, 55, 66, 77, 88);
2791cc1dc7a3Sopenharmony_ci	vint8 a(s.m);
2792cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 11);
2793cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 22);
2794cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 33);
2795cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 44);
2796cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 55);
2797cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 66);
2798cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 77);
2799cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 88);
2800cc1dc7a3Sopenharmony_ci}
2801cc1dc7a3Sopenharmony_ci
2802cc1dc7a3Sopenharmony_ci/** @brief Test vint8 zero. */
2803cc1dc7a3Sopenharmony_ciTEST(vint8, Zero)
2804cc1dc7a3Sopenharmony_ci{
2805cc1dc7a3Sopenharmony_ci	vint8 a = vint8::zero();
2806cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
2807cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 0);
2808cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0);
2809cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0);
2810cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 0);
2811cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 0);
2812cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 0);
2813cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 0);
2814cc1dc7a3Sopenharmony_ci}
2815cc1dc7a3Sopenharmony_ci
2816cc1dc7a3Sopenharmony_ci/** @brief Test vint8 load1. */
2817cc1dc7a3Sopenharmony_ciTEST(vint8, Load1)
2818cc1dc7a3Sopenharmony_ci{
2819cc1dc7a3Sopenharmony_ci	int s = 42;
2820cc1dc7a3Sopenharmony_ci	vint8 a = vint8::load1(&s);
2821cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 42);
2822cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 42);
2823cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 42);
2824cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 42);
2825cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 42);
2826cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 42);
2827cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 42);
2828cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 42);
2829cc1dc7a3Sopenharmony_ci}
2830cc1dc7a3Sopenharmony_ci
2831cc1dc7a3Sopenharmony_ci/** @brief Test vint8 loada. */
2832cc1dc7a3Sopenharmony_ciTEST(vint8, Loada)
2833cc1dc7a3Sopenharmony_ci{
2834cc1dc7a3Sopenharmony_ci	vint8 a = vint8::loada(&(s32_data[0]));
2835cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
2836cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
2837cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2);
2838cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3);
2839cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 4);
2840cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 5);
2841cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 6);
2842cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 7);
2843cc1dc7a3Sopenharmony_ci}
2844cc1dc7a3Sopenharmony_ci
2845cc1dc7a3Sopenharmony_ci/** @brief Test vint8 lane_id. */
2846cc1dc7a3Sopenharmony_ciTEST(vint8, LaneID)
2847cc1dc7a3Sopenharmony_ci{
2848cc1dc7a3Sopenharmony_ci	vint8 a = vint8::lane_id();
2849cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
2850cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
2851cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2);
2852cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 3);
2853cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 4);
2854cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 5);
2855cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 6);
2856cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 7);
2857cc1dc7a3Sopenharmony_ci}
2858cc1dc7a3Sopenharmony_ci
2859cc1dc7a3Sopenharmony_ci/** @brief Test vint8 add. */
2860cc1dc7a3Sopenharmony_ciTEST(vint8, vadd)
2861cc1dc7a3Sopenharmony_ci{
2862cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
2863cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 4, 5, 2, 3, 4, 5);
2864cc1dc7a3Sopenharmony_ci	a = a + b;
2865cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 + 2);
2866cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 + 3);
2867cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3 + 4);
2868cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 + 5);
2869cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1 + 2);
2870cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2 + 3);
2871cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 3 + 4);
2872cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 4 + 5);
2873cc1dc7a3Sopenharmony_ci}
2874cc1dc7a3Sopenharmony_ci
2875cc1dc7a3Sopenharmony_ci
2876cc1dc7a3Sopenharmony_ci/** @brief Test vint8 self-add. */
2877cc1dc7a3Sopenharmony_ciTEST(vint8, vselfadd1)
2878cc1dc7a3Sopenharmony_ci{
2879cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
2880cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 4, 5, 2, 3, 4, 5);
2881cc1dc7a3Sopenharmony_ci	a += b;
2882cc1dc7a3Sopenharmony_ci
2883cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 + 2);
2884cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 + 3);
2885cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 3 + 4);
2886cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 + 5);
2887cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1 + 2);
2888cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2 + 3);
2889cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 3 + 4);
2890cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 4 + 5);
2891cc1dc7a3Sopenharmony_ci}
2892cc1dc7a3Sopenharmony_ci
2893cc1dc7a3Sopenharmony_ci/** @brief Test vint8 sub. */
2894cc1dc7a3Sopenharmony_ciTEST(vint8, vsub)
2895cc1dc7a3Sopenharmony_ci{
2896cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 4, 4, 1, 2, 4, 4);
2897cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 3, 5, 2, 3, 3, 5);
2898cc1dc7a3Sopenharmony_ci	a = a - b;
2899cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 - 2);
2900cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 - 3);
2901cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4 - 3);
2902cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 - 5);
2903cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1 - 2);
2904cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2 - 3);
2905cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 4 - 3);
2906cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 4 - 5);
2907cc1dc7a3Sopenharmony_ci}
2908cc1dc7a3Sopenharmony_ci
2909cc1dc7a3Sopenharmony_ci/** @brief Test vint8 mul. */
2910cc1dc7a3Sopenharmony_ciTEST(vint8, vmul)
2911cc1dc7a3Sopenharmony_ci{
2912cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 4, 4, 1, 2, 4, 4);
2913cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 3, 5, 2, 3, 3, 5);
2914cc1dc7a3Sopenharmony_ci	a = a * b;
2915cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1 * 2);
2916cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2 * 3);
2917cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4 * 3);
2918cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4 * 5);
2919cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1 * 2);
2920cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2 * 3);
2921cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 4 * 3);
2922cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 4 * 5);
2923cc1dc7a3Sopenharmony_ci}
2924cc1dc7a3Sopenharmony_ci
2925cc1dc7a3Sopenharmony_ci/** @brief Test vint8 bitwise invert. */
2926cc1dc7a3Sopenharmony_ciTEST(vint8, bit_invert)
2927cc1dc7a3Sopenharmony_ci{
2928cc1dc7a3Sopenharmony_ci	vint8 a(-1, 0, 1, 2, -1, 0, 1, 2);
2929cc1dc7a3Sopenharmony_ci	a = ~a;
2930cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), ~-1);
2931cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), ~0);
2932cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), ~1);
2933cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), ~2);
2934cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), ~-1);
2935cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), ~0);
2936cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), ~1);
2937cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), ~2);
2938cc1dc7a3Sopenharmony_ci}
2939cc1dc7a3Sopenharmony_ci
2940cc1dc7a3Sopenharmony_ci/** @brief Test vint8 bitwise or. */
2941cc1dc7a3Sopenharmony_ciTEST(vint8, bit_vor)
2942cc1dc7a3Sopenharmony_ci{
2943cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
2944cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 4, 5, 2, 3, 4, 5);
2945cc1dc7a3Sopenharmony_ci	a = a | b;
2946cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3);
2947cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 3);
2948cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 7);
2949cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 5);
2950cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 3);
2951cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 3);
2952cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7);
2953cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 5);
2954cc1dc7a3Sopenharmony_ci}
2955cc1dc7a3Sopenharmony_ci
2956cc1dc7a3Sopenharmony_ci/** @brief Test vint8 bitwise and. */
2957cc1dc7a3Sopenharmony_ciTEST(vint8, bit_vand)
2958cc1dc7a3Sopenharmony_ci{
2959cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
2960cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 4, 5, 2, 3, 4, 5);
2961cc1dc7a3Sopenharmony_ci	a = a & b;
2962cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
2963cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
2964cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 0);
2965cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 4);
2966cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 0);
2967cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2);
2968cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 0);
2969cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 4);
2970cc1dc7a3Sopenharmony_ci}
2971cc1dc7a3Sopenharmony_ci
2972cc1dc7a3Sopenharmony_ci/** @brief Test vint8 bitwise xor. */
2973cc1dc7a3Sopenharmony_ciTEST(vint8, bit_vxor)
2974cc1dc7a3Sopenharmony_ci{
2975cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
2976cc1dc7a3Sopenharmony_ci	vint8 b(2, 3, 4, 5, 2, 3, 4, 5);
2977cc1dc7a3Sopenharmony_ci	a = a ^ b;
2978cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 3);
2979cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
2980cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 7);
2981cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 1);
2982cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 3);
2983cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 1);
2984cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 7);
2985cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 1);
2986cc1dc7a3Sopenharmony_ci}
2987cc1dc7a3Sopenharmony_ci
2988cc1dc7a3Sopenharmony_ci/** @brief Test vint8 ceq. */
2989cc1dc7a3Sopenharmony_ciTEST(vint8, ceq)
2990cc1dc7a3Sopenharmony_ci{
2991cc1dc7a3Sopenharmony_ci	vint8 a1(1, 2, 3, 4, 1, 2, 3, 4);
2992cc1dc7a3Sopenharmony_ci	vint8 b1(0, 1, 2, 3, 0, 1, 2, 3);
2993cc1dc7a3Sopenharmony_ci	vmask8 r1 = a1 == b1;
2994cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r1));
2995cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r1));
2996cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r1));
2997cc1dc7a3Sopenharmony_ci
2998cc1dc7a3Sopenharmony_ci	vint8 a2(1, 2, 3, 4, 1, 2, 3, 4);
2999cc1dc7a3Sopenharmony_ci	vint8 b2(1, 0, 0, 0, 1, 0, 0, 0);
3000cc1dc7a3Sopenharmony_ci	vmask8 r2 = a2 == b2;
3001cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x11u, mask(r2));
3002cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
3003cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
3004cc1dc7a3Sopenharmony_ci
3005cc1dc7a3Sopenharmony_ci	vint8 a3(1, 2, 3, 4, 1, 2, 3, 4);
3006cc1dc7a3Sopenharmony_ci	vint8 b3(1, 0, 3, 0, 1, 0, 3, 0);
3007cc1dc7a3Sopenharmony_ci	vmask8 r3 = a3 == b3;
3008cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x55u, mask(r3));
3009cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
3010cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
3011cc1dc7a3Sopenharmony_ci
3012cc1dc7a3Sopenharmony_ci	vint8 a4(1, 2, 3, 4, 1, 2, 3, 4);
3013cc1dc7a3Sopenharmony_ci	vmask8 r4 = a4 == a4;
3014cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFFu, mask(r4));
3015cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r4));
3016cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r4));
3017cc1dc7a3Sopenharmony_ci}
3018cc1dc7a3Sopenharmony_ci
3019cc1dc7a3Sopenharmony_ci/** @brief Test vint8 cne. */
3020cc1dc7a3Sopenharmony_ciTEST(vint8, cne)
3021cc1dc7a3Sopenharmony_ci{
3022cc1dc7a3Sopenharmony_ci	vint8 a1(1, 2, 3, 4, 1, 2, 3, 4);
3023cc1dc7a3Sopenharmony_ci	vint8 b1(0, 1, 2, 3, 0, 1, 2, 3);
3024cc1dc7a3Sopenharmony_ci	vmask8 r1 = a1 != b1;
3025cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xFFu, mask(r1));
3026cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r1));
3027cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, all(r1));
3028cc1dc7a3Sopenharmony_ci
3029cc1dc7a3Sopenharmony_ci	vint8 a2(1, 2, 3, 4, 1, 2, 3, 4);
3030cc1dc7a3Sopenharmony_ci	vint8 b2(1, 0, 0, 0, 1, 0, 0, 0);
3031cc1dc7a3Sopenharmony_ci	vmask8 r2 = a2 != b2;
3032cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xEEu, mask(r2));
3033cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r2));
3034cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r2));
3035cc1dc7a3Sopenharmony_ci
3036cc1dc7a3Sopenharmony_ci	vint8 a3(1, 2, 3, 4, 1, 2, 3, 4);
3037cc1dc7a3Sopenharmony_ci	vint8 b3(1, 0, 3, 0, 1, 0, 3, 0);
3038cc1dc7a3Sopenharmony_ci	vmask8 r3 = a3 != b3;
3039cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAAu, mask(r3));
3040cc1dc7a3Sopenharmony_ci	EXPECT_EQ(true, any(r3));
3041cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r3));
3042cc1dc7a3Sopenharmony_ci
3043cc1dc7a3Sopenharmony_ci	vint8 a4(1, 2, 3, 4, 1, 2, 3, 4);
3044cc1dc7a3Sopenharmony_ci	vmask8 r4 = a4 != a4;
3045cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0u, mask(r4));
3046cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, any(r4));
3047cc1dc7a3Sopenharmony_ci	EXPECT_EQ(false, all(r4));
3048cc1dc7a3Sopenharmony_ci}
3049cc1dc7a3Sopenharmony_ci
3050cc1dc7a3Sopenharmony_ci/** @brief Test vint8 clt. */
3051cc1dc7a3Sopenharmony_ciTEST(vint8, clt)
3052cc1dc7a3Sopenharmony_ci{
3053cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
3054cc1dc7a3Sopenharmony_ci	vint8 b(0, 3, 3, 5, 0, 3, 3, 5);
3055cc1dc7a3Sopenharmony_ci	vmask8 r = a < b;
3056cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0xAAu, mask(r));
3057cc1dc7a3Sopenharmony_ci}
3058cc1dc7a3Sopenharmony_ci
3059cc1dc7a3Sopenharmony_ci/** @brief Test vint8 cgt. */
3060cc1dc7a3Sopenharmony_ciTEST(vint8, cgt)
3061cc1dc7a3Sopenharmony_ci{
3062cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
3063cc1dc7a3Sopenharmony_ci	vint8 b(0, 3, 3, 5, 0, 3, 3, 5);
3064cc1dc7a3Sopenharmony_ci	vmask8 r = a > b;
3065cc1dc7a3Sopenharmony_ci	EXPECT_EQ(0x11u, mask(r));
3066cc1dc7a3Sopenharmony_ci}
3067cc1dc7a3Sopenharmony_ci
3068cc1dc7a3Sopenharmony_ci/** @brief Test vint8 min. */
3069cc1dc7a3Sopenharmony_ciTEST(vint8, min)
3070cc1dc7a3Sopenharmony_ci{
3071cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
3072cc1dc7a3Sopenharmony_ci	vint8 b(0, 3, 3, 5, 0, 3, 3, 5);
3073cc1dc7a3Sopenharmony_ci	vint8 r = min(a, b);
3074cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0);
3075cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 2);
3076cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
3077cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 4);
3078cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 0);
3079cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 2);
3080cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3);
3081cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 4);
3082cc1dc7a3Sopenharmony_ci}
3083cc1dc7a3Sopenharmony_ci
3084cc1dc7a3Sopenharmony_ci/** @brief Test vint8 max. */
3085cc1dc7a3Sopenharmony_ciTEST(vint8, max)
3086cc1dc7a3Sopenharmony_ci{
3087cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 1, 2, 3, 4);
3088cc1dc7a3Sopenharmony_ci	vint8 b(0, 3, 3, 5, 0, 3, 3, 5);
3089cc1dc7a3Sopenharmony_ci	vint8 r = max(a, b);
3090cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 1);
3091cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 3);
3092cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
3093cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 5);
3094cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 1);
3095cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 3);
3096cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3);
3097cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 5);
3098cc1dc7a3Sopenharmony_ci}
3099cc1dc7a3Sopenharmony_ci
3100cc1dc7a3Sopenharmony_ci/** @brief Test vint8 lsl. */
3101cc1dc7a3Sopenharmony_ciTEST(vint8, lsl)
3102cc1dc7a3Sopenharmony_ci{
3103cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 4, -4, 1, 2, 4, -4);
3104cc1dc7a3Sopenharmony_ci	a = lsl<0>(a);
3105cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
3106cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
3107cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4);
3108cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), static_cast<int>(0xFFFFFFFC));
3109cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1);
3110cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2);
3111cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 4);
3112cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), static_cast<int>(0xFFFFFFFC));
3113cc1dc7a3Sopenharmony_ci
3114cc1dc7a3Sopenharmony_ci
3115cc1dc7a3Sopenharmony_ci	a = lsl<1>(a);
3116cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 2);
3117cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 4);
3118cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 8);
3119cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), static_cast<int>(0xFFFFFFF8));
3120cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 2);
3121cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 4);
3122cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 8);
3123cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), static_cast<int>(0xFFFFFFF8));
3124cc1dc7a3Sopenharmony_ci
3125cc1dc7a3Sopenharmony_ci	a = lsl<2>(a);
3126cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 8);
3127cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 16);
3128cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 32);
3129cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), static_cast<int>(0xFFFFFFE0));
3130cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 8);
3131cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 16);
3132cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 32);
3133cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), static_cast<int>(0xFFFFFFE0));
3134cc1dc7a3Sopenharmony_ci}
3135cc1dc7a3Sopenharmony_ci
3136cc1dc7a3Sopenharmony_ci/** @brief Test vint8 lsr. */
3137cc1dc7a3Sopenharmony_ciTEST(vint8, lsr)
3138cc1dc7a3Sopenharmony_ci{
3139cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 4, -4, 1, 2, 4, -4);
3140cc1dc7a3Sopenharmony_ci	a = lsr<0>(a);
3141cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 1);
3142cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 2);
3143cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 4);
3144cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), static_cast<int>(0xFFFFFFFC));
3145cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 1);
3146cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 2);
3147cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 4);
3148cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), static_cast<int>(0xFFFFFFFC));
3149cc1dc7a3Sopenharmony_ci
3150cc1dc7a3Sopenharmony_ci
3151cc1dc7a3Sopenharmony_ci	a = lsr<1>(a);
3152cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(), 0);
3153cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(), 1);
3154cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(), 2);
3155cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), 0x7FFFFFFE);
3156cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(), 0);
3157cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(), 1);
3158cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(), 2);
3159cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), 0x7FFFFFFE);
3160cc1dc7a3Sopenharmony_ci
3161cc1dc7a3Sopenharmony_ci	a = lsr<2>(a);
3162cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
3163cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  0);
3164cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  0);
3165cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(),  0x1FFFFFFF);
3166cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(),  0);
3167cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(),  0);
3168cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(),  0);
3169cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(),  0x1FFFFFFF);
3170cc1dc7a3Sopenharmony_ci}
3171cc1dc7a3Sopenharmony_ci
3172cc1dc7a3Sopenharmony_ci/** @brief Test vint8 asr. */
3173cc1dc7a3Sopenharmony_ciTEST(vint8, asr)
3174cc1dc7a3Sopenharmony_ci{
3175cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 4, -4, 1, 2, 4, -4);
3176cc1dc7a3Sopenharmony_ci	a = asr<0>(a);
3177cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  1);
3178cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  2);
3179cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  4);
3180cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), -4);
3181cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(),  1);
3182cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(),  2);
3183cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(),  4);
3184cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), -4);
3185cc1dc7a3Sopenharmony_ci
3186cc1dc7a3Sopenharmony_ci	a = asr<1>(a);
3187cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
3188cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  1);
3189cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  2);
3190cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), -2);
3191cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(),  0);
3192cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(),  1);
3193cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(),  2);
3194cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), -2);
3195cc1dc7a3Sopenharmony_ci
3196cc1dc7a3Sopenharmony_ci	// Note - quirk of asr is that you will get "stuck" at -1
3197cc1dc7a3Sopenharmony_ci	a = asr<2>(a);
3198cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<0>(),  0);
3199cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<1>(),  0);
3200cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<2>(),  0);
3201cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<3>(), -1);
3202cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<4>(),  0);
3203cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<5>(),  0);
3204cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<6>(),  0);
3205cc1dc7a3Sopenharmony_ci	EXPECT_EQ(a.lane<7>(), -1);
3206cc1dc7a3Sopenharmony_ci}
3207cc1dc7a3Sopenharmony_ci
3208cc1dc7a3Sopenharmony_ci/** @brief Test vint8 hmin. */
3209cc1dc7a3Sopenharmony_ciTEST(vint8, hmin)
3210cc1dc7a3Sopenharmony_ci{
3211cc1dc7a3Sopenharmony_ci	vint8 a1(1, 2, 1, 2, 1, 2, 1, 2);
3212cc1dc7a3Sopenharmony_ci	vint8 r1 = hmin(a1);
3213cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 1);
3214cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 1);
3215cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 1);
3216cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1);
3217cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 1);
3218cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 1);
3219cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 1);
3220cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 1);
3221cc1dc7a3Sopenharmony_ci
3222cc1dc7a3Sopenharmony_ci	vint8 a2(1, 2, -1, 5, 1, 2, -1, 5);
3223cc1dc7a3Sopenharmony_ci	vint8 r2 = hmin(a2);
3224cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), -1);
3225cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), -1);
3226cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), -1);
3227cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), -1);
3228cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), -1);
3229cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), -1);
3230cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), -1);
3231cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), -1);
3232cc1dc7a3Sopenharmony_ci}
3233cc1dc7a3Sopenharmony_ci
3234cc1dc7a3Sopenharmony_ci/** @brief Test vint8 hmax. */
3235cc1dc7a3Sopenharmony_ciTEST(vint8, hmax)
3236cc1dc7a3Sopenharmony_ci{
3237cc1dc7a3Sopenharmony_ci	vint8 a1(1, 2, 1, 2, 1, 3, 1, 2);
3238cc1dc7a3Sopenharmony_ci	vint8 r1 = hmax(a1);
3239cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 3);
3240cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3);
3241cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 3);
3242cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 3);
3243cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 3);
3244cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 3);
3245cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 3);
3246cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 3);
3247cc1dc7a3Sopenharmony_ci
3248cc1dc7a3Sopenharmony_ci	vint8 a2(1, 2, -1, 5, 1, 2, -1, 5);
3249cc1dc7a3Sopenharmony_ci	vint8 r2 = hmax(a2);
3250cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 5);
3251cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 5);
3252cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 5);
3253cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 5);
3254cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 5);
3255cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 5);
3256cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 5);
3257cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 5);
3258cc1dc7a3Sopenharmony_ci}
3259cc1dc7a3Sopenharmony_ci
3260cc1dc7a3Sopenharmony_ci/** @brief Test vint8 storea. */
3261cc1dc7a3Sopenharmony_ciTEST(vint8, storea)
3262cc1dc7a3Sopenharmony_ci{
3263cc1dc7a3Sopenharmony_ci	alignas(32) int out[8];
3264cc1dc7a3Sopenharmony_ci	vint8 a(s32_data);
3265cc1dc7a3Sopenharmony_ci	storea(a, out);
3266cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[0], 0);
3267cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 1);
3268cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 2);
3269cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 3);
3270cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[4], 4);
3271cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[5], 5);
3272cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[6], 6);
3273cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[7], 7);
3274cc1dc7a3Sopenharmony_ci}
3275cc1dc7a3Sopenharmony_ci
3276cc1dc7a3Sopenharmony_ci/** @brief Test vint8 store. */
3277cc1dc7a3Sopenharmony_ciTEST(vint8, store)
3278cc1dc7a3Sopenharmony_ci{
3279cc1dc7a3Sopenharmony_ci	alignas(32) int out[9];
3280cc1dc7a3Sopenharmony_ci	vint8 a(s32_data);
3281cc1dc7a3Sopenharmony_ci	store(a, out + 1);
3282cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 0);
3283cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[2], 1);
3284cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[3], 2);
3285cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[4], 3);
3286cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[5], 4);
3287cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[6], 5);
3288cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[7], 6);
3289cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[8], 7);
3290cc1dc7a3Sopenharmony_ci}
3291cc1dc7a3Sopenharmony_ci
3292cc1dc7a3Sopenharmony_ci/** @brief Test vint8 store_nbytes. */
3293cc1dc7a3Sopenharmony_ciTEST(vint8, store_nbytes)
3294cc1dc7a3Sopenharmony_ci{
3295cc1dc7a3Sopenharmony_ci	alignas(32) int out[2];
3296cc1dc7a3Sopenharmony_ci	vint8 a(42, 314, 75, 90, 42, 314, 75, 90);
3297cc1dc7a3Sopenharmony_ci	store_nbytes(a, reinterpret_cast<uint8_t*>(&out));
3298cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[0], 42);
3299cc1dc7a3Sopenharmony_ci	EXPECT_EQ(out[1], 314);
3300cc1dc7a3Sopenharmony_ci}
3301cc1dc7a3Sopenharmony_ci
3302cc1dc7a3Sopenharmony_ci/** @brief Test vint8 store_lanes_masked. */
3303cc1dc7a3Sopenharmony_ciTEST(vint8, store_lanes_masked)
3304cc1dc7a3Sopenharmony_ci{
3305cc1dc7a3Sopenharmony_ci	uint8_t resulta[32] { 0 };
3306cc1dc7a3Sopenharmony_ci
3307cc1dc7a3Sopenharmony_ci	// Store nothing
3308cc1dc7a3Sopenharmony_ci	vmask8 mask1 = vint8(0) == vint8(1);
3309cc1dc7a3Sopenharmony_ci	vint8 data1 = vint8(1);
3310cc1dc7a3Sopenharmony_ci
3311cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta, data1, mask1);
3312cc1dc7a3Sopenharmony_ci	vint8 result1v = vint8::load(resulta);
3313cc1dc7a3Sopenharmony_ci	vint8 expect1v = vint8::zero();
3314cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result1v == expect1v));
3315cc1dc7a3Sopenharmony_ci
3316cc1dc7a3Sopenharmony_ci	// Store half
3317cc1dc7a3Sopenharmony_ci	vmask8 mask2 = vint8(1, 1, 1, 1, 0, 0, 0, 0) == vint8(1);
3318cc1dc7a3Sopenharmony_ci	vint8 data2 = vint8(2);
3319cc1dc7a3Sopenharmony_ci
3320cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta, data2, mask2);
3321cc1dc7a3Sopenharmony_ci	vint8 result2v = vint8::load(resulta);
3322cc1dc7a3Sopenharmony_ci	vint8 expect2v = vint8(2, 2, 2, 2, 0, 0, 0, 0);
3323cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result2v == expect2v));
3324cc1dc7a3Sopenharmony_ci
3325cc1dc7a3Sopenharmony_ci	// Store all
3326cc1dc7a3Sopenharmony_ci	vmask8 mask3 = vint8(1) == vint8(1);
3327cc1dc7a3Sopenharmony_ci	vint8 data3 = vint8(3);
3328cc1dc7a3Sopenharmony_ci
3329cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta, data3, mask3);
3330cc1dc7a3Sopenharmony_ci	vint8 result3v = vint8::load(resulta);
3331cc1dc7a3Sopenharmony_ci	vint8 expect3v = vint8(3);
3332cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result3v == expect3v));
3333cc1dc7a3Sopenharmony_ci}
3334cc1dc7a3Sopenharmony_ci
3335cc1dc7a3Sopenharmony_ci/** @brief Test vint8 store_lanes_masked to unaligned address. */
3336cc1dc7a3Sopenharmony_ciTEST(vint8, store_lanes_masked_unaligned)
3337cc1dc7a3Sopenharmony_ci{
3338cc1dc7a3Sopenharmony_ci	uint8_t resulta[33] { 0 };
3339cc1dc7a3Sopenharmony_ci
3340cc1dc7a3Sopenharmony_ci	// Store nothing
3341cc1dc7a3Sopenharmony_ci	vmask8 mask1 = vint8(0) == vint8(1);
3342cc1dc7a3Sopenharmony_ci	vint8 data1 = vint8(1);
3343cc1dc7a3Sopenharmony_ci
3344cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta + 1, data1, mask1);
3345cc1dc7a3Sopenharmony_ci	vint8 result1v = vint8::load(resulta + 1);
3346cc1dc7a3Sopenharmony_ci	vint8 expect1v = vint8::zero();
3347cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result1v == expect1v));
3348cc1dc7a3Sopenharmony_ci
3349cc1dc7a3Sopenharmony_ci	// Store half
3350cc1dc7a3Sopenharmony_ci	vmask8 mask2 = vint8(1, 1, 1, 1, 0, 0, 0, 0) == vint8(1);
3351cc1dc7a3Sopenharmony_ci	vint8 data2 = vint8(2);
3352cc1dc7a3Sopenharmony_ci
3353cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta + 1, data2, mask2);
3354cc1dc7a3Sopenharmony_ci	vint8 result2v = vint8::load(resulta + 1);
3355cc1dc7a3Sopenharmony_ci	vint8 expect2v = vint8(2, 2, 2, 2, 0, 0, 0, 0);
3356cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result2v == expect2v));
3357cc1dc7a3Sopenharmony_ci
3358cc1dc7a3Sopenharmony_ci	// Store all
3359cc1dc7a3Sopenharmony_ci	vmask8 mask3 = vint8(1) == vint8(1);
3360cc1dc7a3Sopenharmony_ci	vint8 data3 = vint8(3);
3361cc1dc7a3Sopenharmony_ci
3362cc1dc7a3Sopenharmony_ci	store_lanes_masked(resulta + 1, data3, mask3);
3363cc1dc7a3Sopenharmony_ci	vint8 result3v = vint8::load(resulta + 1);
3364cc1dc7a3Sopenharmony_ci	vint8 expect3v = vint8(3);
3365cc1dc7a3Sopenharmony_ci	EXPECT_TRUE(all(result3v == expect3v));
3366cc1dc7a3Sopenharmony_ci}
3367cc1dc7a3Sopenharmony_ci
3368cc1dc7a3Sopenharmony_ci/** @brief Test vint8 gatheri. */
3369cc1dc7a3Sopenharmony_ciTEST(vint8, gatheri)
3370cc1dc7a3Sopenharmony_ci{
3371cc1dc7a3Sopenharmony_ci	vint8 indices(0, 4, 3, 2, 7, 4, 3, 2);
3372cc1dc7a3Sopenharmony_ci	vint8 r = gatheri(s32_data, indices);
3373cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), 0);
3374cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), 4);
3375cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<2>(), 3);
3376cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<3>(), 2);
3377cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<4>(), 7);
3378cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<5>(), 4);
3379cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<6>(), 3);
3380cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<7>(), 2);
3381cc1dc7a3Sopenharmony_ci}
3382cc1dc7a3Sopenharmony_ci
3383cc1dc7a3Sopenharmony_ci/** @brief Test vint8 pack_low_bytes. */
3384cc1dc7a3Sopenharmony_ciTEST(vint8, pack_low_bytes)
3385cc1dc7a3Sopenharmony_ci{
3386cc1dc7a3Sopenharmony_ci	vint8 a(1, 2, 3, 4, 2, 3, 4, 5);
3387cc1dc7a3Sopenharmony_ci	vint8 r = pack_low_bytes(a);
3388cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<0>(), (4 << 24) | (3 << 16) | (2  << 8) | (1 << 0));
3389cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r.lane<1>(), (5 << 24) | (4 << 16) | (3  << 8) | (2 << 0));
3390cc1dc7a3Sopenharmony_ci}
3391cc1dc7a3Sopenharmony_ci
3392cc1dc7a3Sopenharmony_ci/** @brief Test vint8 select. */
3393cc1dc7a3Sopenharmony_ciTEST(vint8, select)
3394cc1dc7a3Sopenharmony_ci{
3395cc1dc7a3Sopenharmony_ci	vint8 m1(1, 1, 1, 1, 1, 1, 1, 1);
3396cc1dc7a3Sopenharmony_ci	vint8 m2(1, 2, 1, 2, 1, 2, 1, 2);
3397cc1dc7a3Sopenharmony_ci	vmask8 cond = m1 == m2;
3398cc1dc7a3Sopenharmony_ci
3399cc1dc7a3Sopenharmony_ci	vint8 a(1, 3, 3, 1, 1, 3, 3, 1);
3400cc1dc7a3Sopenharmony_ci	vint8 b(4, 2, 2, 4, 4, 2, 2, 4);
3401cc1dc7a3Sopenharmony_ci
3402cc1dc7a3Sopenharmony_ci	vint8 r1 = select(a, b, cond);
3403cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<0>(), 4);
3404cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<1>(), 3);
3405cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<2>(), 2);
3406cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<3>(), 1);
3407cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<4>(), 4);
3408cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<5>(), 3);
3409cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<6>(), 2);
3410cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r1.lane<7>(), 1);
3411cc1dc7a3Sopenharmony_ci
3412cc1dc7a3Sopenharmony_ci	vint8 r2 = select(b, a, cond);
3413cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<0>(), 1);
3414cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<1>(), 2);
3415cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<2>(), 3);
3416cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<3>(), 4);
3417cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<4>(), 1);
3418cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<5>(), 2);
3419cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<6>(), 3);
3420cc1dc7a3Sopenharmony_ci	EXPECT_EQ(r2.lane<7>(), 4);
3421cc1dc7a3Sopenharmony_ci}
3422cc1dc7a3Sopenharmony_ci
3423cc1dc7a3Sopenharmony_ci// vmask8 tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3424cc1dc7a3Sopenharmony_ci
3425cc1dc7a3Sopenharmony_ci/** @brief Test vmask8 scalar literal constructor. */
3426cc1dc7a3Sopenharmony_ciTEST(vmask8, scalar_literal_construct)
3427cc1dc7a3Sopenharmony_ci{
3428cc1dc7a3Sopenharmony_ci	vfloat8 ma(0.0f);
3429cc1dc7a3Sopenharmony_ci	vfloat8 mb(1.0f);
3430cc1dc7a3Sopenharmony_ci
3431cc1dc7a3Sopenharmony_ci	vmask8 m1(true);
3432cc1dc7a3Sopenharmony_ci	vfloat8 r1 = select(ma, mb, m1);
3433cc1dc7a3Sopenharmony_ci	vmask8 rm1 = r1 == mb;
3434cc1dc7a3Sopenharmony_ci	EXPECT_EQ(all(rm1), true);
3435cc1dc7a3Sopenharmony_ci
3436cc1dc7a3Sopenharmony_ci	vmask8 m2(false);
3437cc1dc7a3Sopenharmony_ci	vfloat8 r2 = select(ma, mb, m2);
3438cc1dc7a3Sopenharmony_ci	vmask8 rm2 = r2 == mb;
3439cc1dc7a3Sopenharmony_ci	EXPECT_EQ(any(rm2), false);
3440cc1dc7a3Sopenharmony_ci}
3441cc1dc7a3Sopenharmony_ci
3442cc1dc7a3Sopenharmony_ci/** @brief Test vmask8 or. */
3443cc1dc7a3Sopenharmony_ciTEST(vmask8, or)
3444cc1dc7a3Sopenharmony_ci{
3445cc1dc7a3Sopenharmony_ci	vfloat8 m1a(0, 1, 0, 1, 0, 1, 0, 1);
3446cc1dc7a3Sopenharmony_ci	vfloat8 m1b(1, 1, 1, 1, 1, 1, 1, 1);
3447cc1dc7a3Sopenharmony_ci	vmask8 m1 = m1a == m1b;
3448cc1dc7a3Sopenharmony_ci
3449cc1dc7a3Sopenharmony_ci	vfloat8 m2a(1, 1, 0, 0, 1, 1, 0, 0);
3450cc1dc7a3Sopenharmony_ci	vfloat8 m2b(1, 1, 1, 1, 1, 1, 1, 1);
3451cc1dc7a3Sopenharmony_ci	vmask8 m2 = m2a == m2b;
3452cc1dc7a3Sopenharmony_ci
3453cc1dc7a3Sopenharmony_ci	vmask8 r = m1 | m2;
3454cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0xBBu);
3455cc1dc7a3Sopenharmony_ci}
3456cc1dc7a3Sopenharmony_ci
3457cc1dc7a3Sopenharmony_ci/** @brief Test vmask8 and. */
3458cc1dc7a3Sopenharmony_ciTEST(vmask8, and)
3459cc1dc7a3Sopenharmony_ci{
3460cc1dc7a3Sopenharmony_ci	vfloat8 m1a(0, 1, 0, 1, 0, 1, 0, 1);
3461cc1dc7a3Sopenharmony_ci	vfloat8 m1b(1, 1, 1, 1, 1, 1, 1, 1);
3462cc1dc7a3Sopenharmony_ci	vmask8 m1 = m1a == m1b;
3463cc1dc7a3Sopenharmony_ci
3464cc1dc7a3Sopenharmony_ci	vfloat8 m2a(1, 1, 0, 0, 1, 1, 0, 0);
3465cc1dc7a3Sopenharmony_ci	vfloat8 m2b(1, 1, 1, 1, 1, 1, 1, 1);
3466cc1dc7a3Sopenharmony_ci	vmask8 m2 = m2a == m2b;
3467cc1dc7a3Sopenharmony_ci
3468cc1dc7a3Sopenharmony_ci	vmask8 r = m1 & m2;
3469cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0x22u);
3470cc1dc7a3Sopenharmony_ci}
3471cc1dc7a3Sopenharmony_ci
3472cc1dc7a3Sopenharmony_ci/** @brief Test vmask8 xor. */
3473cc1dc7a3Sopenharmony_ciTEST(vmask8, xor)
3474cc1dc7a3Sopenharmony_ci{
3475cc1dc7a3Sopenharmony_ci	vfloat8 m1a(0, 1, 0, 1, 0, 1, 0, 1);
3476cc1dc7a3Sopenharmony_ci	vfloat8 m1b(1, 1, 1, 1, 1, 1, 1, 1);
3477cc1dc7a3Sopenharmony_ci	vmask8 m1 = m1a == m1b;
3478cc1dc7a3Sopenharmony_ci
3479cc1dc7a3Sopenharmony_ci	vfloat8 m2a(1, 1, 0, 0, 1, 1, 0, 0);
3480cc1dc7a3Sopenharmony_ci	vfloat8 m2b(1, 1, 1, 1, 1, 1, 1, 1);
3481cc1dc7a3Sopenharmony_ci	vmask8 m2 = m2a == m2b;
3482cc1dc7a3Sopenharmony_ci
3483cc1dc7a3Sopenharmony_ci	vmask8 r = m1 ^ m2;
3484cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0x99u);
3485cc1dc7a3Sopenharmony_ci}
3486cc1dc7a3Sopenharmony_ci
3487cc1dc7a3Sopenharmony_ci/** @brief Test vmask8 not. */
3488cc1dc7a3Sopenharmony_ciTEST(vmask8, not)
3489cc1dc7a3Sopenharmony_ci{
3490cc1dc7a3Sopenharmony_ci	vfloat8 m1a(0, 1, 0, 1, 0, 1, 0, 1);
3491cc1dc7a3Sopenharmony_ci	vfloat8 m1b(1, 1, 1, 1, 1, 1, 1, 1);
3492cc1dc7a3Sopenharmony_ci	vmask8 m1 = m1a == m1b;
3493cc1dc7a3Sopenharmony_ci	vmask8 r = ~m1;
3494cc1dc7a3Sopenharmony_ci	EXPECT_EQ(mask(r), 0x55u);
3495cc1dc7a3Sopenharmony_ci}
3496cc1dc7a3Sopenharmony_ci
3497cc1dc7a3Sopenharmony_ci/** @brief Test vint8 table permute. */
3498cc1dc7a3Sopenharmony_ciTEST(vint8, vtable_8bt_32bi_32entry)
3499cc1dc7a3Sopenharmony_ci{
3500cc1dc7a3Sopenharmony_ci	vint4 table0(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f);
3501cc1dc7a3Sopenharmony_ci	vint4 table1(0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f);
3502cc1dc7a3Sopenharmony_ci
3503cc1dc7a3Sopenharmony_ci	vint8 table0p, table1p;
3504cc1dc7a3Sopenharmony_ci	vtable_prepare(table0, table1, table0p, table1p);
3505cc1dc7a3Sopenharmony_ci
3506cc1dc7a3Sopenharmony_ci	vint8 index(0, 7, 4, 15, 16, 20, 23, 31);
3507cc1dc7a3Sopenharmony_ci
3508cc1dc7a3Sopenharmony_ci	vint8 result = vtable_8bt_32bi(table0p, table1p, index);
3509cc1dc7a3Sopenharmony_ci
3510cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<0>(),  3);
3511cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<1>(),  4);
3512cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<2>(),  7);
3513cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<3>(), 12);
3514cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<4>(), 19);
3515cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<5>(), 23);
3516cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<6>(), 20);
3517cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<7>(), 28);
3518cc1dc7a3Sopenharmony_ci}
3519cc1dc7a3Sopenharmony_ci
3520cc1dc7a3Sopenharmony_ci/** @brief Test vint4 table permute. */
3521cc1dc7a3Sopenharmony_ciTEST(vint8, vtable_8bt_32bi_64entry)
3522cc1dc7a3Sopenharmony_ci{
3523cc1dc7a3Sopenharmony_ci	vint4 table0(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f);
3524cc1dc7a3Sopenharmony_ci	vint4 table1(0x10111213, 0x14151617, 0x18191a1b, 0x1c1d1e1f);
3525cc1dc7a3Sopenharmony_ci	vint4 table2(0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f);
3526cc1dc7a3Sopenharmony_ci	vint4 table3(0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f);
3527cc1dc7a3Sopenharmony_ci
3528cc1dc7a3Sopenharmony_ci	vint8 table0p, table1p, table2p, table3p;
3529cc1dc7a3Sopenharmony_ci	vtable_prepare(table0, table1, table2, table3, table0p, table1p, table2p, table3p);
3530cc1dc7a3Sopenharmony_ci
3531cc1dc7a3Sopenharmony_ci	vint8 index(0, 7, 4, 15, 16, 20, 38, 63);
3532cc1dc7a3Sopenharmony_ci
3533cc1dc7a3Sopenharmony_ci	vint8 result = vtable_8bt_32bi(table0p, table1p, table2p, table3p, index);
3534cc1dc7a3Sopenharmony_ci
3535cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<0>(),  3);
3536cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<1>(),  4);
3537cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<2>(),  7);
3538cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<3>(), 12);
3539cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<4>(), 19);
3540cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<5>(), 23);
3541cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<6>(), 37);
3542cc1dc7a3Sopenharmony_ci	EXPECT_EQ(result.lane<7>(), 60);
3543cc1dc7a3Sopenharmony_ci}
3544cc1dc7a3Sopenharmony_ci
3545cc1dc7a3Sopenharmony_ci#endif
3546cc1dc7a3Sopenharmony_ci
3547cc1dc7a3Sopenharmony_ci}
3548