| 1 |
/* { dg-do compile { target { arm*-*-* } } } */ |
| 2 |
/* { dg-require-effective-target arm_v8_1m_mve_ok } */ |
| 3 |
/* { dg-options "-O3 -save-temps" } */ |
| 4 |
/* { dg-add-options arm_v8_1m_mve } */ |
| 5 |
|
| 6 |
#include <limits.h> |
| 7 |
#include <arm_mve.h> |
| 8 |
|
| 9 |
/* Terminating on a non-zero number of elements. */ |
| 10 |
void test0 (uint8_t *a, uint8_t *b, uint8_t *c, int n) |
| 11 |
{ |
| 12 |
while (n > 1) |
| 13 |
{ |
| 14 |
mve_pred16_t p = vctp8q (n); |
| 15 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 16 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 17 |
uint8x16_t vc = vaddq_x_u8 (va, vb, p); |
| 18 |
vstrbq_p_u8 (c, vc, p); |
| 19 |
n -= 16; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
/* Terminating on n >= 0. */ |
| 24 |
void test1 (uint8_t *a, uint8_t *b, uint8_t *c, int n) |
| 25 |
{ |
| 26 |
while (n >= 0) |
| 27 |
{ |
| 28 |
mve_pred16_t p = vctp8q (n); |
| 29 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 30 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 31 |
uint8x16_t vc = vaddq_x_u8 (va, vb, p); |
| 32 |
vstrbq_p_u8 (c, vc, p); |
| 33 |
n -= 16; |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
/* Similar, terminating on a non-zero number of elements, but in a for loop |
| 38 |
format. */ |
| 39 |
int32_t a[] = {0, 1, 2, 3, 4, 5, 6, 7}; |
| 40 |
void test2 (int32_t *b, int num_elems) |
| 41 |
{ |
| 42 |
for (int i = num_elems; i >= 2; i-= 4) |
| 43 |
{ |
| 44 |
mve_pred16_t p = vctp32q (i); |
| 45 |
int32x4_t va = vldrwq_z_s32 (&(a[i]), p); |
| 46 |
vstrwq_p_s32 (b + i, va, p); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
/* Iteration counter counting up to num_iter, with a non-zero starting num. */ |
| 51 |
void test3 (uint8_t *a, uint8_t *b, uint8_t *c, int n) |
| 52 |
{ |
| 53 |
int num_iter = (n + 15)/16; |
| 54 |
for (int i = 1; i < num_iter; i++) |
| 55 |
{ |
| 56 |
mve_pred16_t p = vctp8q (n); |
| 57 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 58 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 59 |
uint8x16_t vc = vaddq_x_u8 (va, vb, p); |
| 60 |
vstrbq_p_u8 (c, vc, p); |
| 61 |
n -= 16; |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
/* Iteration counter counting up to num_iter, with a larger increment */ |
| 66 |
void test4 (uint8_t *a, uint8_t *b, uint8_t *c, int n) |
| 67 |
{ |
| 68 |
int num_iter = (n + 15)/16; |
| 69 |
for (int i = 0; i < num_iter; i+=2) |
| 70 |
{ |
| 71 |
mve_pred16_t p = vctp8q (n); |
| 72 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 73 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 74 |
uint8x16_t vc = vaddq_x_u8 (va, vb, p); |
| 75 |
vstrbq_p_u8 (c, vc, p); |
| 76 |
n -= 16; |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
/* Using an unpredicated store instruction within the loop. */ |
| 81 |
void test5 (uint8_t *a, uint8_t *b, uint8_t *c, uint8_t *d, int n) |
| 82 |
{ |
| 83 |
while (n > 0) |
| 84 |
{ |
| 85 |
mve_pred16_t p = vctp8q (n); |
| 86 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 87 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 88 |
uint8x16_t vc = vaddq_u8 (va, vb); |
| 89 |
uint8x16_t vd = vaddq_x_u8 (va, vb, p); |
| 90 |
vstrbq_u8 (d, vd); |
| 91 |
n -= 16; |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
/* Using an unpredicated store outside the loop. */ |
| 96 |
void test6 (uint8_t *a, uint8_t *b, uint8_t *c, int n, uint8x16_t vx) |
| 97 |
{ |
| 98 |
while (n > 0) |
| 99 |
{ |
| 100 |
mve_pred16_t p = vctp8q (n); |
| 101 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 102 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 103 |
uint8x16_t vc = vaddq_m_u8 (vx, va, vb, p); |
| 104 |
vx = vaddq_u8 (vx, vc); |
| 105 |
a += 16; |
| 106 |
b += 16; |
| 107 |
n -= 16; |
| 108 |
} |
| 109 |
vstrbq_u8 (c, vx); |
| 110 |
} |
| 111 |
|
| 112 |
/* Using a VPR that gets modified within the loop. */ |
| 113 |
void test9 (int32_t *a, int32_t *b, int32_t *c, int n) |
| 114 |
{ |
| 115 |
while (n > 0) |
| 116 |
{ |
| 117 |
mve_pred16_t p = vctp32q (n); |
| 118 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 119 |
p++; |
| 120 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 121 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 122 |
vstrwq_p_s32 (c, vc, p); |
| 123 |
c += 4; |
| 124 |
a += 4; |
| 125 |
b += 4; |
| 126 |
n -= 4; |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
/* Using a VPR that gets re-generated within the loop. Even though we |
| 131 |
currently reject such loops, it would be possible to dlstp transform this |
| 132 |
specific loop, as long as we make sure that the first vldrwq_z mask would |
| 133 |
either: |
| 134 |
* remain the same as its mask in the first iteration, |
| 135 |
* become the same as the loop mask after the first iteration, |
| 136 |
* become all ones, since the dlstp would then mask it the same as the loop |
| 137 |
mask. */ |
| 138 |
void test10a (int32_t *a, int32_t *b, int32_t *c, int n) |
| 139 |
{ |
| 140 |
mve_pred16_t p = vctp32q (n); |
| 141 |
while (n > 0) |
| 142 |
{ |
| 143 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 144 |
p = vctp32q (n); |
| 145 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 146 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 147 |
vstrwq_p_s32 (c, vc, p); |
| 148 |
c += 4; |
| 149 |
a += 4; |
| 150 |
b += 4; |
| 151 |
n -= 4; |
| 152 |
} |
| 153 |
} |
| 154 |
|
| 155 |
/* Using a VPR that gets re-generated within the loop, the difference between |
| 156 |
this test and test10a is to make sure the two vctp calls are never the same, |
| 157 |
this leads to slightly different codegen in some cases triggering the issue |
| 158 |
in a different way. This loop too would be OK to dlstp transform as long |
| 159 |
as we made sure that the first vldrwq_z mask would either: |
| 160 |
* remain the same as the its mask in the first iteration, |
| 161 |
* become the same as the loop mask after the first iteration, |
| 162 |
* become all ones, since the dlstp would then mask it the same as the loop |
| 163 |
mask. */ |
| 164 |
void test10b (int32_t *a, int32_t *b, int32_t *c, int n) |
| 165 |
{ |
| 166 |
mve_pred16_t p = vctp32q (n-4); |
| 167 |
while (n > 0) |
| 168 |
{ |
| 169 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 170 |
p = vctp32q (n); |
| 171 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 172 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 173 |
vstrwq_p_s32 (c, vc, p); |
| 174 |
c += 4; |
| 175 |
a += 4; |
| 176 |
b += 4; |
| 177 |
n -= 4; |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
/* Using vctp32q_m instead of vctp32q. */ |
| 182 |
void test11 (int32_t *a, int32_t *b, int32_t *c, int n, mve_pred16_t p0) |
| 183 |
{ |
| 184 |
while (n > 0) |
| 185 |
{ |
| 186 |
mve_pred16_t p = vctp32q_m (n, p0); |
| 187 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 188 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 189 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 190 |
vstrwq_p_s32 (c, vc, p); |
| 191 |
c += 4; |
| 192 |
a += 4; |
| 193 |
b += 4; |
| 194 |
n -= 4; |
| 195 |
} |
| 196 |
} |
| 197 |
|
| 198 |
/* Using an unpredicated op with a scalar output, where the result is valid |
| 199 |
outside the bb. This is invalid, because one of the inputs to the |
| 200 |
unpredicated op is also unpredicated. */ |
| 201 |
uint8_t test12 (uint8_t *a, uint8_t *b, uint8_t *c, int n, uint8x16_t vx) |
| 202 |
{ |
| 203 |
uint8_t sum = 0; |
| 204 |
while (n > 0) |
| 205 |
{ |
| 206 |
mve_pred16_t p = vctp8q (n); |
| 207 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 208 |
uint8x16_t vb = vldrbq_u8 (b); |
| 209 |
uint8x16_t vc = vaddq_u8 (va, vb); |
| 210 |
sum += vaddvq_u8 (vc); |
| 211 |
a += 16; |
| 212 |
b += 16; |
| 213 |
n -= 16; |
| 214 |
} |
| 215 |
return sum; |
| 216 |
} |
| 217 |
|
| 218 |
/* Using an unpredicated vcmp to generate a new predicate value in the |
| 219 |
loop and then using that VPR to predicate a store insn. */ |
| 220 |
void test13 (int32_t *a, int32_t *b, int32x4_t vc, int32_t *c, int n) |
| 221 |
{ |
| 222 |
while (n > 0) |
| 223 |
{ |
| 224 |
mve_pred16_t p = vctp32q (n); |
| 225 |
int32x4_t va = vldrwq_s32 (a); |
| 226 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 227 |
int32x4_t vc = vaddq_s32 (va, vb); |
| 228 |
mve_pred16_t p1 = vcmpeqq_s32 (va, vc); |
| 229 |
vstrwq_p_s32 (c, vc, p1); |
| 230 |
c += 4; |
| 231 |
a += 4; |
| 232 |
b += 4; |
| 233 |
n -= 4; |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
/* Using an across-vector unpredicated instruction. "vb" is the risk. */ |
| 238 |
uint16_t test14 (uint16_t *a, uint16_t *b, uint16_t *c, int n) |
| 239 |
{ |
| 240 |
uint16x8_t vb = vldrhq_u16 (b); |
| 241 |
uint16_t res = 0; |
| 242 |
while (n > 0) |
| 243 |
{ |
| 244 |
mve_pred16_t p = vctp16q (n); |
| 245 |
uint16x8_t va = vldrhq_z_u16 (a, p); |
| 246 |
vb = vaddq_u16 (va, vb); |
| 247 |
res = vaddvq_u16 (vb); |
| 248 |
c += 8; |
| 249 |
a += 8; |
| 250 |
b += 8; |
| 251 |
n -= 8; |
| 252 |
} |
| 253 |
return res; |
| 254 |
} |
| 255 |
|
| 256 |
/* Using an across-vector unpredicated instruction. "vc" is the risk. */ |
| 257 |
uint16_t test15 (uint16_t *a, uint16_t *b, uint16_t *c, int n) |
| 258 |
{ |
| 259 |
uint16x8_t vb = vldrhq_u16 (b); |
| 260 |
uint16_t res = 0; |
| 261 |
while (n > 0) |
| 262 |
{ |
| 263 |
mve_pred16_t p = vctp16q (n); |
| 264 |
uint16x8_t va = vldrhq_z_u16 (a, p); |
| 265 |
uint16x8_t vc = vaddq_u16 (va, vb); |
| 266 |
res = vaddvaq_u16 (res, vc); |
| 267 |
c += 8; |
| 268 |
a += 8; |
| 269 |
b += 8; |
| 270 |
n -= 8; |
| 271 |
} |
| 272 |
return res; |
| 273 |
} |
| 274 |
|
| 275 |
uint16_t test16 (uint16_t *a, uint16_t *b, uint16_t *c, int n) |
| 276 |
{ |
| 277 |
uint16_t res =0; |
| 278 |
while (n > 0) |
| 279 |
{ |
| 280 |
mve_pred16_t p = vctp16q (n); |
| 281 |
uint16x8_t vb = vldrhq_u16 (b); |
| 282 |
uint16x8_t va = vldrhq_z_u16 (a, p); |
| 283 |
res = vaddvaq_u16 (res, vb); |
| 284 |
res = vaddvaq_p_u16 (res, va, p); |
| 285 |
c += 8; |
| 286 |
a += 8; |
| 287 |
b += 8; |
| 288 |
n -= 8; |
| 289 |
} |
| 290 |
return res; |
| 291 |
} |
| 292 |
|
| 293 |
int test17 (int8_t *a, int8_t *b, int8_t *c, int n) |
| 294 |
{ |
| 295 |
int res = 0; |
| 296 |
while (n > 0) |
| 297 |
{ |
| 298 |
mve_pred16_t p = vctp8q (n); |
| 299 |
int8x16_t va = vldrbq_z_s8 (a, p); |
| 300 |
res = vmaxvq (res, va); |
| 301 |
n-=16; |
| 302 |
a+=16; |
| 303 |
} |
| 304 |
return res; |
| 305 |
} |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
int test18 (int8_t *a, int8_t *b, int8_t *c, int n) |
| 310 |
{ |
| 311 |
int res = 0; |
| 312 |
while (n > 0) |
| 313 |
{ |
| 314 |
mve_pred16_t p = vctp8q (n); |
| 315 |
int8x16_t va = vldrbq_z_s8 (a, p); |
| 316 |
res = vminvq (res, va); |
| 317 |
n-=16; |
| 318 |
a+=16; |
| 319 |
} |
| 320 |
return res; |
| 321 |
} |
| 322 |
|
| 323 |
int test19 (int8_t *a, int8_t *b, int8_t *c, int n) |
| 324 |
{ |
| 325 |
int res = 0; |
| 326 |
while (n > 0) |
| 327 |
{ |
| 328 |
mve_pred16_t p = vctp8q (n); |
| 329 |
int8x16_t va = vldrbq_z_s8 (a, p); |
| 330 |
res = vminavq (res, va); |
| 331 |
n-=16; |
| 332 |
a+=16; |
| 333 |
} |
| 334 |
return res; |
| 335 |
} |
| 336 |
|
| 337 |
int test20 (uint8_t *a, uint8_t *b, uint8_t *c, int n) |
| 338 |
{ |
| 339 |
int res = 0; |
| 340 |
while (n > 0) |
| 341 |
{ |
| 342 |
mve_pred16_t p = vctp8q (n); |
| 343 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 344 |
res = vminvq (res, va); |
| 345 |
n-=16; |
| 346 |
a+=16; |
| 347 |
} |
| 348 |
return res; |
| 349 |
} |
| 350 |
|
| 351 |
uint8x16_t test21 (uint8_t *a, uint32_t *b, int n, uint8x16_t res) |
| 352 |
{ |
| 353 |
while (n > 0) |
| 354 |
{ |
| 355 |
mve_pred16_t p = vctp8q (n); |
| 356 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 357 |
res = vshlcq_u8 (va, b, 1); |
| 358 |
n-=16; |
| 359 |
a+=16; |
| 360 |
} |
| 361 |
return res; |
| 362 |
} |
| 363 |
|
| 364 |
int8x16_t test22 (int8_t *a, int32_t *b, int n, int8x16_t res) |
| 365 |
{ |
| 366 |
while (n > 0) |
| 367 |
{ |
| 368 |
mve_pred16_t p = vctp8q (n); |
| 369 |
int8x16_t va = vldrbq_z_s8 (a, p); |
| 370 |
res = vshlcq_s8 (va, b, 1); |
| 371 |
n-=16; |
| 372 |
a+=16; |
| 373 |
} |
| 374 |
return res; |
| 375 |
} |
| 376 |
|
| 377 |
/* Using an unsigned number of elements to count down from, with a >0*/ |
| 378 |
void test23 (int32_t *a, int32_t *b, int32_t *c, unsigned int n) |
| 379 |
{ |
| 380 |
while (n > 0) |
| 381 |
{ |
| 382 |
mve_pred16_t p = vctp32q (n); |
| 383 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 384 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 385 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 386 |
vstrwq_p_s32 (c, vc, p); |
| 387 |
c+=4; |
| 388 |
a+=4; |
| 389 |
b+=4; |
| 390 |
n-=4; |
| 391 |
} |
| 392 |
} |
| 393 |
|
| 394 |
/* Using an unsigned number of elements to count up to, with a <n*/ |
| 395 |
void test24 (uint8_t *a, uint8_t *b, uint8_t *c, unsigned int n) |
| 396 |
{ |
| 397 |
for (int i = 0; i < n; i+=16) |
| 398 |
{ |
| 399 |
mve_pred16_t p = vctp8q (n-i); |
| 400 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 401 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 402 |
uint8x16_t vc = vaddq_x_u8 (va, vb, p); |
| 403 |
vstrbq_p_u8 (c, vc, p); |
| 404 |
n-=16; |
| 405 |
} |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
/* Using an unsigned number of elements to count up to, with a <=n*/ |
| 410 |
void test25 (uint8_t *a, uint8_t *b, uint8_t *c, unsigned int n) |
| 411 |
{ |
| 412 |
for (int i = 1; i <= n; i+=16) |
| 413 |
{ |
| 414 |
mve_pred16_t p = vctp8q (n-i+1); |
| 415 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 416 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 417 |
uint8x16_t vc = vaddq_x_u8 (va, vb, p); |
| 418 |
vstrbq_p_u8 (c, vc, p); |
| 419 |
n-=16; |
| 420 |
} |
| 421 |
} |
| 422 |
/* Update n twice in the loop. */ |
| 423 |
void test26 (int32_t *a, int32_t *b, int32_t *c, int n) |
| 424 |
{ |
| 425 |
while (n >= 1) |
| 426 |
{ |
| 427 |
n-=4; |
| 428 |
mve_pred16_t p = vctp32q (n); |
| 429 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 430 |
int32x4_t vb = vldrwq_z_s32 (b, p); |
| 431 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 432 |
vstrwq_p_s32 (c, vc, p); |
| 433 |
c+=4; |
| 434 |
a+=4; |
| 435 |
b+=4; |
| 436 |
n-=4; |
| 437 |
} |
| 438 |
} |
| 439 |
|
| 440 |
void test27 (int32_t *a, int32_t *c, int n) |
| 441 |
{ |
| 442 |
int32_t res = 0; |
| 443 |
while (n > 0) |
| 444 |
{ |
| 445 |
mve_pred16_t p = vctp32q (n); |
| 446 |
int32x4_t va = vldrwq_s32 (a); |
| 447 |
res += vaddvq_s32 (va); |
| 448 |
int32x4_t vc = vdupq_n_s32 (res); |
| 449 |
vstrwq_p_s32 (c, vc, p); |
| 450 |
a += 4; |
| 451 |
n -= 4; |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 455 |
/* Using an unpredicated vcmp to generate a new predicate value in the |
| 456 |
loop and then using it in a predicated store insn. */ |
| 457 |
void test28 (int32_t *a, int32_t *b, int32_t *c, int n) |
| 458 |
{ |
| 459 |
while (n > 0) |
| 460 |
{ |
| 461 |
mve_pred16_t p = vctp32q (n); |
| 462 |
int32x4_t va = vldrwq_z_s32 (a, p); |
| 463 |
int32x4_t vb = vldrwq_s32 (b); |
| 464 |
int32x4_t vc = vaddq_x_s32 (va, vb, p); |
| 465 |
mve_pred16_t p1 = vcmpeqq_s32 (va, vc); |
| 466 |
vstrwq_p_s32 (c, vc, p1); |
| 467 |
c += 4; |
| 468 |
a += 4; |
| 469 |
b += 4; |
| 470 |
n -= 4; |
| 471 |
} |
| 472 |
} |
| 473 |
|
| 474 |
/* Using an unpredicated op with a scalar output, where the result is valid |
| 475 |
outside the bb. The unpredicated lanes are not guaranteed zero, so would |
| 476 |
affect the vaddv in the non-tail predicated case. */ |
| 477 |
uint8_t test29 (uint8_t *a, uint8_t *b, uint8_t *c, int n, uint8x16_t vx) |
| 478 |
{ |
| 479 |
uint8_t sum = 0; |
| 480 |
while (n > 0) |
| 481 |
{ |
| 482 |
mve_pred16_t p = vctp8q (n); |
| 483 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 484 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 485 |
uint8x16_t vc = vaddq_m_u8 (vx, va, vb, p); |
| 486 |
sum += vaddvq_u8 (vc); |
| 487 |
a += 16; |
| 488 |
b += 16; |
| 489 |
n -= 16; |
| 490 |
} |
| 491 |
return sum; |
| 492 |
} |
| 493 |
|
| 494 |
/* Same as above, but with another scalar op between the unpredicated op and |
| 495 |
the scalar op outside the loop. */ |
| 496 |
uint8_t test30 (uint8_t *a, uint8_t *b, uint8_t *c, int n, uint8x16_t vx, int g) |
| 497 |
{ |
| 498 |
uint8_t sum = 0; |
| 499 |
while (n > 0) |
| 500 |
{ |
| 501 |
mve_pred16_t p = vctp8q (n); |
| 502 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 503 |
uint8x16_t vb = vldrbq_z_u8 (b, p); |
| 504 |
uint8x16_t vc = vaddq_m_u8 (vx, va, vb, p); |
| 505 |
sum += vaddvq_u8 (vc); |
| 506 |
sum += g; |
| 507 |
a += 16; |
| 508 |
b += 16; |
| 509 |
n -= 16; |
| 510 |
} |
| 511 |
return sum; |
| 512 |
} |
| 513 |
|
| 514 |
uint8_t test31 (uint8_t *a, uint8_t *b, int n) |
| 515 |
{ |
| 516 |
uint8_t res = 0; |
| 517 |
uint8x16_t vc = vdupq_n_u8 (0); |
| 518 |
while (n > 0) |
| 519 |
{ |
| 520 |
mve_pred16_t p = vctp8q (n); |
| 521 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 522 |
uint8x16_t vb = vldrbq_u8 (b); |
| 523 |
vc = vaddq (vb, vc); |
| 524 |
res = vgetq_lane (vc, 5); |
| 525 |
|
| 526 |
a += 16; |
| 527 |
b += 16; |
| 528 |
n -= 16; |
| 529 |
} |
| 530 |
return res; |
| 531 |
} |
| 532 |
|
| 533 |
uint8_t test32 (uint8_t *a, uint8_t *b, int n) |
| 534 |
{ |
| 535 |
uint8_t res = 0; |
| 536 |
uint8x16_t vc = vdupq_n_u8 (0); |
| 537 |
while (n > 0) |
| 538 |
{ |
| 539 |
mve_pred16_t p = vctp8q (n); |
| 540 |
uint8x16_t va = vldrbq_z_u8 (a, p); |
| 541 |
uint8x16_t vb = vldrbq_u8 (b); |
| 542 |
vc = vaddq_m (vc, va, vc, p); |
| 543 |
vc = vaddq (vb, vc); |
| 544 |
res = vgetq_lane (vc, 5); |
| 545 |
|
| 546 |
a += 16; |
| 547 |
b += 16; |
| 548 |
n -= 16; |
| 549 |
} |
| 550 |
return res; |
| 551 |
} |
| 552 |
|
| 553 |
/* { dg-final { scan-assembler-not "\tdlstp" } } */ |
| 554 |
/* { dg-final { scan-assembler-not "\tletp" } } */ |