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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse-9.c] - Blame information for rev 20

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

Line No. Rev Author Line
1 12 jlechner
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2
/* { dg-options "-O2 -msse" } */
3
#include <xmmintrin.h>
4
#include <stdlib.h>
5
#include <stddef.h>
6
#include <string.h>
7
 
8
int
9
main()
10
{
11
  int alignment, n;
12
  void *ptr;
13
  int errors = 0;
14
  const char test [] = "This is a test.";
15
 
16
  for (alignment = 1; alignment <= (1 << 20); alignment += alignment)
17
    {
18
      ptr = _mm_malloc (alignment, alignment);
19
      if (((ptrdiff_t) ptr) & (alignment - 1))
20
        abort ();
21
      if (ptr)
22
        {
23
          n = alignment > sizeof test ? sizeof test : alignment;
24
          memcpy (ptr, test, n);
25
          if (memcmp (ptr, test, n) != 0)
26
            errors++;
27
          _mm_free (ptr);
28
        }
29
      else
30
        errors++;
31
    }
32
 
33
  if (errors != 0)
34
    abort ();
35
  exit (0);
36
}

powered by: WebSVN 2.1.0

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