| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The Native Client Authors. All rights reserved. | 2 * Copyright 2016 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "native_client/src/include/nacl_assert.h" | 9 #include "native_client/src/include/nacl_assert.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 asm("movdqa g_src " MEM_SUFFIX ", %%xmm0\n" | 33 asm("movdqa g_src " MEM_SUFFIX ", %%xmm0\n" |
| 34 "movntdq %%xmm0, g_dest " MEM_SUFFIX "\n" : : : "xmm0"); | 34 "movntdq %%xmm0, g_dest " MEM_SUFFIX "\n" : : : "xmm0"); |
| 35 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); | 35 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); |
| 36 | 36 |
| 37 /* Test prefetchnta. This has no side effects that we can test for. */ | 37 /* Test prefetchnta. This has no side effects that we can test for. */ |
| 38 asm("prefetchnta g_dest " MEM_SUFFIX "\n" :); | 38 asm("prefetchnta g_dest " MEM_SUFFIX "\n" :); |
| 39 | 39 |
| 40 /* This compiles to prefetchnta on x86. */ | 40 /* This compiles to prefetchnta on x86. */ |
| 41 __builtin_prefetch(&g_dest, /* rw= */ 0, /* locality= */ 0); | 41 __builtin_prefetch(&g_dest, /* rw= */ 0, /* locality= */ 0); |
| 42 | 42 |
| 43 #if defined(__i386__) | |
| 44 /* Test movntq. */ | 43 /* Test movntq. */ |
| 45 reset_test_vars(); | 44 reset_test_vars(); |
| 46 asm("movq g_src, %%mm0\n" | 45 asm("movq g_src" MEM_SUFFIX ", %%mm0\n" |
| 47 "movntq %%mm0, g_dest\n" : : : "mm0"); | 46 "movntq %%mm0, g_dest" MEM_SUFFIX "\n" : : : "mm0"); |
| 48 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); | 47 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); |
| 49 #endif | |
| 50 | 48 |
| 51 #if defined(__x86_64__) | 49 #if defined(__x86_64__) |
| 52 /* Test movntps. */ | 50 /* Test movntps. */ |
| 53 reset_test_vars(); | 51 reset_test_vars(); |
| 54 asm("movdqa g_src(%%r15), %%xmm0\n" | 52 asm("movdqa g_src(%%r15), %%xmm0\n" |
| 55 "movntps %%xmm0, g_dest(%%r15)\n" : : : "xmm0"); | 53 "movntps %%xmm0, g_dest(%%r15)\n" : : : "xmm0"); |
| 56 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); | 54 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); |
| 57 | 55 |
| 58 /* Test movnti, using 32-bit operand. */ | 56 /* Test movnti, using 32-bit operand. */ |
| 59 reset_test_vars(); | 57 reset_test_vars(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 83 asm("mov g_src(%%r15), %%rax\n" | 81 asm("mov g_src(%%r15), %%rax\n" |
| 84 "movnti %%rax, g_dest(%%rip)\n" : : : "rax"); | 82 "movnti %%rax, g_dest(%%rip)\n" : : : "rax"); |
| 85 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); | 83 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); |
| 86 | 84 |
| 87 /* Test prefetchnta using RIP-relative addressing. */ | 85 /* Test prefetchnta using RIP-relative addressing. */ |
| 88 asm("prefetchnta g_dest(%rip)\n"); | 86 asm("prefetchnta g_dest(%rip)\n"); |
| 89 #endif | 87 #endif |
| 90 | 88 |
| 91 return 0; | 89 return 0; |
| 92 } | 90 } |
| OLD | NEW |