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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [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 689 jeremybenn
/* { dg-do run } */
2
 
3
#define vector(elcount, type)  \
4
__attribute__((vector_size((elcount)*sizeof(type)))) type
5
 
6
#define vidx(type, vec, idx) (*((type *) &(vec) + idx))
7
#define schar signed char
8
#define uchar unsigned char
9
 
10
#define ch14 1,2,3,4
11
#define ch1  1,1,1,1
12
#define chm1 -1,-1,-1,-1
13
 
14
int main (int argc, char *argv[]) {
15
    vector(16, uchar) vuchar  = { ch14, ch14, ch14, ch14};
16
    vector(16, schar) vchar0  = { ch1, ch1, ch1, ch1};
17
    vector(16, schar) vchar1  = { chm1, chm1, chm1, chm1};
18
 
19
    vector(16, schar) i1, i2, i3;
20
    vector(16, uchar) u1, u2, u3;
21
 
22
    i1 = vchar1<< vchar0;
23
 
24
    if (vidx(schar, i1, 0) != ((schar)-1 << (schar)1))
25
        __builtin_abort ();
26
    if (vidx(schar, i1, 1) != ((schar)-1 << (schar)1))
27
        __builtin_abort ();
28
    if (vidx(schar, i1, 2) != ((schar)-1 << (schar)1))
29
        __builtin_abort ();
30
    if (vidx(schar, i1, 3) != ((schar)-1 << (schar)1))
31
        __builtin_abort ();
32
    u1 = vuchar << vchar0;
33
 
34
    if (vidx(uchar, u1, 0) != ((uchar)1  << (schar)1))
35
        __builtin_abort ();
36
    if (vidx(uchar, u1, 1) != ((uchar)2  << (schar)1))
37
        __builtin_abort ();
38
    if (vidx(uchar, u1, 2) != ((uchar)3  << (schar)1))
39
        __builtin_abort ();
40
    if (vidx(uchar, u1, 3) != ((uchar)4  << (schar)1))
41
        __builtin_abort ();
42
 
43
 
44
    i2 = vchar1 >> vuchar;
45
 
46
    if (vidx(schar, i2, 0) != ((schar)-1  >> (uchar)1))
47
        __builtin_abort ();
48
    if (vidx(schar, i2, 1) != ((schar)-1  >> (uchar)2))
49
        __builtin_abort ();
50
    if (vidx(schar, i2, 2) != ((schar)-1  >> (uchar)3))
51
        __builtin_abort ();
52
    if (vidx(schar, i2, 3) != ((schar)-1  >> (uchar)4))
53
        __builtin_abort ();
54
 
55
    vchar1 >>= vuchar;
56
    vuchar <<= vchar0;
57
    vuchar <<= vchar1;
58
 
59
    return 0;
60
}
61
 

powered by: WebSVN 2.1.0

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