2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr79824-2.c
blob629b97e21b123041e9bbdaa3d0f1eb08c1e0d9d8
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 double
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 b = __builtin_assume_aligned (b, sizeof (TYPE) * 2);
22 a = __builtin_assume_aligned (a, sizeof (TYPE) * 2);
23 for (n = 0; n < COUNT; n++)
25 a[n] = b[n * 4] + b[n * 4 + 1];
29 int
30 main (void)
32 void *x;
33 size_t b_offset;
35 check_vect ();
37 x = mmap ((void *) ADDRESS, MMAP_SIZE, PROT_READ | PROT_WRITE,
38 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
39 if (x == MAP_FAILED)
41 perror ("mmap");
42 return 1;
45 b_offset = MMAP_SIZE - (4 * COUNT - 2) * sizeof (TYPE);
46 foo ((TYPE *) x, (TYPE *) ((char *) x + b_offset));
47 return 0;