38#include <gtest/gtest.h>
47 constexpr size_t size = 4;
52 for (
auto idx = 0; idx < size; idx++) {
53 ASSERT_FALSE(
vec[idx]);
59 constexpr size_t size = 4;
64 for (
auto idx = 0; idx < size; idx++) {
65 ASSERT_TRUE(
vec[idx]);
73 static constexpr ssize_t
size = 4;
82 for (
auto idx = 0; idx <
size; idx++) {
83 pred1[idx] = (idx % 2);
88 for (
auto idx = 0; idx <
size; idx++) {
89 pred2[idx] = !(idx % 2);
102 for (
auto idx = 0; idx < size; idx++) {
103 ASSERT_EQ(pred2[idx], idx % 2);
111 ASSERT_TRUE(pred1 == pred1);
112 ASSERT_TRUE(pred2 == pred2);
113 ASSERT_FALSE(pred1 == pred2);
120 ASSERT_FALSE(pred1 != pred1);
121 ASSERT_FALSE(pred2 != pred2);
122 ASSERT_TRUE(pred1 != pred2);
129 std::ostringstream stream;
131 ASSERT_EQ(stream.str(),
"[0 1 0 1]");
135 std::ostringstream stream;
137 ASSERT_EQ(stream.str(),
"[1 0 1 0]");
145 parser.parse(
"1111", pred1);
146 parser.parse(
"0000", pred2);
148 for (
auto idx = 0; idx < size; idx++) {
149 ASSERT_EQ(pred1[idx], 1);
150 ASSERT_EQ(pred2[idx], 0);
160 std::stringstream
ss;
162 ASSERT_EQ(
ss.str(),
"0101");
166 std::stringstream
ss;
167 parser.show(
ss, pred2);
168 ASSERT_EQ(
ss.str(),
"1010");
185 auto pred1_view = pred1.as<uint8_t>();
186 auto pred2_view = pred2.as<uint8_t>();
188 for (
auto idx = 0; idx < size; idx++) {
189 ASSERT_EQ(pred1_view[idx], idx % 2);
190 ASSERT_EQ(pred2_view[idx], !(idx % 2));
203 auto pred1_view = pred1.as<uint16_t>();
204 auto pred2_view = pred2.as<uint16_t>();
206 for (
auto idx = 0; idx < size /
sizeof(uint16_t); idx++) {
207 ASSERT_FALSE(pred1_view[idx]);
208 ASSERT_TRUE(pred2_view[idx]);
219 auto pred1_view = pred1.as<uint32_t>();
220 auto pred2_view = pred2.as<uint32_t>();
222 ASSERT_FALSE(pred1_view[0]);
223 ASSERT_TRUE(pred2_view[0]);
239 auto pred1_view = pred1.as<uint8_t>();
240 auto pred2_view = pred2.as<uint8_t>();
242 for (
auto idx = 0; idx < size; idx++) {
243 ASSERT_EQ(pred1_view[idx], idx % 2);
244 ASSERT_EQ(pred2_view[idx], !(idx % 2));
261 auto pred1_view = pred1.as<uint16_t>();
262 auto pred2_view = pred2.as<uint16_t>();
264 for (
auto idx = 0; idx < size; idx++) {
265 ASSERT_EQ(pred1_view[idx], idx % 2);
266 ASSERT_EQ(pred2_view[idx], !(idx % 2));
283 auto pred1_view = pred1.as<uint32_t>();
284 auto pred2_view = pred2.as<uint32_t>();
286 for (
auto idx = 0; idx < size; idx++) {
287 ASSERT_EQ(pred1_view[idx], idx % 2);
288 ASSERT_EQ(pred2_view[idx], !(idx % 2));
static constexpr ssize_t size
VecPredRegContainer< size, T > pred1
VecPredRegContainer< size, T > pred2
Generic predicate register container.
void set()
Sets the predicate register to an all-true value.
void reset()
Resets the predicate register to an all-false register.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
static void show(std::ostream &os, const T &value)
TEST_F(TwoDifferentVecPredRegs, Assignment)