libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-s8b.c
blobb33bb4cc90704c9fc23e1d131b3cb3566cc77b69
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 } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 64
10 #define DOT2 -21856
12 signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
15 /* char->short->short dot product.
16 The dot-product pattern should be detected.
18 When the dot-product is detected, the loop should be vectorized on vect_sdot_qi
19 targets (targets that support dot-product of signed char).
20 This test would currently fail to vectorize on targets that support
21 dot-product of chars into an int accumulator.
22 Alternatively, the loop could also be vectorized as widening-mult + summation,
23 or with type-conversion support.
25 __attribute__ ((noinline)) short
26 foo2(int len) {
27 int i;
28 short result = 0;
30 for (i=0; i<len; i++) {
31 result += (X[i] * Y[i]);
33 return result;
36 int main (void)
38 int i;
39 short dot2;
41 check_vect ();
43 for (i=0; i<N; i++) {
44 X[i] = i;
45 Y[i] = 64-i;
46 __asm__ volatile ("");
49 dot2 = foo2 (N);
50 if (dot2 != DOT2)
51 abort ();
53 return 0;
56 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { xfail *-*-* } } } */
57 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target vect_widen_mult_qi_to_hi } } } */
59 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_qi_to_hi } } } */