1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #include <stdio.h>
9 #include <stdint.h>
10 alignas(16) uint8_t buf[32];
11 // This uses inline assembly to generate an instruction that writes to a large
12 // block of memory. If it fails on your compiler/architecture, please add
13 // appropriate code to generate a large write to "buf". If you cannot write at
14 // least 2*sizeof(void*) bytes with a single instruction, you will have to skip
15 // this test.
16 
17 int main() {
18 #if defined(__i386__) || defined(__x86_64__)
19   asm volatile ("movdqa %%xmm0, %0" : : "m"(buf));
20 #elif defined(__arm__)
21   asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf));
22 #elif defined(__aarch64__)
23   asm volatile ("stp x0, x1, %0" : : "m"(buf));
24 #elif defined(__mips__)
25   asm volatile ("lw $2, %0" : : "m"(buf));
26 #endif
27   return 0;
28 }
29