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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [stackalign/] [vararg-3.c] - Blame information for rev 424

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

Line No. Rev Author Line
1 298 jeremybenn
/* PR middle-end/37009 */
2
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
3
/* { dg-options "-msse2" } */
4
/* { dg-require-effective-target sse2 } */
5
/* { dg-require-effective-target sse2_runtime } */
6
 
7
#include <stdarg.h>
8
#include <emmintrin.h>
9
#include "check.h"
10
 
11
#ifndef ALIGNMENT
12
#define ALIGNMENT       16
13
#endif
14
 
15
typedef int aligned __attribute__((aligned(ALIGNMENT)));
16
 
17
void
18
bar (char *p, int size)
19
{
20
  __builtin_strncpy (p, "good", size);
21
}
22
 
23
__m128 a = { 1.0 };
24
 
25
void
26
test (va_list arg)
27
{
28
  char *p;
29
  aligned i;
30
  int size;
31
  double x;
32
  __m128 e;
33
 
34
  size = va_arg (arg, int);
35
  if (size != 5)
36
    abort ();
37
 
38
  p = __builtin_alloca (size + 1);
39
 
40
  x = va_arg (arg, double);
41
  if (x != 5.0)
42
    abort ();
43
 
44
  bar (p, size);
45
  if (__builtin_strncmp (p, "good", size) != 0)
46
    {
47
#ifdef DEBUG
48
      p[size] = '\0';
49
      printf ("Failed: %s != good\n", p);
50
#endif
51
      abort ();
52
    }
53
 
54
  if (check_int (&i,  __alignof__(i)) != i)
55
    abort ();
56
 
57
  e = va_arg (arg, __m128);
58
  if (__builtin_memcmp (&e, &a, sizeof (e)))
59
    abort ();
60
}
61
 
62
void
63
foo (const char *fmt, ...)
64
{
65
  va_list arg;
66
  va_start (arg, fmt);
67
  test (arg);
68
  va_end (arg);
69
}
70
 
71
int
72
main (void)
73
{
74
  __m128 x = { 1.0 };
75
 
76
  foo ("foo", 5, 5.0, x);
77
 
78
  return 0;
79
}

powered by: WebSVN 2.1.0

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