PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr49038.c
blobb9e812600b914582d9552adbf3bb5f024e19bf14
1 /* { dg-require-effective-target mmap } */
3 #include <sys/mman.h>
4 #include <stdio.h>
5 #include "tree-vect.h"
7 #define COUNT 320
8 #define MMAP_SIZE 0x10000
9 #define ADDRESS 0x1122000000
10 #define TYPE unsigned short
12 #ifndef MAP_ANONYMOUS
13 #define MAP_ANONYMOUS MAP_ANON
14 #endif
16 void __attribute__((noinline))
17 foo (TYPE *__restrict a, TYPE *__restrict b)
19 int n;
21 for (n = 0; n < COUNT; n++)
22 a[n] = b[n * 2];
25 int
26 main (void)
28 void *x;
29 size_t b_offset;
31 check_vect ();
33 x = mmap ((void *) ADDRESS, MMAP_SIZE, PROT_READ | PROT_WRITE,
34 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
35 if (x == MAP_FAILED)
37 perror ("mmap");
38 return 1;
41 b_offset = MMAP_SIZE - (2 * COUNT - 1) * sizeof (TYPE);
42 foo ((unsigned short *) x,
43 (unsigned short *) ((char *) x + b_offset));
44 return 0;