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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [sparc/] [vec-init-3.inc] - Blame information for rev 697

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

Line No. Rev Author Line
1 691 jeremybenn
typedef unsigned char __v4qi __attribute__ ((__vector_size__ (4)));
2
typedef unsigned char __v8qi __attribute__ ((__vector_size__ (8)));
3
 
4
extern void abort (void);
5
 
6
static void
7
compare64 (int n, void *p, unsigned long long val)
8
{
9
  unsigned long long *x = (unsigned long long *) p;
10
 
11
  if (*x != val)
12
    abort();
13
}
14
 
15
static void
16
compare32 (int n, void *p, unsigned int val)
17
{
18
  unsigned int *x = (unsigned int *) p;
19
  if (*x != val)
20
    abort();
21
}
22
 
23
#define V4QI_TEST(N, elt0, elt1, elt2, elt3)    \
24
static void \
25
test_v4qi_##N (unsigned char a, unsigned char b, unsigned char c, unsigned char d) \
26
{ \
27
  __v4qi v = { (elt0), (elt1), (elt2), (elt3) };        \
28
  compare32(N, &v, ((int)(elt0) << 24) | \
29
                   ((int)(elt1) << 16) | \
30
                   ((int)(elt2) << 8) | ((int)(elt3))); \
31
}
32
 
33
V4QI_TEST(1, a, a, a, a)
34
V4QI_TEST(2, b, b, b, b)
35
V4QI_TEST(3, a, b, c, d)
36
V4QI_TEST(4, d, c, b, a)
37
V4QI_TEST(5, a, 0, 0, 0)
38
V4QI_TEST(6, b, 1, 1, b)
39
V4QI_TEST(7, c, 5, d, 5)
40
V4QI_TEST(8, 0x20, 0x30, b, a)
41
V4QI_TEST(9, 0x40, 0x50, 0x60, 0x70)
42
V4QI_TEST(10, 0x40, 0x50, 0x60, c)
43
 
44
#define V8QI_TEST(N, elt0, elt1, elt2, elt3, elt4, elt5, elt6, elt7) \
45
static void \
46
test_v8qi_##N (unsigned char a, unsigned char b, unsigned char c, unsigned char d, \
47
               unsigned char e, unsigned char f, unsigned char g, unsigned char h) \
48
{ \
49
  __v8qi v = { (elt0), (elt1), (elt2), (elt3), \
50
               (elt4), (elt5), (elt6), (elt7) }; \
51
  compare64(N, &v, ((long long)(elt0) << 56) | \
52
                   ((long long)(elt1) << 48) | \
53
                   ((long long)(elt2) << 40) | \
54
                   ((long long)(elt3) << 32) | \
55
                   ((long long)(elt4) << 24) | \
56
                   ((long long)(elt5) << 16) | \
57
                   ((long long)(elt6) << 8) | \
58
                   ((long long)(elt7) << 0)); \
59
}
60
 
61
V8QI_TEST(1, a, a, a, a, a, a, a, a)
62
V8QI_TEST(2, a, b, c, d, e, f, g, h)
63
V8QI_TEST(3, h, g, f, e, d, c, b, a)
64
V8QI_TEST(4, a, b, a, b, a, b, a, b)
65
V8QI_TEST(5, c, b, c, b, c, b, c, a)
66
V8QI_TEST(6, a, 0, 0, 0, 0, 0, 0, 0)
67
V8QI_TEST(7, b, 1, b, 1, b, 1, b, 1)
68
V8QI_TEST(8, c, d, 0x20, a, 0x21, b, 0x23, c)
69
V8QI_TEST(9, 1, 2, 3, 4, 5, 6, 7, 8)
70
V8QI_TEST(10, a, a, b, b, c, c, d, d)
71
 
72
unsigned char a8 = 0x33;
73
unsigned char b8 = 0x55;
74
unsigned char c8 = 0x77;
75
unsigned char d8 = 0x99;
76
unsigned char e8 = 0x11;
77
unsigned char f8 = 0x22;
78
unsigned char g8 = 0x44;
79
unsigned char h8 = 0x66;
80
 
81
int main(void)
82
{
83
  test_v4qi_1 (a8, b8, c8, d8);
84
  test_v4qi_2 (a8, b8, c8, d8);
85
  test_v4qi_3 (a8, b8, c8, d8);
86
  test_v4qi_4 (a8, b8, c8, d8);
87
  test_v4qi_5 (a8, b8, c8, d8);
88
  test_v4qi_6 (a8, b8, c8, d8);
89
  test_v4qi_7 (a8, b8, c8, d8);
90
  test_v4qi_8 (a8, b8, c8, d8);
91
  test_v4qi_9 (a8, b8, c8, d8);
92
  test_v4qi_10 (a8, b8, c8, d8);
93
 
94
  test_v8qi_1 (a8, b8, c8, d8, e8, f8, g8, h8);
95
  test_v8qi_2 (a8, b8, c8, d8, e8, f8, g8, h8);
96
  test_v8qi_3 (a8, b8, c8, d8, e8, f8, g8, h8);
97
  test_v8qi_4 (a8, b8, c8, d8, e8, f8, g8, h8);
98
  test_v8qi_5 (a8, b8, c8, d8, e8, f8, g8, h8);
99
  test_v8qi_6 (a8, b8, c8, d8, e8, f8, g8, h8);
100
  test_v8qi_7 (a8, b8, c8, d8, e8, f8, g8, h8);
101
  test_v8qi_8 (a8, b8, c8, d8, e8, f8, g8, h8);
102
  test_v8qi_9 (a8, b8, c8, d8, e8, f8, g8, h8);
103
  test_v8qi_10 (a8, b8, c8, d8, e8, f8, g8, h8);
104
  return 0;
105
}

powered by: WebSVN 2.1.0

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