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-2.inc] - Blame information for rev 753

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

Line No. Rev Author Line
1 691 jeremybenn
typedef short __v2hi __attribute__ ((__vector_size__ (4)));
2
typedef short __v4hi __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 V2HI_TEST(N, elt0, elt1) \
24
static void \
25
test_v2hi_##N (unsigned short x, unsigned short y) \
26
{ \
27
  __v2hi v = { (elt0), (elt1) }; \
28
  compare32(N, &v, ((int)(elt0) << 16) | (elt1)); \
29
}
30
 
31
V2HI_TEST(1, x, y)
32
V2HI_TEST(2, y, x)
33
V2HI_TEST(3, x, x)
34
V2HI_TEST(4, x, 0)
35
V2HI_TEST(5, 0, x)
36
V2HI_TEST(6, y, 1)
37
V2HI_TEST(7, 1, y)
38
V2HI_TEST(8, 2, 3)
39
V2HI_TEST(9, 0x400, x)
40
V2HI_TEST(10, y, 0x8000)
41
 
42
#define V4HI_TEST(N, elt0, elt1, elt2, elt3)    \
43
static void \
44
test_v4hi_##N (unsigned short a, unsigned short b, unsigned short c, unsigned short d) \
45
{ \
46
  __v4hi v = { (elt0), (elt1), (elt2), (elt3) }; \
47
  compare64(N, &v, \
48
            ((long long)(elt0) << 48) | \
49
            ((long long)(elt1) << 32) | \
50
            ((long long)(elt2) << 16) | \
51
            ((long long)(elt3))); \
52
}
53
 
54
V4HI_TEST(1, a, a, a, a)
55
V4HI_TEST(2, a, b, c, d)
56
V4HI_TEST(3, a, a, b, b)
57
V4HI_TEST(4, d, c, b, a)
58
V4HI_TEST(5, a, 0, 0, 0)
59
V4HI_TEST(6, a, 0, b, 0)
60
V4HI_TEST(7, c, 5, 5, 5)
61
V4HI_TEST(8, d, 6, a, 6)
62
V4HI_TEST(9, 0x200, 0x300, 0x500, 0x8800)
63
V4HI_TEST(10, 0x600, a, a, a)
64
 
65
unsigned short a16 = 0x3344;
66
unsigned short b16 = 0x5566;
67
unsigned short c16 = 0x7788;
68
unsigned short d16 = 0x9911;
69
 
70
int main(void)
71
{
72
  test_v2hi_1 (a16, b16);
73
  test_v2hi_2 (a16, b16);
74
  test_v2hi_3 (a16, b16);
75
  test_v2hi_4 (a16, b16);
76
  test_v2hi_5 (a16, b16);
77
  test_v2hi_6 (a16, b16);
78
  test_v2hi_7 (a16, b16);
79
  test_v2hi_8 (a16, b16);
80
  test_v2hi_9 (a16, b16);
81
  test_v2hi_10 (a16, b16);
82
 
83
  test_v4hi_1 (a16, b16, c16, d16);
84
  test_v4hi_2 (a16, b16, c16, d16);
85
  test_v4hi_3 (a16, b16, c16, d16);
86
  test_v4hi_4 (a16, b16, c16, d16);
87
  test_v4hi_5 (a16, b16, c16, d16);
88
  test_v4hi_6 (a16, b16, c16, d16);
89
  test_v4hi_7 (a16, b16, c16, d16);
90
  test_v4hi_8 (a16, b16, c16, d16);
91
  test_v4hi_9 (a16, b16, c16, d16);
92
  test_v4hi_10 (a16, b16, c16, d16);
93
  return 0;
94
}

powered by: WebSVN 2.1.0

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