OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-reduc-dot-s8b.c] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 64
7
 
8
#define DOT2 -21856
9
 
10
signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11
signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12
 
13
/* char->short->short dot product.
14
   The dot-product pattern should be detected.
15
   The reduction is currently not vectorized becaus of the signed->unsigned->signed
16
   casts, since this patch:
17
 
18
     2005-12-26  Kazu Hirata  <kazu@codesourcery.com>
19
 
20
        PR tree-optimization/25125
21
 
22
   When the dot-product is detected, the loop should be vectorized on vect_sdot_qi
23
   targets (targets that support dot-product of signed char).
24
   This test would currently fail to vectorize on targets that support
25
   dot-product of chars into an int accumulator.
26
   Alternatively, the loop could also be vectorized as widening-mult + summation,
27
   or with type-conversion support.
28
 */
29
__attribute__ ((noinline)) short
30
foo2(int len) {
31
  int i;
32
  short result = 0;
33
 
34
  for (i=0; i<len; i++) {
35
    result += (X[i] * Y[i]);
36
  }
37
  return result;
38
}
39
 
40
int main (void)
41
{
42
  int i;
43
  short dot2;
44
 
45
  check_vect ();
46
 
47
  for (i=0; i<N; i++) {
48
    X[i] = i;
49
    Y[i] = 64-i;
50
    __asm__ volatile ("");
51
  }
52
 
53
  dot2 = foo2 (N);
54
  if (dot2 != DOT2)
55
    abort ();
56
 
57
  return 0;
58
}
59
 
60
/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 1 "vect" { xfail *-*-* } } } */
61
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { xfail vect_multiple_sizes } } } */
62
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 2 "vect" { target vect_multiple_sizes } } } */
63
 
64
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
65
 
66
/* { dg-final { cleanup-tree-dump "vect" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.