| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */ |
| 3 |
/* { dg-require-effective-target vect_int } */ |
| 4 |
/* { dg-require-effective-target arm_v8_2a_dotprod_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */ |
| 5 |
/* { dg-add-options arm_v8_2a_dotprod_neon } */ |
| 6 |
|
| 7 |
#include "tree-vect.h" |
| 8 |
|
| 9 |
#ifndef SIGNEDNESS_1 |
| 10 |
#define SIGNEDNESS_1 signed |
| 11 |
#define SIGNEDNESS_2 signed |
| 12 |
#endif |
| 13 |
|
| 14 |
SIGNEDNESS_1 int __attribute__ ((noipa)) |
| 15 |
f (SIGNEDNESS_1 int res, |
| 16 |
SIGNEDNESS_2 short *a, |
| 17 |
SIGNEDNESS_2 short *b, |
| 18 |
int step, int n) |
| 19 |
{ |
| 20 |
for (int i = 0; i < n; i++) |
| 21 |
{ |
| 22 |
res += a[0] * b[0]; |
| 23 |
res += a[1] * b[1]; |
| 24 |
res += a[2] * b[2]; |
| 25 |
res += a[3] * b[3]; |
| 26 |
res += a[4] * b[4]; |
| 27 |
res += a[5] * b[5]; |
| 28 |
res += a[6] * b[6]; |
| 29 |
res += a[7] * b[7]; |
| 30 |
|
| 31 |
a += step; |
| 32 |
b += step; |
| 33 |
} |
| 34 |
|
| 35 |
return res; |
| 36 |
} |
| 37 |
|
| 38 |
#define BASE ((SIGNEDNESS_2 int) -1 < 0 ? -1026 : 373) |
| 39 |
#define OFFSET 20 |
| 40 |
|
| 41 |
int |
| 42 |
main (void) |
| 43 |
{ |
| 44 |
check_vect (); |
| 45 |
|
| 46 |
SIGNEDNESS_2 short a[100], b[100]; |
| 47 |
int expected = 0x12345; |
| 48 |
int step = 8; |
| 49 |
int n = 2; |
| 50 |
int t = 0; |
| 51 |
|
| 52 |
#pragma GCC novector |
| 53 |
for (int i = 0; i < sizeof (a) / sizeof (a[0]); ++i) |
| 54 |
{ |
| 55 |
a[i] = BASE + i * 5; |
| 56 |
b[i] = BASE + OFFSET + i * 4; |
| 57 |
} |
| 58 |
|
| 59 |
#pragma GCC novector |
| 60 |
for (int i = 0; i < n; i++) |
| 61 |
{ |
| 62 |
expected += a[t + 0] * b[t + 0]; |
| 63 |
expected += a[t + 1] * b[t + 1]; |
| 64 |
expected += a[t + 2] * b[t + 2]; |
| 65 |
expected += a[t + 3] * b[t + 3]; |
| 66 |
expected += a[t + 4] * b[t + 4]; |
| 67 |
expected += a[t + 5] * b[t + 5]; |
| 68 |
expected += a[t + 6] * b[t + 6]; |
| 69 |
expected += a[t + 7] * b[t + 7]; |
| 70 |
t += step; |
| 71 |
} |
| 72 |
|
| 73 |
if (f (0x12345, a, b, step, n) != expected) |
| 74 |
__builtin_abort (); |
| 75 |
} |
| 76 |
|
| 77 |
/* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */ |
| 78 |
/* { dg-final { scan-tree-dump "vectorizing SLP node starting from: \\S+ = DOT_PROD_EXPR" "vect" { target vect_sdot_hi } } } */ |