i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-s8a.c
bloba300d976eb148ef2e41005886a4c46358c422890
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-additional-options "-march=armv8.2-a+dotprod" { target { aarch64*-*-* } } } */
6 /* { dg-add-options arm_v8_2a_dotprod_neon } */
8 #include <stdarg.h>
9 #include "tree-vect.h"
11 #define N 64
13 #define DOT1 43680
15 signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
16 signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
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).
23 In the future could also be vectorized as widening-mult + widening-summation,
24 or with type-conversion support.
26 __attribute__ ((noinline)) int
27 foo1(int len) {
28 int i;
29 int result = 0;
30 short prod;
32 for (i=0; i<len; i++) {
33 prod = X[i] * Y[i];
34 result += prod;
36 return result;
39 int main (void)
41 int i, dot1;
43 check_vect ();
45 for (i=0; i<N; i++) {
46 X[i] = i;
47 Y[i] = 64-i;
48 __asm__ volatile ("");
51 dot1 = foo1 (N);
52 if (dot1 != DOT1)
53 abort ();
55 return 0;
58 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target { vect_sdot_qi || { vect_widen_mult_qi_to_hi && vect_widen_sum_hi_to_si } } } } } */
59 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target { vect_sdot_qi || { vect_widen_mult_qi_to_hi && vect_widen_sum_hi_to_si } } } } } */
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 } } } } */