1 #include <cstdint>
2 
3 struct alignas(64) zmm_t {
4   uint64_t a, b, c, d, e, f, g, h;
5 };
6 
main()7 int main() {
8   constexpr zmm_t zmm[] = {
9     { 0x0706050403020100, 0x0F0E0D0C0B0A0908,
10       0x1716151413121110, 0x1F1E1D1C1B1A1918,
11       0x2726252423222120, 0x2F2E2D2C2B2A2928,
12       0x3736353433323130, 0x3F3E3D3C3B3A3938, },
13     { 0x0807060504030201, 0x100F0E0D0C0B0A09,
14       0x1817161514131211, 0x201F1E1D1C1B1A19,
15       0x2827262524232221, 0x302F2E2D2C2B2A29,
16       0x3837363534333231, 0x403F3E3D3C3B3A39, },
17     { 0x0908070605040302, 0x11100F0E0D0C0B0A,
18       0x1918171615141312, 0x21201F1E1D1C1B1A,
19       0x2928272625242322, 0x31302F2E2D2C2B2A,
20       0x3938373635343332, 0x41403F3E3D3C3B3A, },
21     { 0x0A09080706050403, 0x1211100F0E0D0C0B,
22       0x1A19181716151413, 0x2221201F1E1D1C1B,
23       0x2A29282726252423, 0x3231302F2E2D2C2B,
24       0x3A39383736353433, 0x4241403F3E3D3C3B, },
25     { 0x0B0A090807060504, 0x131211100F0E0D0C,
26       0x1B1A191817161514, 0x232221201F1E1D1C,
27       0x2B2A292827262524, 0x333231302F2E2D2C,
28       0x3B3A393837363534, 0x434241403F3E3D3C, },
29     { 0x0C0B0A0908070605, 0x14131211100F0E0D,
30       0x1C1B1A1918171615, 0x24232221201F1E1D,
31       0x2C2B2A2928272625, 0x34333231302F2E2D,
32       0x3C3B3A3938373635, 0x44434241403F3E3D, },
33     { 0x0D0C0B0A09080706, 0x1514131211100F0E,
34       0x1D1C1B1A19181716, 0x2524232221201F1E,
35       0x2D2C2B2A29282726, 0x3534333231302F2E,
36       0x3D3C3B3A39383736, 0x4544434241403F3E, },
37     { 0x0E0D0C0B0A090807, 0x161514131211100F,
38       0x1E1D1C1B1A191817, 0x262524232221201F,
39       0x2E2D2C2B2A292827, 0x363534333231302F,
40       0x3E3D3C3B3A393837, 0x464544434241403F, },
41 #if defined(__x86_64__) || defined(_M_X64)
42     { 0x0F0E0D0C0B0A0908, 0x1716151413121110,
43       0x1F1E1D1C1B1A1918, 0x2726252423222120,
44       0x2F2E2D2C2B2A2928, 0x3736353433323130,
45       0x3F3E3D3C3B3A3938, 0x4746454443424140, },
46     { 0x100F0E0D0C0B0A09, 0x1817161514131211,
47       0x201F1E1D1C1B1A19, 0x2827262524232221,
48       0x302F2E2D2C2B2A29, 0x3837363534333231,
49       0x403F3E3D3C3B3A39, 0x4847464544434241, },
50     { 0x11100F0E0D0C0B0A, 0x1918171615141312,
51       0x21201F1E1D1C1B1A, 0x2928272625242322,
52       0x31302F2E2D2C2B2A, 0x3938373635343332,
53       0x41403F3E3D3C3B3A, 0x4948474645444342, },
54     { 0x1211100F0E0D0C0B, 0x1A19181716151413,
55       0x2221201F1E1D1C1B, 0x2A29282726252423,
56       0x3231302F2E2D2C2B, 0x3A39383736353433,
57       0x4241403F3E3D3C3B, 0x4A49484746454443, },
58     { 0x131211100F0E0D0C, 0x1B1A191817161514,
59       0x232221201F1E1D1C, 0x2B2A292827262524,
60       0x333231302F2E2D2C, 0x3B3A393837363534,
61       0x434241403F3E3D3C, 0x4B4A494847464544, },
62     { 0x14131211100F0E0D, 0x1C1B1A1918171615,
63       0x24232221201F1E1D, 0x2C2B2A2928272625,
64       0x34333231302F2E2D, 0x3C3B3A3938373635,
65       0x44434241403F3E3D, 0x4C4B4A4948474645, },
66     { 0x1514131211100F0E, 0x1D1C1B1A19181716,
67       0x2524232221201F1E, 0x2D2C2B2A29282726,
68       0x3534333231302F2E, 0x3D3C3B3A39383736,
69       0x4544434241403F3E, 0x4D4C4B4A49484746, },
70     { 0x161514131211100F, 0x1E1D1C1B1A191817,
71       0x262524232221201F, 0x2E2D2C2B2A292827,
72       0x363534333231302F, 0x3E3D3C3B3A393837,
73       0x464544434241403F, 0x4E4D4C4B4A494847, },
74     { 0x1716151413121110, 0x1F1E1D1C1B1A1918,
75       0x2726252423222120, 0x2F2E2D2C2B2A2928,
76       0x3736353433323130, 0x3F3E3D3C3B3A3938,
77       0x4746454443424140, 0x4F4E4D4C4B4A4948, },
78     { 0x1817161514131211, 0x201F1E1D1C1B1A19,
79       0x2827262524232221, 0x302F2E2D2C2B2A29,
80       0x3837363534333231, 0x403F3E3D3C3B3A39,
81       0x4847464544434241, 0x504F4E4D4C4B4A49, },
82     { 0x1918171615141312, 0x21201F1E1D1C1B1A,
83       0x2928272625242322, 0x31302F2E2D2C2B2A,
84       0x3938373635343332, 0x41403F3E3D3C3B3A,
85       0x4948474645444342, 0x51504F4E4D4C4B4A, },
86     { 0x1A19181716151413, 0x2221201F1E1D1C1B,
87       0x2A29282726252423, 0x3231302F2E2D2C2B,
88       0x3A39383736353433, 0x4241403F3E3D3C3B,
89       0x4A49484746454443, 0x5251504F4E4D4C4B, },
90     { 0x1B1A191817161514, 0x232221201F1E1D1C,
91       0x2B2A292827262524, 0x333231302F2E2D2C,
92       0x3B3A393837363534, 0x434241403F3E3D3C,
93       0x4B4A494847464544, 0x535251504F4E4D4C, },
94     { 0x1C1B1A1918171615, 0x24232221201F1E1D,
95       0x2C2B2A2928272625, 0x34333231302F2E2D,
96       0x3C3B3A3938373635, 0x44434241403F3E3D,
97       0x4C4B4A4948474645, 0x54535251504F4E4D, },
98     { 0x1D1C1B1A19181716, 0x2524232221201F1E,
99       0x2D2C2B2A29282726, 0x3534333231302F2E,
100       0x3D3C3B3A39383736, 0x4544434241403F3E,
101       0x4D4C4B4A49484746, 0x5554535251504F4E, },
102     { 0x1E1D1C1B1A191817, 0x262524232221201F,
103       0x2E2D2C2B2A292827, 0x363534333231302F,
104       0x3E3D3C3B3A393837, 0x464544434241403F,
105       0x4E4D4C4B4A494847, 0x565554535251504F, },
106     { 0x1F1E1D1C1B1A1918, 0x2726252423222120,
107       0x2F2E2D2C2B2A2928, 0x3736353433323130,
108       0x3F3E3D3C3B3A3938, 0x4746454443424140,
109       0x4F4E4D4C4B4A4948, 0x5756555453525150, },
110     { 0x201F1E1D1C1B1A19, 0x2827262524232221,
111       0x302F2E2D2C2B2A29, 0x3837363534333231,
112       0x403F3E3D3C3B3A39, 0x4847464544434241,
113       0x504F4E4D4C4B4A49, 0x5857565554535251, },
114     { 0x21201F1E1D1C1B1A, 0x2928272625242322,
115       0x31302F2E2D2C2B2A, 0x3938373635343332,
116       0x41403F3E3D3C3B3A, 0x4948474645444342,
117       0x51504F4E4D4C4B4A, 0x5958575655545352, },
118     { 0x2221201F1E1D1C1B, 0x2A29282726252423,
119       0x3231302F2E2D2C2B, 0x3A39383736353433,
120       0x4241403F3E3D3C3B, 0x4A49484746454443,
121       0x5251504F4E4D4C4B, 0x5A59585756555453, },
122     { 0x232221201F1E1D1C, 0x2B2A292827262524,
123       0x333231302F2E2D2C, 0x3B3A393837363534,
124       0x434241403F3E3D3C, 0x4B4A494847464544,
125       0x535251504F4E4D4C, 0x5B5A595857565554, },
126     { 0x24232221201F1E1D, 0x2C2B2A2928272625,
127       0x34333231302F2E2D, 0x3C3B3A3938373635,
128       0x44434241403F3E3D, 0x4C4B4A4948474645,
129       0x54535251504F4E4D, 0x5C5B5A5958575655, },
130     { 0x2524232221201F1E, 0x2D2C2B2A29282726,
131       0x3534333231302F2E, 0x3D3C3B3A39383736,
132       0x4544434241403F3E, 0x4D4C4B4A49484746,
133       0x5554535251504F4E, 0x5D5C5B5A59585756, },
134     { 0x262524232221201F, 0x2E2D2C2B2A292827,
135       0x363534333231302F, 0x3E3D3C3B3A393837,
136       0x464544434241403F, 0x4E4D4C4B4A494847,
137       0x565554535251504F, 0x5E5D5C5B5A595857, },
138 #endif
139   };
140 
141   asm volatile(
142     "vmovaps  0x000(%0), %%zmm0\n\t"
143     "vmovaps  0x040(%0), %%zmm1\n\t"
144     "vmovaps  0x080(%0), %%zmm2\n\t"
145     "vmovaps  0x0C0(%0), %%zmm3\n\t"
146     "vmovaps  0x100(%0), %%zmm4\n\t"
147     "vmovaps  0x140(%0), %%zmm5\n\t"
148     "vmovaps  0x180(%0), %%zmm6\n\t"
149     "vmovaps  0x1C0(%0), %%zmm7\n\t"
150 #if defined(__x86_64__) || defined(_M_X64)
151     "vmovaps  0x200(%0), %%zmm8\n\t"
152     "vmovaps  0x240(%0), %%zmm9\n\t"
153     "vmovaps  0x280(%0), %%zmm10\n\t"
154     "vmovaps  0x2C0(%0), %%zmm11\n\t"
155     "vmovaps  0x300(%0), %%zmm12\n\t"
156     "vmovaps  0x340(%0), %%zmm13\n\t"
157     "vmovaps  0x380(%0), %%zmm14\n\t"
158     "vmovaps  0x3C0(%0), %%zmm15\n\t"
159     "vmovaps  0x400(%0), %%zmm16\n\t"
160     "vmovaps  0x440(%0), %%zmm17\n\t"
161     "vmovaps  0x480(%0), %%zmm18\n\t"
162     "vmovaps  0x4C0(%0), %%zmm19\n\t"
163     "vmovaps  0x500(%0), %%zmm20\n\t"
164     "vmovaps  0x540(%0), %%zmm21\n\t"
165     "vmovaps  0x580(%0), %%zmm22\n\t"
166     "vmovaps  0x5C0(%0), %%zmm23\n\t"
167     "vmovaps  0x600(%0), %%zmm24\n\t"
168     "vmovaps  0x640(%0), %%zmm25\n\t"
169     "vmovaps  0x680(%0), %%zmm26\n\t"
170     "vmovaps  0x6C0(%0), %%zmm27\n\t"
171     "vmovaps  0x700(%0), %%zmm28\n\t"
172     "vmovaps  0x740(%0), %%zmm29\n\t"
173     "vmovaps  0x780(%0), %%zmm30\n\t"
174     "vmovaps  0x7C0(%0), %%zmm31\n\t"
175 #endif
176     "\n\t"
177     "int3\n\t"
178     :
179     : "b"(zmm)
180     : "%zmm0", "%zmm1", "%zmm2", "%zmm3", "%zmm4", "%zmm5", "%zmm6", "%zmm7"
181 #if defined(__x86_64__) || defined(_M_X64)
182     , "%zmm8", "%zmm9", "%zmm10", "%zmm11", "%zmm12", "%zmm13", "%zmm14",
183       "%zmm15", "%zmm16", "%zmm17", "%zmm18", "%zmm19", "%zmm20", "%zmm21",
184       "%zmm22", "%zmm23", "%zmm24", "%zmm25", "%zmm26", "%zmm27", "%zmm28",
185       "%zmm29", "%zmm30", "%zmm31"
186 #endif
187   );
188 
189   return 0;
190 }
191