libstdc++: Add missing constexpr to __atomic_impl::__clear_padding
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / builtin-prefetch-5.c
blobcf4c0c6033b532ed513efbd0a282388095525feb
1 /* Test that __builtin_prefetch does no harm.
3 Use addresses that are unlikely to be word-aligned. Some targets
4 have alignment requirements for prefetch addresses, so make sure the
5 compiler takes care of that. This fails if it aborts, anything else
6 is OK. */
8 void exit (int);
10 struct S {
11 short a;
12 short b;
13 char c[8];
14 } s;
16 char arr[100];
17 char *ptr = arr;
18 int idx = 3;
20 void
21 arg_ptr (char *p)
23 __builtin_prefetch (p, 0, 0);
26 void
27 arg_idx (char *p, int i)
29 __builtin_prefetch (&p[i], 0, 0);
32 void
33 glob_ptr (void)
35 __builtin_prefetch (ptr, 0, 0);
38 void
39 glob_idx (void)
41 __builtin_prefetch (&ptr[idx], 0, 0);
44 int
45 main ()
47 __builtin_prefetch (&s.b, 0, 0);
48 __builtin_prefetch (&s.c[1], 0, 0);
50 arg_ptr (&s.c[1]);
51 arg_ptr (ptr+3);
52 arg_idx (ptr, 3);
53 arg_idx (ptr+1, 2);
54 idx = 3;
55 glob_ptr ();
56 glob_idx ();
57 ptr++;
58 idx = 2;
59 glob_ptr ();
60 glob_idx ();
61 exit (0);