1 #include <cinttypes> 2 #include <cstdint> 3 #include <cstdio> 4 5 union alignas(32) ymm_t { 6 uint64_t as_uint64[4]; 7 uint8_t as_uint8[32]; 8 }; 9 10 int main() { 11 constexpr ymm_t ymm_fill = { 12 .as_uint64 = { 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F, 13 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F } 14 }; 15 16 ymm_t ymm[16]; 17 18 asm volatile( 19 "vmovaps %1, %%ymm0\n\t" 20 "vmovaps %1, %%ymm1\n\t" 21 "vmovaps %1, %%ymm2\n\t" 22 "vmovaps %1, %%ymm3\n\t" 23 "vmovaps %1, %%ymm4\n\t" 24 "vmovaps %1, %%ymm5\n\t" 25 "vmovaps %1, %%ymm6\n\t" 26 "vmovaps %1, %%ymm7\n\t" 27 #if defined(__x86_64__) || defined(_M_X64) 28 "vmovaps %1, %%ymm8\n\t" 29 "vmovaps %1, %%ymm9\n\t" 30 "vmovaps %1, %%ymm10\n\t" 31 "vmovaps %1, %%ymm11\n\t" 32 "vmovaps %1, %%ymm12\n\t" 33 "vmovaps %1, %%ymm13\n\t" 34 "vmovaps %1, %%ymm14\n\t" 35 "vmovaps %1, %%ymm15\n\t" 36 #endif 37 "\n\t" 38 "int3\n\t" 39 "\n\t" 40 "vmovaps %%ymm0, 0x000(%0)\n\t" 41 "vmovaps %%ymm1, 0x020(%0)\n\t" 42 "vmovaps %%ymm2, 0x040(%0)\n\t" 43 "vmovaps %%ymm3, 0x060(%0)\n\t" 44 "vmovaps %%ymm4, 0x080(%0)\n\t" 45 "vmovaps %%ymm5, 0x0A0(%0)\n\t" 46 "vmovaps %%ymm6, 0x0C0(%0)\n\t" 47 "vmovaps %%ymm7, 0x0E0(%0)\n\t" 48 #if defined(__x86_64__) || defined(_M_X64) 49 "vmovaps %%ymm8, 0x100(%0)\n\t" 50 "vmovaps %%ymm9, 0x120(%0)\n\t" 51 "vmovaps %%ymm10, 0x140(%0)\n\t" 52 "vmovaps %%ymm11, 0x160(%0)\n\t" 53 "vmovaps %%ymm12, 0x180(%0)\n\t" 54 "vmovaps %%ymm13, 0x1A0(%0)\n\t" 55 "vmovaps %%ymm14, 0x1C0(%0)\n\t" 56 "vmovaps %%ymm15, 0x1E0(%0)\n\t" 57 #endif 58 : 59 : "b"(ymm), "m"(ymm_fill) 60 : "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7" 61 #if defined(__x86_64__) || defined(_M_X64) 62 , "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14", 63 "%ymm15" 64 #endif 65 ); 66 67 for (int i = 0; i < 16; ++i) { 68 printf("ymm%d = { ", i); 69 for (int j = 0; j < sizeof(ymm->as_uint8); ++j) 70 printf("0x%02x ", ymm[i].as_uint8[j]); 71 printf("}\n"); 72 } 73 74 return 0; 75 } 76