Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 7a1e72a

Browse files
authored
Fix bug and improve strength of simd_view_copy_move_assign.cpp. (#877)
Remove usage of [] operator on accessors. Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1 parent 857b056 commit 7a1e72a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

SYCL/ESIMD/api/simd_view_copy_move_assign.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ bool test(queue q, std::string str, F funcUnderTest) {
3838
// The expected result gets the first half of values from B,
3939
int gold[VL];
4040
for (int i = 0; i < VL; ++i) {
41-
A[i] = -i;
42-
B[i] = i;
43-
gold[i] = (i < HalfVL) ? B[i] : A[i];
41+
A[i] = -i - 1;
42+
B[i] = i + 1;
43+
gold[i] = ((VL > 1) && (i < HalfVL)) ? B[i] : A[i];
4444
}
4545

4646
try {
@@ -57,8 +57,8 @@ bool test(queue q, std::string str, F funcUnderTest) {
5757
simd<T, VL> va;
5858
simd<T, VL> vb;
5959
if constexpr (VL == 1) {
60-
va[0] = PA[0];
61-
vb[0] = PB[0];
60+
va[0] = scalar_load<T>(PA, 0);
61+
vb[0] = scalar_load<T>(PB, 0);
6262
} else {
6363
va.copy_from(PA, offset);
6464
vb.copy_from(PB, offset);
@@ -69,7 +69,7 @@ bool test(queue q, std::string str, F funcUnderTest) {
6969
funcUnderTest(va_view, vb_view);
7070

7171
if constexpr (VL == 1) {
72-
PA[0] = va[0];
72+
scalar_store(PB, 0, (T)va[0]);
7373
} else {
7474
va.copy_to(PA, offset);
7575
}

0 commit comments

Comments
 (0)