|
16 | 16 | // Ensure incompatibilities with Windows macros (e.g. #define StoreFence) are |
17 | 17 | // detected. Must come before Highway headers. |
18 | 18 | #include "hwy/base.h" |
| 19 | +#include "hwy/nanobenchmark.h" |
19 | 20 | #include "hwy/tests/test_util.h" |
20 | 21 | #if HWY_OS_WIN |
21 | 22 | #ifndef NOMINMAX |
@@ -537,25 +538,26 @@ class TestStoreN { |
537 | 538 |
|
538 | 539 | const size_t lplb = HWY_MAX(N / 4, lpb); |
539 | 540 | for (size_t i = HWY_MAX(lpb * 2, lplb); i <= N * 2; i += lplb) { |
540 | | - size_t max_num_of_lanes_to_store = i + (11 & (lpb - 1)); |
| 541 | + size_t max_lanes_to_store = |
| 542 | + i + (11 & (lpb - 1)) + static_cast<size_t>(hwy::Unpredictable1() - 1); |
541 | 543 |
|
542 | | - const Vec<D> v = IotaForSpecial(d, max_num_of_lanes_to_store + 1); |
| 544 | + const Vec<D> v = IotaForSpecial(d, max_lanes_to_store + 1); |
543 | 545 | const Vec<D> v_expected = |
544 | | - IfThenElse(FirstN(d, max_num_of_lanes_to_store), v, v_neg_fill_val); |
| 546 | + IfThenElse(FirstN(d, max_lanes_to_store), v, v_neg_fill_val); |
545 | 547 |
|
546 | 548 | Store(v_expected, d, expected.get() + buf_offset); |
547 | 549 | Store(v_neg_fill_val, d, actual.get() + buf_offset); |
548 | | - StoreN(v, d, actual.get() + buf_offset, max_num_of_lanes_to_store); |
| 550 | + StoreN(v, d, actual.get() + buf_offset, max_lanes_to_store); |
549 | 551 |
|
550 | 552 | // Clang arm7 workaround; requires these to be non-const. |
551 | | - PreventElision(max_num_of_lanes_to_store); |
| 553 | + PreventElision(max_lanes_to_store); |
552 | 554 | PreventElision(buf_size); |
553 | 555 |
|
554 | 556 | HWY_ASSERT_ARRAY_EQ(expected.get(), actual.get(), buf_size); |
555 | 557 |
|
556 | 558 | StoreU(v_expected, d, expected.get() + buf_offset + 3); |
557 | 559 | StoreU(v_neg_fill_val, d, actual.get() + buf_offset + 3); |
558 | | - StoreN(v, d, actual.get() + buf_offset + 3, max_num_of_lanes_to_store); |
| 560 | + StoreN(v, d, actual.get() + buf_offset + 3, max_lanes_to_store); |
559 | 561 | HWY_ASSERT_ARRAY_EQ(expected.get(), actual.get(), buf_size); |
560 | 562 | } |
561 | 563 | } |
|
0 commit comments