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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 /* This compiles to prefetchnta on x86. */ | 45 /* This compiles to prefetchnta on x86. */ |
46 __builtin_prefetch(&g_dest, /* rw= */ 0, /* locality= */ 0); | 46 __builtin_prefetch(&g_dest, /* rw= */ 0, /* locality= */ 0); |
47 | 47 |
48 /* Test movntq. */ | 48 /* Test movntq. */ |
49 reset_test_vars(); | 49 reset_test_vars(); |
50 asm("movq g_src" MEM_SUFFIX ", %%mm0\n" | 50 asm("movq g_src" MEM_SUFFIX ", %%mm0\n" |
51 "movntq %%mm0, g_dest" MEM_SUFFIX "\n" : : : "mm0"); | 51 "movntq %%mm0, g_dest" MEM_SUFFIX "\n" : : : "mm0"); |
52 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); | 52 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); |
53 | 53 |
54 #if defined(__x86_64__) | |
55 /* Test movntps. */ | 54 /* Test movntps. */ |
56 reset_test_vars(); | 55 reset_test_vars(); |
57 asm("movdqa g_src(%%r15), %%xmm0\n" | 56 asm("movdqa g_src" MEM_SUFFIX ", %%xmm0\n" |
58 "movntps %%xmm0, g_dest(%%r15)\n" : : : "xmm0"); | 57 "movntps %%xmm0, g_dest" MEM_SUFFIX "\n" : : : "xmm0"); |
59 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); | 58 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); |
60 | 59 |
| 60 #if defined(__x86_64__) |
61 /* Test movnti, using 32-bit operand. */ | 61 /* Test movnti, using 32-bit operand. */ |
62 reset_test_vars(); | 62 reset_test_vars(); |
63 asm("mov g_src(%%r15), %%eax\n" | 63 asm("mov g_src(%%r15), %%eax\n" |
64 "movnti %%eax, g_dest(%%r15)\n" : : : "eax"); | 64 "movnti %%eax, g_dest(%%r15)\n" : : : "eax"); |
65 ASSERT_EQ(memcmp(g_dest, g_src, 4), 0); | 65 ASSERT_EQ(memcmp(g_dest, g_src, 4), 0); |
66 | 66 |
67 /* Test movnti, using 64-bit operand. */ | 67 /* Test movnti, using 64-bit operand. */ |
68 reset_test_vars(); | 68 reset_test_vars(); |
69 asm("mov g_src(%%r15), %%rax\n" | 69 asm("mov g_src(%%r15), %%rax\n" |
70 "movnti %%rax, g_dest(%%r15)\n" : : : "rax"); | 70 "movnti %%rax, g_dest(%%r15)\n" : : : "rax"); |
(...skipping 15 matching lines...) Expand all Loading... |
86 asm("mov g_src(%%r15), %%rax\n" | 86 asm("mov g_src(%%r15), %%rax\n" |
87 "movnti %%rax, g_dest(%%rip)\n" : : : "rax"); | 87 "movnti %%rax, g_dest(%%rip)\n" : : : "rax"); |
88 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); | 88 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); |
89 | 89 |
90 /* Test prefetchnta using RIP-relative addressing. */ | 90 /* Test prefetchnta using RIP-relative addressing. */ |
91 asm("prefetchnta g_dest(%rip)\n"); | 91 asm("prefetchnta g_dest(%rip)\n"); |
92 #endif | 92 #endif |
93 | 93 |
94 return 0; | 94 return 0; |
95 } | 95 } |
OLD | NEW |