URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [vector-2.c] - Rev 816
Go to most recent revision | Compare with Previous | Blame | View Log
/* Check that vector insertion works correctly. */ #define vector __attribute__((vector_size(16) )) vector int f0(vector int t, int a) { ((int*)&t)[0] = a; return t; } vector int f1(vector int t, int a) { ((int*)&t)[1] = a; return t; } vector int f2(vector int t, int a) { ((int*)&t)[2] = a; return t; } vector int f3(vector int t, int a) { ((int*)&t)[3] = a; return t; } int main(void) { vector int a = {0, 0, 0, 0}; vector int b = {1, 0, 0, 0}; vector int c = {0, 1, 0, 0}; vector int d = {0, 0, 1, 0}; vector int e = {0, 0, 0, 1}; vector int a0; a0 = f0(a, 1); if (memcmp (&a0, &b, sizeof(a0))) __builtin_abort (); a0 = f1(a, 1); if (memcmp (&a0, &c, sizeof(a0))) __builtin_abort (); a0 = f2(a, 1); if (memcmp (&a0, &d, sizeof(a0))) __builtin_abort (); a0 = f3(a, 1); if (memcmp (&a0, &e, sizeof(a0))) __builtin_abort (); return 0; }
Go to most recent revision | Compare with Previous | Blame | View Log