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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [vector-shift2.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 688 jeremybenn
#define vector(elcount, type)  \
2
__attribute__((vector_size((elcount)*sizeof(type)))) type
3
 
4
#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
5
#define uint unsigned int
6
 
7
int main (int argc, char *argv[]) {
8
    vector(4, uint) vuint  = { 1,  2,  3,  4};
9
    vector(4,  int) vint0  = { 1,  1,  1,  1};
10
    vector(4,  int) vint1  = {-1, -1, -1, -1};
11
 
12
    vector(4,  int) i1, i2, i3;
13
    vector(4, uint) u1, u2, u3;
14
 
15
    i1 = vint1<< vint0;
16
 
17
    if (vidx(int, i1, 0) != ((int)-1 << (int)1))
18
        __builtin_abort ();
19
    if (vidx(int, i1, 1) != ((int)-1 << (int)1))
20
        __builtin_abort ();
21
    if (vidx(int, i1, 2) != ((int)-1 << (int)1))
22
        __builtin_abort ();
23
    if (vidx(int, i1, 3) != ((int)-1 << (int)1))
24
        __builtin_abort ();
25
 
26
    u1 = vuint << vint0;
27
 
28
    if (vidx(int, u1, 0) != ((uint)1  << (int)1))
29
        __builtin_abort ();
30
    if (vidx(int, u1, 1) != ((uint)2  << (int)1))
31
        __builtin_abort ();
32
    if (vidx(int, u1, 2) != ((uint)3  << (int)1))
33
        __builtin_abort ();
34
    if (vidx(int, u1, 3) != ((uint)4  << (int)1))
35
        __builtin_abort ();
36
 
37
 
38
    i2 = vint1 >> vuint;
39
 
40
    if (vidx(int, i2, 0) != ((int)-1  >> (uint)1))
41
        __builtin_abort ();
42
    if (vidx(int, i2, 1) != ((int)-1  >> (uint)2))
43
        __builtin_abort ();
44
    if (vidx(int, i2, 2) != ((int)-1  >> (uint)3))
45
        __builtin_abort ();
46
    if (vidx(int, i2, 3) != ((int)-1  >> (uint)4))
47
        __builtin_abort ();
48
 
49
 
50
    vint1 >>= vuint;
51
 
52
    vuint <<= vint0;
53
    vuint <<= vint1;
54
 
55
 
56
    return 0;
57
}
58
 
59
 

powered by: WebSVN 2.1.0

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