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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-reduc-dot-s8a.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 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 DOT1 43680
9
 
10
signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11
signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12
 
13
/* char->short->int dot product.
14
   The dot-product pattern should be detected.
15
   Vectorizable on vect_sdot_qi targets (targets that support dot-product of
16
   signed chars).
17
 
18
   In the future could also be vectorized as widening-mult + widening-summation,
19
   or with type-conversion support.
20
 */
21
__attribute__ ((noinline)) int
22
foo1(int len) {
23
  int i;
24
  int result = 0;
25
  short prod;
26
 
27
  for (i=0; i<len; i++) {
28
    prod = X[i] * Y[i];
29
    result += prod;
30
  }
31
  return result;
32
}
33
 
34
int main (void)
35
{
36
  int i, dot1;
37
 
38
  check_vect ();
39
 
40
  for (i=0; i<N; i++) {
41
    X[i] = i;
42
    Y[i] = 64-i;
43
    __asm__ volatile ("");
44
  }
45
 
46
  dot1 = foo1 (N);
47
  if (dot1 != DOT1)
48
    abort ();
49
 
50
  return 0;
51
}
52
 
53
/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 1 "vect" } } */
54
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" } } */
55
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sdot_qi } } } */
56
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_qi_to_hi && vect_widen_sum_hi_to_si } } } } */
57
 
58
/* { 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.