145
|
1 /* Disabling epilogues until we find a better way to deal with scans. */
|
|
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
|
111
|
3 /* { dg-require-effective-target vect_int } */
|
|
4 /* { dg-require-effective-target arm_v8_2a_dotprod_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
|
|
5 /* { dg-additional-options "-march=armv8.2-a+dotprod" { target { aarch64*-*-* } } } */
|
|
6 /* { dg-add-options arm_v8_2a_dotprod_neon } */
|
|
7
|
|
8 #include <stdarg.h>
|
|
9 #include "tree-vect.h"
|
|
10
|
|
11 #define N 64
|
|
12
|
|
13 #define DOT1 43680
|
|
14
|
|
15 signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
|
|
16 signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
|
|
17
|
|
18 /* char->short->int dot product.
|
|
19 The dot-product pattern should be detected.
|
|
20 Vectorizable on vect_sdot_qi targets (targets that support dot-product of
|
|
21 signed chars).
|
|
22
|
|
23 In the future could also be vectorized as widening-mult + widening-summation,
|
|
24 or with type-conversion support.
|
|
25 */
|
|
26 __attribute__ ((noinline)) int
|
|
27 foo1(int len) {
|
|
28 int i;
|
|
29 int result = 0;
|
|
30 short prod;
|
|
31
|
|
32 for (i=0; i<len; i++) {
|
|
33 prod = X[i] * Y[i];
|
|
34 result += prod;
|
|
35 }
|
|
36 return result;
|
|
37 }
|
|
38
|
|
39 int main (void)
|
|
40 {
|
|
41 int i, dot1;
|
|
42
|
|
43 check_vect ();
|
|
44
|
|
45 for (i=0; i<N; i++) {
|
|
46 X[i] = i;
|
|
47 Y[i] = 64-i;
|
|
48 __asm__ volatile ("");
|
|
49 }
|
|
50
|
|
51 dot1 = foo1 (N);
|
|
52 if (dot1 != DOT1)
|
|
53 abort ();
|
|
54
|
|
55 return 0;
|
|
56 }
|
|
57
|
|
58 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 1 "vect" } } */
|
|
59 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" } } */
|
|
60 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sdot_qi } } } */
|
|
61 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_qi_to_hi && vect_widen_sum_hi_to_si } } } } */
|
|
62
|