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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [altivec-varargs-1.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
2
/* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */
3
/* { dg-require-effective-target powerpc_altivec_ok } */
4
/* { dg-options "-maltivec -mabi=altivec -fno-inline" } */
5
 
6
#include <stdarg.h>
7
 
8
extern void exit (int);
9
extern void abort (void);
10
 
11
#define vector __attribute__((vector_size (16)))
12
 
13
const vector unsigned int v1 = {10,11,12,13};
14
const vector unsigned int v2 = {20,21,22,23};
15
const vector unsigned int v3 = {30,31,32,33};
16
const vector unsigned int v4 = {40,41,42,43};
17
 
18
void foo(vector unsigned int a, ...)
19
{
20
  va_list args;
21
  vector unsigned int v;
22
 
23
  va_start (args, a);
24
  if (memcmp (&a, &v1, sizeof (v)) != 0)
25
    abort ();
26
  v = va_arg (args, vector unsigned int);
27
  if (memcmp (&v, &v2, sizeof (v)) != 0)
28
    abort ();
29
  v = va_arg (args, vector unsigned int);
30
  if (memcmp (&v, &v3, sizeof (v)) != 0)
31
    abort ();
32
  v = va_arg (args, vector unsigned int);
33
  if (memcmp (&v, &v4, sizeof (v)) != 0)
34
    abort ();
35
  va_end (args);
36
}
37
 
38
void bar(vector unsigned int a, ...)
39
{
40
  va_list args;
41
  vector unsigned int v;
42
  int b;
43
 
44
  va_start (args, a);
45
  if (memcmp (&a, &v1, sizeof (v)) != 0)
46
    abort ();
47
  b = va_arg (args, int);
48
  if (b != 2)
49
    abort ();
50
  v = va_arg (args, vector unsigned int);
51
  if (memcmp (&v, &v2, sizeof (v)) != 0)
52
    abort ();
53
  v = va_arg (args, vector unsigned int);
54
  if (memcmp (&v, &v3, sizeof (v)) != 0)
55
    abort ();
56
  va_end (args);
57
}
58
 
59
 
60
int main1(void)
61
{
62
  /* In this call, in the Darwin ABI, the first argument goes into v2
63
     the second one into r9-r10 and memory,
64
     and the next two in memory.  */
65
  foo ((vector unsigned int){10,11,12,13},
66
       (vector unsigned int){20,21,22,23},
67
       (vector unsigned int){30,31,32,33},
68
       (vector unsigned int){40,41,42,43});
69
  /* In this call, in the Darwin ABI, the first argument goes into v2
70
     the second one into r9, then r10 is reserved and
71
     there are two words of padding in memory, and the next two arguments
72
     go after the padding.  */
73
  bar ((vector unsigned int){10,11,12,13}, 2,
74
       (vector unsigned int){20,21,22,23},
75
       (vector unsigned int){30,31,32,33});
76
  return 0;
77
}
78
 
79
int main (void)
80
{
81
  return main1 ();
82
}

powered by: WebSVN 2.1.0

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