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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-multitypes-9.c] - Blame information for rev 689

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
unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9
unsigned short uresult[N];
10
signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11
short result[N];
12
 
13
/* Unsigned type promotion (qi->hi) */
14
__attribute__ ((noinline)) int
15
foo1(int len) {
16
  int i;
17
 
18
  for (i=0; i<len; i++) {
19
    uresult[i] = (unsigned short)uX[i];
20
  }
21
}
22
 
23
/* Signed type promotion (qi->hi) */
24
__attribute__ ((noinline)) int
25
foo2(int len) {
26
  int i;
27
 
28
  for (i=0; i<len; i++) {
29
    result[i] = (short)X[i];
30
  }
31
}
32
 
33
int main (void)
34
{
35
  int i;
36
 
37
  check_vect ();
38
 
39
  for (i=0; i<N; i++) {
40
    X[i] = 16-i;
41
    uX[i] = 16-i;
42
    __asm__ volatile ("");
43
  }
44
 
45
  foo1 (N);
46
 
47
  for (i=0; i<N; i++) {
48
    if (uresult[i] != (unsigned short)uX[i])
49
      abort ();
50
  }
51
 
52
  foo2 (N);
53
 
54
  for (i=0; i<N; i++) {
55
    if (result[i] != (short)X[i])
56
      abort ();
57
  }
58
 
59
  return 0;
60
}
61
 
62
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */
63
/* { dg-final { cleanup-tree-dump "vect" } } */
64
 

powered by: WebSVN 2.1.0

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