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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [pr49038.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target mmap } */
2
 
3
#include <sys/mman.h>
4
#include <stdio.h>
5
 
6
#define COUNT 320
7
#define MMAP_SIZE 0x10000
8
#define ADDRESS 0x1122000000
9
#define TYPE unsigned short
10
 
11
#ifndef MAP_ANONYMOUS
12
#define MAP_ANONYMOUS MAP_ANON
13
#endif
14
 
15
void __attribute__((noinline))
16
foo (TYPE *__restrict a, TYPE *__restrict b)
17
{
18
  int n;
19
 
20
  for (n = 0; n < COUNT; n++)
21
    a[n] = b[n * 2];
22
}
23
 
24
int
25
main (void)
26
{
27
  void *x;
28
  size_t b_offset;
29
 
30
  x = mmap ((void *) ADDRESS, MMAP_SIZE, PROT_READ | PROT_WRITE,
31
            MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
32
  if (x == MAP_FAILED)
33
    {
34
      perror ("mmap");
35
      return 1;
36
    }
37
 
38
  b_offset = MMAP_SIZE - (2 * COUNT - 1) * sizeof (TYPE);
39
  foo ((unsigned short *) x,
40
       (unsigned short *) ((char *) x + b_offset));
41
  return 0;
42
}
43
 
44
/* { dg-final { cleanup-tree-dump "vect" } } */

powered by: WebSVN 2.1.0

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