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 28 matching lines...) Expand all Loading... |
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 /* Test movntq. */ | 43 /* Test movntq. */ |
44 reset_test_vars(); | 44 reset_test_vars(); |
45 asm("movq g_src" MEM_SUFFIX ", %%mm0\n" | 45 asm("movq g_src" MEM_SUFFIX ", %%mm0\n" |
46 "movntq %%mm0, g_dest" MEM_SUFFIX "\n" : : : "mm0"); | 46 "movntq %%mm0, g_dest" MEM_SUFFIX "\n" : : : "mm0"); |
47 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); | 47 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); |
48 | 48 |
49 #if defined(__x86_64__) | |
50 /* Test movntps. */ | 49 /* Test movntps. */ |
51 reset_test_vars(); | 50 reset_test_vars(); |
52 asm("movdqa g_src(%%r15), %%xmm0\n" | 51 asm("movdqa g_src" MEM_SUFFIX ", %%xmm0\n" |
53 "movntps %%xmm0, g_dest(%%r15)\n" : : : "xmm0"); | 52 "movntps %%xmm0, g_dest" MEM_SUFFIX "\n" : : : "xmm0"); |
54 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); | 53 ASSERT_EQ(memcmp(g_dest, g_src, 16), 0); |
55 | 54 |
| 55 #if defined(__x86_64__) |
56 /* Test movnti, using 32-bit operand. */ | 56 /* Test movnti, using 32-bit operand. */ |
57 reset_test_vars(); | 57 reset_test_vars(); |
58 asm("mov g_src(%%r15), %%eax\n" | 58 asm("mov g_src(%%r15), %%eax\n" |
59 "movnti %%eax, g_dest(%%r15)\n" : : : "eax"); | 59 "movnti %%eax, g_dest(%%r15)\n" : : : "eax"); |
60 ASSERT_EQ(memcmp(g_dest, g_src, 4), 0); | 60 ASSERT_EQ(memcmp(g_dest, g_src, 4), 0); |
61 | 61 |
62 /* Test movnti, using 64-bit operand. */ | 62 /* Test movnti, using 64-bit operand. */ |
63 reset_test_vars(); | 63 reset_test_vars(); |
64 asm("mov g_src(%%r15), %%rax\n" | 64 asm("mov g_src(%%r15), %%rax\n" |
65 "movnti %%rax, g_dest(%%r15)\n" : : : "rax"); | 65 "movnti %%rax, g_dest(%%r15)\n" : : : "rax"); |
(...skipping 15 matching lines...) Expand all Loading... |
81 asm("mov g_src(%%r15), %%rax\n" | 81 asm("mov g_src(%%r15), %%rax\n" |
82 "movnti %%rax, g_dest(%%rip)\n" : : : "rax"); | 82 "movnti %%rax, g_dest(%%rip)\n" : : : "rax"); |
83 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); | 83 ASSERT_EQ(memcmp(g_dest, g_src, 8), 0); |
84 | 84 |
85 /* Test prefetchnta using RIP-relative addressing. */ | 85 /* Test prefetchnta using RIP-relative addressing. */ |
86 asm("prefetchnta g_dest(%rip)\n"); | 86 asm("prefetchnta g_dest(%rip)\n"); |
87 #endif | 87 #endif |
88 | 88 |
89 return 0; | 89 return 0; |
90 } | 90 } |
OLD | NEW |