2 * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
8 * This tests that the compiler handles __builtin_prefetch.
9 * All we're testing is that the compiler doesn't fall over
10 * and that it doesn't produce code that goes bad. We don't
11 * try to test that it actually emits prefetch instructions.
12 * (As of 2014-6-18, arm-nacl-gcc and x86_64-nacl-gcc -m64 do
13 * but x86_64-nacl-gcc -m32 and all pnacl compilers do not.)
14 * This is a regression test for:
15 * https://code.google.com/p/nativeclient/issues/detail?id=3582
18 static void DoPrefetch(char *p) {
19 __builtin_prefetch(p);
20 __builtin_prefetch(p + 17);
23 static char g_buf[32];
28 DoPrefetch(l_buf); /* Stack case: shouldn't require sandboxing. */
29 DoPrefetch(g_buf); /* Heap case: should require sandboxing. */