1//===- X86ReplaceableInstrs.def ----------------------------------*- 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
9// These are the replaceable SSE instructions. Some of these have Int variants
10// that we don't include here. We don't want to replace instructions selected
11// by intrinsics.
12
13#define ENTRY(A, B, C) {X86::A, X86::B, X86::C},
14static const uint16_t ReplaceableInstrs[][3] = {
15// PackedSingle, PackedDouble, PackedInt
16ENTRY(MOVAPSmr, MOVAPDmr, MOVDQAmr)
17ENTRY(MOVAPSrm, MOVAPDrm, MOVDQArm)
18ENTRY(MOVAPSrr, MOVAPDrr, MOVDQArr)
19ENTRY(MOVUPSmr, MOVUPDmr, MOVDQUmr)
20ENTRY(MOVUPSrm, MOVUPDrm, MOVDQUrm)
21ENTRY(MOVLPSmr, MOVLPDmr, MOVPQI2QImr)
22ENTRY(MOVSDmr, MOVSDmr, MOVPQI2QImr)
23ENTRY(MOVSSmr, MOVSSmr, MOVPDI2DImr)
24ENTRY(MOVSDrm, MOVSDrm, MOVQI2PQIrm)
25ENTRY(MOVSDrm_alt, MOVSDrm_alt, MOVQI2PQIrm)
26ENTRY(MOVSSrm, MOVSSrm, MOVDI2PDIrm)
27ENTRY(MOVSSrm_alt, MOVSSrm_alt, MOVDI2PDIrm)
28ENTRY(MOVNTPSmr, MOVNTPDmr, MOVNTDQmr)
29ENTRY(ANDNPSrm, ANDNPDrm, PANDNrm)
30ENTRY(ANDNPSrr, ANDNPDrr, PANDNrr)
31ENTRY(ANDPSrm, ANDPDrm, PANDrm)
32ENTRY(ANDPSrr, ANDPDrr, PANDrr)
33ENTRY(ORPSrm, ORPDrm, PORrm)
34ENTRY(ORPSrr, ORPDrr, PORrr)
35ENTRY(XORPSrm, XORPDrm, PXORrm)
36ENTRY(XORPSrr, XORPDrr, PXORrr)
37ENTRY(UNPCKLPDrm, UNPCKLPDrm, PUNPCKLQDQrm)
38ENTRY(MOVLHPSrr, UNPCKLPDrr, PUNPCKLQDQrr)
39ENTRY(UNPCKHPDrm, UNPCKHPDrm, PUNPCKHQDQrm)
40ENTRY(UNPCKHPDrr, UNPCKHPDrr, PUNPCKHQDQrr)
41ENTRY(UNPCKLPSrm, UNPCKLPSrm, PUNPCKLDQrm)
42ENTRY(UNPCKLPSrr, UNPCKLPSrr, PUNPCKLDQrr)
43ENTRY(UNPCKHPSrm, UNPCKHPSrm, PUNPCKHDQrm)
44ENTRY(UNPCKHPSrr, UNPCKHPSrr, PUNPCKHDQrr)
45ENTRY(EXTRACTPSmr, EXTRACTPSmr, PEXTRDmr)
46ENTRY(EXTRACTPSrr, EXTRACTPSrr, PEXTRDrr)
47// AVX 128-bit support
48ENTRY(VMOVAPSmr, VMOVAPDmr, VMOVDQAmr)
49ENTRY(VMOVAPSrm, VMOVAPDrm, VMOVDQArm)
50ENTRY(VMOVAPSrr, VMOVAPDrr, VMOVDQArr)
51ENTRY(VMOVUPSmr, VMOVUPDmr, VMOVDQUmr)
52ENTRY(VMOVUPSrm, VMOVUPDrm, VMOVDQUrm)
53ENTRY(VMOVLPSmr, VMOVLPDmr, VMOVPQI2QImr)
54ENTRY(VMOVSDmr, VMOVSDmr, VMOVPQI2QImr)
55ENTRY(VMOVSSmr, VMOVSSmr, VMOVPDI2DImr)
56ENTRY(VMOVSDrm, VMOVSDrm, VMOVQI2PQIrm)
57ENTRY(VMOVSDrm_alt, VMOVSDrm_alt, VMOVQI2PQIrm)
58ENTRY(VMOVSSrm, VMOVSSrm, VMOVDI2PDIrm)
59ENTRY(VMOVSSrm_alt, VMOVSSrm_alt, VMOVDI2PDIrm)
60ENTRY(VMOVNTPSmr, VMOVNTPDmr, VMOVNTDQmr)
61ENTRY(VANDNPSrm, VANDNPDrm, VPANDNrm)
62ENTRY(VANDNPSrr, VANDNPDrr, VPANDNrr)
63ENTRY(VANDPSrm, VANDPDrm, VPANDrm)
64ENTRY(VANDPSrr, VANDPDrr, VPANDrr)
65ENTRY(VORPSrm, VORPDrm, VPORrm)
66ENTRY(VORPSrr, VORPDrr, VPORrr)
67ENTRY(VXORPSrm, VXORPDrm, VPXORrm)
68ENTRY(VXORPSrr, VXORPDrr, VPXORrr)
69ENTRY(VUNPCKLPDrm, VUNPCKLPDrm, VPUNPCKLQDQrm)
70ENTRY(VMOVLHPSrr, VUNPCKLPDrr, VPUNPCKLQDQrr)
71ENTRY(VUNPCKHPDrm, VUNPCKHPDrm, VPUNPCKHQDQrm)
72ENTRY(VUNPCKHPDrr, VUNPCKHPDrr, VPUNPCKHQDQrr)
73ENTRY(VUNPCKLPSrm, VUNPCKLPSrm, VPUNPCKLDQrm)
74ENTRY(VUNPCKLPSrr, VUNPCKLPSrr, VPUNPCKLDQrr)
75ENTRY(VUNPCKHPSrm, VUNPCKHPSrm, VPUNPCKHDQrm)
76ENTRY(VUNPCKHPSrr, VUNPCKHPSrr, VPUNPCKHDQrr)
77ENTRY(VEXTRACTPSmr, VEXTRACTPSmr, VPEXTRDmr)
78ENTRY(VEXTRACTPSrr, VEXTRACTPSrr, VPEXTRDrr)
79// AVX 256-bit support
80ENTRY(VMOVAPSYmr, VMOVAPDYmr, VMOVDQAYmr)
81ENTRY(VMOVAPSYrm, VMOVAPDYrm, VMOVDQAYrm)
82ENTRY(VMOVAPSYrr, VMOVAPDYrr, VMOVDQAYrr)
83ENTRY(VMOVUPSYmr, VMOVUPDYmr, VMOVDQUYmr)
84ENTRY(VMOVUPSYrm, VMOVUPDYrm, VMOVDQUYrm)
85ENTRY(VMOVNTPSYmr, VMOVNTPDYmr, VMOVNTDQYmr)
86ENTRY(VPERMPSYrm, VPERMPSYrm, VPERMDYrm)
87ENTRY(VPERMPSYrr, VPERMPSYrr, VPERMDYrr)
88ENTRY(VPERMPDYmi, VPERMPDYmi, VPERMQYmi)
89ENTRY(VPERMPDYri, VPERMPDYri, VPERMQYri)
90// AVX512 support
91ENTRY(VMOVLPSZ128mr, VMOVLPDZ128mr, VMOVPQI2QIZmr)
92ENTRY(VMOVNTPSZ128mr, VMOVNTPDZ128mr, VMOVNTDQZ128mr)
93ENTRY(VMOVNTPSZ256mr, VMOVNTPDZ256mr, VMOVNTDQZ256mr)
94ENTRY(VMOVNTPSZmr, VMOVNTPDZmr, VMOVNTDQZmr)
95ENTRY(VMOVSDZmr, VMOVSDZmr, VMOVPQI2QIZmr)
96ENTRY(VMOVSSZmr, VMOVSSZmr, VMOVPDI2DIZmr)
97ENTRY(VMOVSDZrm, VMOVSDZrm, VMOVQI2PQIZrm)
98ENTRY(VMOVSDZrm_alt, VMOVSDZrm_alt, VMOVQI2PQIZrm)
99ENTRY(VMOVSSZrm, VMOVSSZrm, VMOVDI2PDIZrm)
100ENTRY(VMOVSSZrm_alt, VMOVSSZrm_alt, VMOVDI2PDIZrm)
101ENTRY(VBROADCASTSSZ128rr, VBROADCASTSSZ128rr, VPBROADCASTDZ128rr)
102ENTRY(VBROADCASTSSZ128rm, VBROADCASTSSZ128rm, VPBROADCASTDZ128rm)
103ENTRY(VBROADCASTSSZ256rr, VBROADCASTSSZ256rr, VPBROADCASTDZ256rr)
104ENTRY(VBROADCASTSSZ256rm, VBROADCASTSSZ256rm, VPBROADCASTDZ256rm)
105ENTRY(VBROADCASTSSZrr, VBROADCASTSSZrr, VPBROADCASTDZrr)
106ENTRY(VBROADCASTSSZrm, VBROADCASTSSZrm, VPBROADCASTDZrm)
107ENTRY(VMOVDDUPZ128rr, VMOVDDUPZ128rr, VPBROADCASTQZ128rr)
108ENTRY(VMOVDDUPZ128rm, VMOVDDUPZ128rm, VPBROADCASTQZ128rm)
109ENTRY(VBROADCASTSDZ256rr, VBROADCASTSDZ256rr, VPBROADCASTQZ256rr)
110ENTRY(VBROADCASTSDZ256rm, VBROADCASTSDZ256rm, VPBROADCASTQZ256rm)
111ENTRY(VBROADCASTSDZrr, VBROADCASTSDZrr, VPBROADCASTQZrr)
112ENTRY(VBROADCASTSDZrm, VBROADCASTSDZrm, VPBROADCASTQZrm)
113ENTRY(VINSERTF32x4Zrr, VINSERTF32x4Zrr, VINSERTI32x4Zrr)
114ENTRY(VINSERTF32x4Zrm, VINSERTF32x4Zrm, VINSERTI32x4Zrm)
115ENTRY(VINSERTF32x8Zrr, VINSERTF32x8Zrr, VINSERTI32x8Zrr)
116ENTRY(VINSERTF32x8Zrm, VINSERTF32x8Zrm, VINSERTI32x8Zrm)
117ENTRY(VINSERTF64x2Zrr, VINSERTF64x2Zrr, VINSERTI64x2Zrr)
118ENTRY(VINSERTF64x2Zrm, VINSERTF64x2Zrm, VINSERTI64x2Zrm)
119ENTRY(VINSERTF64x4Zrr, VINSERTF64x4Zrr, VINSERTI64x4Zrr)
120ENTRY(VINSERTF64x4Zrm, VINSERTF64x4Zrm, VINSERTI64x4Zrm)
121ENTRY(VINSERTF32x4Z256rr, VINSERTF32x4Z256rr, VINSERTI32x4Z256rr)
122ENTRY(VINSERTF32x4Z256rm, VINSERTF32x4Z256rm, VINSERTI32x4Z256rm)
123ENTRY(VINSERTF64x2Z256rr, VINSERTF64x2Z256rr, VINSERTI64x2Z256rr)
124ENTRY(VINSERTF64x2Z256rm, VINSERTF64x2Z256rm, VINSERTI64x2Z256rm)
125ENTRY(VEXTRACTF32x4Zrr, VEXTRACTF32x4Zrr, VEXTRACTI32x4Zrr)
126ENTRY(VEXTRACTF32x4Zmr, VEXTRACTF32x4Zmr, VEXTRACTI32x4Zmr)
127ENTRY(VEXTRACTF32x8Zrr, VEXTRACTF32x8Zrr, VEXTRACTI32x8Zrr)
128ENTRY(VEXTRACTF32x8Zmr, VEXTRACTF32x8Zmr, VEXTRACTI32x8Zmr)
129ENTRY(VEXTRACTF64x2Zrr, VEXTRACTF64x2Zrr, VEXTRACTI64x2Zrr)
130ENTRY(VEXTRACTF64x2Zmr, VEXTRACTF64x2Zmr, VEXTRACTI64x2Zmr)
131ENTRY(VEXTRACTF64x4Zrr, VEXTRACTF64x4Zrr, VEXTRACTI64x4Zrr)
132ENTRY(VEXTRACTF64x4Zmr, VEXTRACTF64x4Zmr, VEXTRACTI64x4Zmr)
133ENTRY(VEXTRACTF32x4Z256rr, VEXTRACTF32x4Z256rr, VEXTRACTI32x4Z256rr)
134ENTRY(VEXTRACTF32x4Z256mr, VEXTRACTF32x4Z256mr, VEXTRACTI32x4Z256mr)
135ENTRY(VEXTRACTF64x2Z256rr, VEXTRACTF64x2Z256rr, VEXTRACTI64x2Z256rr)
136ENTRY(VEXTRACTF64x2Z256mr, VEXTRACTF64x2Z256mr, VEXTRACTI64x2Z256mr)
137ENTRY(VPERMILPSmi, VPERMILPSmi, VPSHUFDmi)
138ENTRY(VPERMILPSri, VPERMILPSri, VPSHUFDri)
139ENTRY(VPERMILPSZ128mi, VPERMILPSZ128mi, VPSHUFDZ128mi)
140ENTRY(VPERMILPSZ128ri, VPERMILPSZ128ri, VPSHUFDZ128ri)
141ENTRY(VPERMILPSZ256mi, VPERMILPSZ256mi, VPSHUFDZ256mi)
142ENTRY(VPERMILPSZ256ri, VPERMILPSZ256ri, VPSHUFDZ256ri)
143ENTRY(VPERMILPSZmi, VPERMILPSZmi, VPSHUFDZmi)
144ENTRY(VPERMILPSZri, VPERMILPSZri, VPSHUFDZri)
145ENTRY(VPERMPSZ256rm, VPERMPSZ256rm, VPERMDZ256rm)
146ENTRY(VPERMPSZ256rr, VPERMPSZ256rr, VPERMDZ256rr)
147ENTRY(VPERMPDZ256mi, VPERMPDZ256mi, VPERMQZ256mi)
148ENTRY(VPERMPDZ256ri, VPERMPDZ256ri, VPERMQZ256ri)
149ENTRY(VPERMPDZ256rm, VPERMPDZ256rm, VPERMQZ256rm)
150ENTRY(VPERMPDZ256rr, VPERMPDZ256rr, VPERMQZ256rr)
151ENTRY(VPERMPSZrm, VPERMPSZrm, VPERMDZrm)
152ENTRY(VPERMPSZrr, VPERMPSZrr, VPERMDZrr)
153ENTRY(VPERMPDZmi, VPERMPDZmi, VPERMQZmi)
154ENTRY(VPERMPDZri, VPERMPDZri, VPERMQZri)
155ENTRY(VPERMPDZrm, VPERMPDZrm, VPERMQZrm)
156ENTRY(VPERMPDZrr, VPERMPDZrr, VPERMQZrr)
157ENTRY(VUNPCKLPDZ256rm, VUNPCKLPDZ256rm, VPUNPCKLQDQZ256rm)
158ENTRY(VUNPCKLPDZ256rr, VUNPCKLPDZ256rr, VPUNPCKLQDQZ256rr)
159ENTRY(VUNPCKHPDZ256rm, VUNPCKHPDZ256rm, VPUNPCKHQDQZ256rm)
160ENTRY(VUNPCKHPDZ256rr, VUNPCKHPDZ256rr, VPUNPCKHQDQZ256rr)
161ENTRY(VUNPCKLPSZ256rm, VUNPCKLPSZ256rm, VPUNPCKLDQZ256rm)
162ENTRY(VUNPCKLPSZ256rr, VUNPCKLPSZ256rr, VPUNPCKLDQZ256rr)
163ENTRY(VUNPCKHPSZ256rm, VUNPCKHPSZ256rm, VPUNPCKHDQZ256rm)
164ENTRY(VUNPCKHPSZ256rr, VUNPCKHPSZ256rr, VPUNPCKHDQZ256rr)
165ENTRY(VUNPCKLPDZ128rm, VUNPCKLPDZ128rm, VPUNPCKLQDQZ128rm)
166ENTRY(VMOVLHPSZrr, VUNPCKLPDZ128rr, VPUNPCKLQDQZ128rr)
167ENTRY(VUNPCKHPDZ128rm, VUNPCKHPDZ128rm, VPUNPCKHQDQZ128rm)
168ENTRY(VUNPCKHPDZ128rr, VUNPCKHPDZ128rr, VPUNPCKHQDQZ128rr)
169ENTRY(VUNPCKLPSZ128rm, VUNPCKLPSZ128rm, VPUNPCKLDQZ128rm)
170ENTRY(VUNPCKLPSZ128rr, VUNPCKLPSZ128rr, VPUNPCKLDQZ128rr)
171ENTRY(VUNPCKHPSZ128rm, VUNPCKHPSZ128rm, VPUNPCKHDQZ128rm)
172ENTRY(VUNPCKHPSZ128rr, VUNPCKHPSZ128rr, VPUNPCKHDQZ128rr)
173ENTRY(VUNPCKLPDZrm, VUNPCKLPDZrm, VPUNPCKLQDQZrm)
174ENTRY(VUNPCKLPDZrr, VUNPCKLPDZrr, VPUNPCKLQDQZrr)
175ENTRY(VUNPCKHPDZrm, VUNPCKHPDZrm, VPUNPCKHQDQZrm)
176ENTRY(VUNPCKHPDZrr, VUNPCKHPDZrr, VPUNPCKHQDQZrr)
177ENTRY(VUNPCKLPSZrm, VUNPCKLPSZrm, VPUNPCKLDQZrm)
178ENTRY(VUNPCKLPSZrr, VUNPCKLPSZrr, VPUNPCKLDQZrr)
179ENTRY(VUNPCKHPSZrm, VUNPCKHPSZrm, VPUNPCKHDQZrm)
180ENTRY(VUNPCKHPSZrr, VUNPCKHPSZrr, VPUNPCKHDQZrr)
181ENTRY(VEXTRACTPSZmr, VEXTRACTPSZmr, VPEXTRDZmr)
182ENTRY(VEXTRACTPSZrr, VEXTRACTPSZrr, VPEXTRDZrr)
183};
184
185static const uint16_t ReplaceableInstrsAVX2[][3] = {
186// PackedSingle, PackedDouble, PackedInt
187ENTRY(VANDNPSYrm, VANDNPDYrm, VPANDNYrm)
188ENTRY(VANDNPSYrr, VANDNPDYrr, VPANDNYrr)
189ENTRY(VANDPSYrm, VANDPDYrm, VPANDYrm)
190ENTRY(VANDPSYrr, VANDPDYrr, VPANDYrr)
191ENTRY(VORPSYrm, VORPDYrm, VPORYrm)
192ENTRY(VORPSYrr, VORPDYrr, VPORYrr)
193ENTRY(VXORPSYrm, VXORPDYrm, VPXORYrm)
194ENTRY(VXORPSYrr, VXORPDYrr, VPXORYrr)
195ENTRY(VPERM2F128rm, VPERM2F128rm, VPERM2I128rm)
196ENTRY(VPERM2F128rr, VPERM2F128rr, VPERM2I128rr)
197ENTRY(VBROADCASTSSrm, VBROADCASTSSrm, VPBROADCASTDrm)
198ENTRY(VBROADCASTSSrr, VBROADCASTSSrr, VPBROADCASTDrr)
199ENTRY(VMOVDDUPrm, VMOVDDUPrm, VPBROADCASTQrm)
200ENTRY(VMOVDDUPrr, VMOVDDUPrr, VPBROADCASTQrr)
201ENTRY(VBROADCASTSSYrr, VBROADCASTSSYrr, VPBROADCASTDYrr)
202ENTRY(VBROADCASTSSYrm, VBROADCASTSSYrm, VPBROADCASTDYrm)
203ENTRY(VBROADCASTSDYrr, VBROADCASTSDYrr, VPBROADCASTQYrr)
204ENTRY(VBROADCASTSDYrm, VBROADCASTSDYrm, VPBROADCASTQYrm)
205ENTRY(VBROADCASTF128rm, VBROADCASTF128rm, VBROADCASTI128rm)
206ENTRY(VBLENDPSYrri, VBLENDPSYrri, VPBLENDDYrri)
207ENTRY(VBLENDPSYrmi, VBLENDPSYrmi, VPBLENDDYrmi)
208ENTRY(VPERMILPSYmi, VPERMILPSYmi, VPSHUFDYmi)
209ENTRY(VPERMILPSYri, VPERMILPSYri, VPSHUFDYri)
210ENTRY(VUNPCKLPDYrm, VUNPCKLPDYrm, VPUNPCKLQDQYrm)
211ENTRY(VUNPCKLPDYrr, VUNPCKLPDYrr, VPUNPCKLQDQYrr)
212ENTRY(VUNPCKHPDYrm, VUNPCKHPDYrm, VPUNPCKHQDQYrm)
213ENTRY(VUNPCKHPDYrr, VUNPCKHPDYrr, VPUNPCKHQDQYrr)
214ENTRY(VUNPCKLPSYrm, VUNPCKLPSYrm, VPUNPCKLDQYrm)
215ENTRY(VUNPCKLPSYrr, VUNPCKLPSYrr, VPUNPCKLDQYrr)
216ENTRY(VUNPCKHPSYrm, VUNPCKHPSYrm, VPUNPCKHDQYrm)
217ENTRY(VUNPCKHPSYrr, VUNPCKHPSYrr, VPUNPCKHDQYrr)
218};
219
220static const uint16_t ReplaceableInstrsFP[][3] = {
221// PackedSingle, PackedDouble
222ENTRY(MOVLPSrm, MOVLPDrm, INSTRUCTION_LIST_END)
223ENTRY(MOVHPSrm, MOVHPDrm, INSTRUCTION_LIST_END)
224ENTRY(MOVHPSmr, MOVHPDmr, INSTRUCTION_LIST_END)
225ENTRY(VMOVLPSrm, VMOVLPDrm, INSTRUCTION_LIST_END)
226ENTRY(VMOVHPSrm, VMOVHPDrm, INSTRUCTION_LIST_END)
227ENTRY(VMOVHPSmr, VMOVHPDmr, INSTRUCTION_LIST_END)
228ENTRY(VMOVLPSZ128rm, VMOVLPDZ128rm, INSTRUCTION_LIST_END)
229ENTRY(VMOVHPSZ128rm, VMOVHPDZ128rm, INSTRUCTION_LIST_END)
230ENTRY(VMOVHPSZ128mr, VMOVHPDZ128mr, INSTRUCTION_LIST_END)
231};
232
233static const uint16_t ReplaceableInstrsAVX2InsertExtract[][3] = {
234// PackedSingle, PackedDouble, PackedInt
235ENTRY(VEXTRACTF128mr, VEXTRACTF128mr, VEXTRACTI128mr)
236ENTRY(VEXTRACTF128rr, VEXTRACTF128rr, VEXTRACTI128rr)
237ENTRY(VINSERTF128rm, VINSERTF128rm, VINSERTI128rm)
238ENTRY(VINSERTF128rr, VINSERTF128rr, VINSERTI128rr)
239};
240
241// NOTE: These should only be used by the custom domain methods.
242static const uint16_t ReplaceableBlendInstrs[][3] = {
243//PackedSingle, PackedDouble, PackedInt
244ENTRY(BLENDPSrmi, BLENDPDrmi, PBLENDWrmi)
245ENTRY(BLENDPSrri, BLENDPDrri, PBLENDWrri)
246ENTRY(VBLENDPSrmi, VBLENDPDrmi, VPBLENDWrmi)
247ENTRY(VBLENDPSrri, VBLENDPDrri, VPBLENDWrri)
248ENTRY(VBLENDPSYrmi, VBLENDPDYrmi, VPBLENDWYrmi)
249ENTRY(VBLENDPSYrri, VBLENDPDYrri, VPBLENDWYrri)
250};
251
252static const uint16_t ReplaceableBlendAVX2Instrs[][3] = {
253// PackedSingle, PackedDouble, PackedInt
254ENTRY(VBLENDPSrmi, VBLENDPDrmi, VPBLENDDrmi)
255ENTRY(VBLENDPSrri, VBLENDPDrri, VPBLENDDrri)
256ENTRY(VBLENDPSYrmi, VBLENDPDYrmi, VPBLENDDYrmi)
257ENTRY(VBLENDPSYrri, VBLENDPDYrri, VPBLENDDYrri)
258};
259
260#undef ENTRY
261#define ENTRY(A, B, C, D) {X86::A, X86::B, X86::C, X86::D},
262static const uint16_t ReplaceableInstrsAVX512[][4] = {
263// Two integer columns for 64-bit and 32-bit elements.
264//PackedSingle, PackedDouble, PackedInt, PackedInt
265ENTRY(VMOVAPSZ128mr, VMOVAPDZ128mr, VMOVDQA64Z128mr, VMOVDQA32Z128mr)
266ENTRY(VMOVAPSZ128rm, VMOVAPDZ128rm, VMOVDQA64Z128rm, VMOVDQA32Z128rm)
267ENTRY(VMOVAPSZ128rr, VMOVAPDZ128rr, VMOVDQA64Z128rr, VMOVDQA32Z128rr)
268ENTRY(VMOVUPSZ128mr, VMOVUPDZ128mr, VMOVDQU64Z128mr, VMOVDQU32Z128mr)
269ENTRY(VMOVUPSZ128rm, VMOVUPDZ128rm, VMOVDQU64Z128rm, VMOVDQU32Z128rm)
270ENTRY(VMOVAPSZ256mr, VMOVAPDZ256mr, VMOVDQA64Z256mr, VMOVDQA32Z256mr)
271ENTRY(VMOVAPSZ256rm, VMOVAPDZ256rm, VMOVDQA64Z256rm, VMOVDQA32Z256rm)
272ENTRY(VMOVAPSZ256rr, VMOVAPDZ256rr, VMOVDQA64Z256rr, VMOVDQA32Z256rr)
273ENTRY(VMOVUPSZ256mr, VMOVUPDZ256mr, VMOVDQU64Z256mr, VMOVDQU32Z256mr)
274ENTRY(VMOVUPSZ256rm, VMOVUPDZ256rm, VMOVDQU64Z256rm, VMOVDQU32Z256rm)
275ENTRY(VMOVAPSZmr, VMOVAPDZmr, VMOVDQA64Zmr, VMOVDQA32Zmr)
276ENTRY(VMOVAPSZrm, VMOVAPDZrm, VMOVDQA64Zrm, VMOVDQA32Zrm)
277ENTRY(VMOVAPSZrr, VMOVAPDZrr, VMOVDQA64Zrr, VMOVDQA32Zrr)
278ENTRY(VMOVUPSZmr, VMOVUPDZmr, VMOVDQU64Zmr, VMOVDQU32Zmr)
279ENTRY(VMOVUPSZrm, VMOVUPDZrm, VMOVDQU64Zrm, VMOVDQU32Zrm)
280};
281
282static const uint16_t ReplaceableInstrsAVX512DQ[][4] = {
283// Two integer columns for 64-bit and 32-bit elements.
284// PackedSingle, PackedDouble, PackedInt, PackedInt
285ENTRY(VANDNPSZ128rm, VANDNPDZ128rm, VPANDNQZ128rm, VPANDNDZ128rm)
286ENTRY(VANDNPSZ128rr, VANDNPDZ128rr, VPANDNQZ128rr, VPANDNDZ128rr)
287ENTRY(VANDPSZ128rm, VANDPDZ128rm, VPANDQZ128rm, VPANDDZ128rm)
288ENTRY(VANDPSZ128rr, VANDPDZ128rr, VPANDQZ128rr, VPANDDZ128rr)
289ENTRY(VORPSZ128rm, VORPDZ128rm, VPORQZ128rm, VPORDZ128rm)
290ENTRY(VORPSZ128rr, VORPDZ128rr, VPORQZ128rr, VPORDZ128rr)
291ENTRY(VXORPSZ128rm, VXORPDZ128rm, VPXORQZ128rm, VPXORDZ128rm)
292ENTRY(VXORPSZ128rr, VXORPDZ128rr, VPXORQZ128rr, VPXORDZ128rr)
293ENTRY(VANDNPSZ256rm, VANDNPDZ256rm, VPANDNQZ256rm, VPANDNDZ256rm)
294ENTRY(VANDNPSZ256rr, VANDNPDZ256rr, VPANDNQZ256rr, VPANDNDZ256rr)
295ENTRY(VANDPSZ256rm, VANDPDZ256rm, VPANDQZ256rm, VPANDDZ256rm)
296ENTRY(VANDPSZ256rr, VANDPDZ256rr, VPANDQZ256rr, VPANDDZ256rr)
297ENTRY(VORPSZ256rm, VORPDZ256rm, VPORQZ256rm, VPORDZ256rm)
298ENTRY(VORPSZ256rr, VORPDZ256rr, VPORQZ256rr, VPORDZ256rr)
299ENTRY(VXORPSZ256rm, VXORPDZ256rm, VPXORQZ256rm, VPXORDZ256rm)
300ENTRY(VXORPSZ256rr, VXORPDZ256rr, VPXORQZ256rr, VPXORDZ256rr)
301ENTRY(VANDNPSZrm, VANDNPDZrm, VPANDNQZrm, VPANDNDZrm)
302ENTRY(VANDNPSZrr, VANDNPDZrr, VPANDNQZrr, VPANDNDZrr)
303ENTRY(VANDPSZrm, VANDPDZrm, VPANDQZrm, VPANDDZrm)
304ENTRY(VANDPSZrr, VANDPDZrr, VPANDQZrr, VPANDDZrr)
305ENTRY(VORPSZrm, VORPDZrm, VPORQZrm, VPORDZrm)
306ENTRY(VORPSZrr, VORPDZrr, VPORQZrr, VPORDZrr)
307ENTRY(VXORPSZrm, VXORPDZrm, VPXORQZrm, VPXORDZrm)
308ENTRY(VXORPSZrr, VXORPDZrr, VPXORQZrr, VPXORDZrr)
309};
310
311static const uint16_t ReplaceableInstrsAVX512DQMasked[][4] = {
312// Two integer columns for 64-bit and 32-bit elements.
313// PackedSingle, PackedDouble, PackedInt, PackedInt
314ENTRY(VANDNPSZ128rmk, VANDNPDZ128rmk, VPANDNQZ128rmk, VPANDNDZ128rmk)
315ENTRY(VANDNPSZ128rmkz, VANDNPDZ128rmkz, VPANDNQZ128rmkz, VPANDNDZ128rmkz)
316ENTRY(VANDNPSZ128rrk, VANDNPDZ128rrk, VPANDNQZ128rrk, VPANDNDZ128rrk)
317ENTRY(VANDNPSZ128rrkz, VANDNPDZ128rrkz, VPANDNQZ128rrkz, VPANDNDZ128rrkz)
318ENTRY(VANDPSZ128rmk, VANDPDZ128rmk, VPANDQZ128rmk, VPANDDZ128rmk)
319ENTRY(VANDPSZ128rmkz, VANDPDZ128rmkz, VPANDQZ128rmkz, VPANDDZ128rmkz)
320ENTRY(VANDPSZ128rrk, VANDPDZ128rrk, VPANDQZ128rrk, VPANDDZ128rrk)
321ENTRY(VANDPSZ128rrkz, VANDPDZ128rrkz, VPANDQZ128rrkz, VPANDDZ128rrkz)
322ENTRY(VORPSZ128rmk, VORPDZ128rmk, VPORQZ128rmk, VPORDZ128rmk)
323ENTRY(VORPSZ128rmkz, VORPDZ128rmkz, VPORQZ128rmkz, VPORDZ128rmkz)
324ENTRY(VORPSZ128rrk, VORPDZ128rrk, VPORQZ128rrk, VPORDZ128rrk)
325ENTRY(VORPSZ128rrkz, VORPDZ128rrkz, VPORQZ128rrkz, VPORDZ128rrkz)
326ENTRY(VXORPSZ128rmk, VXORPDZ128rmk, VPXORQZ128rmk, VPXORDZ128rmk)
327ENTRY(VXORPSZ128rmkz, VXORPDZ128rmkz, VPXORQZ128rmkz, VPXORDZ128rmkz)
328ENTRY(VXORPSZ128rrk, VXORPDZ128rrk, VPXORQZ128rrk, VPXORDZ128rrk)
329ENTRY(VXORPSZ128rrkz, VXORPDZ128rrkz, VPXORQZ128rrkz, VPXORDZ128rrkz)
330ENTRY(VANDNPSZ256rmk, VANDNPDZ256rmk, VPANDNQZ256rmk, VPANDNDZ256rmk)
331ENTRY(VANDNPSZ256rmkz, VANDNPDZ256rmkz, VPANDNQZ256rmkz, VPANDNDZ256rmkz)
332ENTRY(VANDNPSZ256rrk, VANDNPDZ256rrk, VPANDNQZ256rrk, VPANDNDZ256rrk)
333ENTRY(VANDNPSZ256rrkz, VANDNPDZ256rrkz, VPANDNQZ256rrkz, VPANDNDZ256rrkz)
334ENTRY(VANDPSZ256rmk, VANDPDZ256rmk, VPANDQZ256rmk, VPANDDZ256rmk)
335ENTRY(VANDPSZ256rmkz, VANDPDZ256rmkz, VPANDQZ256rmkz, VPANDDZ256rmkz)
336ENTRY(VANDPSZ256rrk, VANDPDZ256rrk, VPANDQZ256rrk, VPANDDZ256rrk)
337ENTRY(VANDPSZ256rrkz, VANDPDZ256rrkz, VPANDQZ256rrkz, VPANDDZ256rrkz)
338ENTRY(VORPSZ256rmk, VORPDZ256rmk, VPORQZ256rmk, VPORDZ256rmk)
339ENTRY(VORPSZ256rmkz, VORPDZ256rmkz, VPORQZ256rmkz, VPORDZ256rmkz)
340ENTRY(VORPSZ256rrk, VORPDZ256rrk, VPORQZ256rrk, VPORDZ256rrk)
341ENTRY(VORPSZ256rrkz, VORPDZ256rrkz, VPORQZ256rrkz, VPORDZ256rrkz)
342ENTRY(VXORPSZ256rmk, VXORPDZ256rmk, VPXORQZ256rmk, VPXORDZ256rmk)
343ENTRY(VXORPSZ256rmkz, VXORPDZ256rmkz, VPXORQZ256rmkz, VPXORDZ256rmkz)
344ENTRY(VXORPSZ256rrk, VXORPDZ256rrk, VPXORQZ256rrk, VPXORDZ256rrk)
345ENTRY(VXORPSZ256rrkz, VXORPDZ256rrkz, VPXORQZ256rrkz, VPXORDZ256rrkz)
346ENTRY(VANDNPSZrmk, VANDNPDZrmk, VPANDNQZrmk, VPANDNDZrmk)
347ENTRY(VANDNPSZrmkz, VANDNPDZrmkz, VPANDNQZrmkz, VPANDNDZrmkz)
348ENTRY(VANDNPSZrrk, VANDNPDZrrk, VPANDNQZrrk, VPANDNDZrrk)
349ENTRY(VANDNPSZrrkz, VANDNPDZrrkz, VPANDNQZrrkz, VPANDNDZrrkz)
350ENTRY(VANDPSZrmk, VANDPDZrmk, VPANDQZrmk, VPANDDZrmk)
351ENTRY(VANDPSZrmkz, VANDPDZrmkz, VPANDQZrmkz, VPANDDZrmkz)
352ENTRY(VANDPSZrrk, VANDPDZrrk, VPANDQZrrk, VPANDDZrrk)
353ENTRY(VANDPSZrrkz, VANDPDZrrkz, VPANDQZrrkz, VPANDDZrrkz)
354ENTRY(VORPSZrmk, VORPDZrmk, VPORQZrmk, VPORDZrmk)
355ENTRY(VORPSZrmkz, VORPDZrmkz, VPORQZrmkz, VPORDZrmkz)
356ENTRY(VORPSZrrk, VORPDZrrk, VPORQZrrk, VPORDZrrk)
357ENTRY(VORPSZrrkz, VORPDZrrkz, VPORQZrrkz, VPORDZrrkz)
358ENTRY(VXORPSZrmk, VXORPDZrmk, VPXORQZrmk, VPXORDZrmk)
359ENTRY(VXORPSZrmkz, VXORPDZrmkz, VPXORQZrmkz, VPXORDZrmkz)
360ENTRY(VXORPSZrrk, VXORPDZrrk, VPXORQZrrk, VPXORDZrrk)
361ENTRY(VXORPSZrrkz, VXORPDZrrkz, VPXORQZrrkz, VPXORDZrrkz)
362// Broadcast loads can be handled the same as masked operations to avoid
363// changing element size.
364ENTRY(VANDNPSZ128rmb, VANDNPDZ128rmb, VPANDNQZ128rmb, VPANDNDZ128rmb)
365ENTRY(VANDPSZ128rmb, VANDPDZ128rmb, VPANDQZ128rmb, VPANDDZ128rmb)
366ENTRY(VORPSZ128rmb, VORPDZ128rmb, VPORQZ128rmb, VPORDZ128rmb)
367ENTRY(VXORPSZ128rmb, VXORPDZ128rmb, VPXORQZ128rmb, VPXORDZ128rmb)
368ENTRY(VANDNPSZ256rmb, VANDNPDZ256rmb, VPANDNQZ256rmb, VPANDNDZ256rmb)
369ENTRY(VANDPSZ256rmb, VANDPDZ256rmb, VPANDQZ256rmb, VPANDDZ256rmb)
370ENTRY(VORPSZ256rmb, VORPDZ256rmb, VPORQZ256rmb, VPORDZ256rmb)
371ENTRY(VXORPSZ256rmb, VXORPDZ256rmb, VPXORQZ256rmb, VPXORDZ256rmb)
372ENTRY(VANDNPSZrmb, VANDNPDZrmb, VPANDNQZrmb, VPANDNDZrmb)
373ENTRY(VANDPSZrmb, VANDPDZrmb, VPANDQZrmb, VPANDDZrmb)
374ENTRY(VANDPSZrmb, VANDPDZrmb, VPANDQZrmb, VPANDDZrmb)
375ENTRY(VORPSZrmb, VORPDZrmb, VPORQZrmb, VPORDZrmb)
376ENTRY(VXORPSZrmb, VXORPDZrmb, VPXORQZrmb, VPXORDZrmb)
377ENTRY(VANDNPSZ128rmbk, VANDNPDZ128rmbk, VPANDNQZ128rmbk, VPANDNDZ128rmbk)
378ENTRY(VANDPSZ128rmbk, VANDPDZ128rmbk, VPANDQZ128rmbk, VPANDDZ128rmbk)
379ENTRY(VORPSZ128rmbk, VORPDZ128rmbk, VPORQZ128rmbk, VPORDZ128rmbk)
380ENTRY(VXORPSZ128rmbk, VXORPDZ128rmbk, VPXORQZ128rmbk, VPXORDZ128rmbk)
381ENTRY(VANDNPSZ256rmbk, VANDNPDZ256rmbk, VPANDNQZ256rmbk, VPANDNDZ256rmbk)
382ENTRY(VANDPSZ256rmbk, VANDPDZ256rmbk, VPANDQZ256rmbk, VPANDDZ256rmbk)
383ENTRY(VORPSZ256rmbk, VORPDZ256rmbk, VPORQZ256rmbk, VPORDZ256rmbk)
384ENTRY(VXORPSZ256rmbk, VXORPDZ256rmbk, VPXORQZ256rmbk, VPXORDZ256rmbk)
385ENTRY(VANDNPSZrmbk, VANDNPDZrmbk, VPANDNQZrmbk, VPANDNDZrmbk)
386ENTRY(VANDPSZrmbk, VANDPDZrmbk, VPANDQZrmbk, VPANDDZrmbk)
387ENTRY(VANDPSZrmbk, VANDPDZrmbk, VPANDQZrmbk, VPANDDZrmbk)
388ENTRY(VORPSZrmbk, VORPDZrmbk, VPORQZrmbk, VPORDZrmbk)
389ENTRY(VXORPSZrmbk, VXORPDZrmbk, VPXORQZrmbk, VPXORDZrmbk)
390ENTRY(VANDNPSZ128rmbkz, VANDNPDZ128rmbkz, VPANDNQZ128rmbkz, VPANDNDZ128rmbkz)
391ENTRY(VANDPSZ128rmbkz, VANDPDZ128rmbkz, VPANDQZ128rmbkz, VPANDDZ128rmbkz)
392ENTRY(VORPSZ128rmbkz, VORPDZ128rmbkz, VPORQZ128rmbkz, VPORDZ128rmbkz)
393ENTRY(VXORPSZ128rmbkz, VXORPDZ128rmbkz, VPXORQZ128rmbkz, VPXORDZ128rmbkz)
394ENTRY(VANDNPSZ256rmbkz, VANDNPDZ256rmbkz, VPANDNQZ256rmbkz, VPANDNDZ256rmbkz)
395ENTRY(VANDPSZ256rmbkz, VANDPDZ256rmbkz, VPANDQZ256rmbkz, VPANDDZ256rmbkz)
396ENTRY(VORPSZ256rmbkz, VORPDZ256rmbkz, VPORQZ256rmbkz, VPORDZ256rmbkz)
397ENTRY(VXORPSZ256rmbkz, VXORPDZ256rmbkz, VPXORQZ256rmbkz, VPXORDZ256rmbkz)
398ENTRY(VANDNPSZrmbkz, VANDNPDZrmbkz, VPANDNQZrmbkz, VPANDNDZrmbkz)
399ENTRY(VANDPSZrmbkz, VANDPDZrmbkz, VPANDQZrmbkz, VPANDDZrmbkz)
400ENTRY(VANDPSZrmbkz, VANDPDZrmbkz, VPANDQZrmbkz, VPANDDZrmbkz)
401ENTRY(VORPSZrmbkz, VORPDZrmbkz, VPORQZrmbkz, VPORDZrmbkz)
402ENTRY(VXORPSZrmbkz, VXORPDZrmbkz, VPXORQZrmbkz, VPXORDZrmbkz)
403};
404
405// Special table for changing EVEX logic instructions to VEX.
406// TODO: Should we run EVEX->VEX earlier?
407static const uint16_t ReplaceableCustomAVX512LogicInstrs[][4] = {
408// Two integer columns for 64-bit and 32-bit elements.
409// PackedSingle, PackedDouble, PackedInt, PackedInt
410ENTRY(VANDNPSrm, VANDNPDrm, VPANDNQZ128rm, VPANDNDZ128rm)
411ENTRY(VANDNPSrr, VANDNPDrr, VPANDNQZ128rr, VPANDNDZ128rr)
412ENTRY(VANDPSrm, VANDPDrm, VPANDQZ128rm, VPANDDZ128rm)
413ENTRY(VANDPSrr, VANDPDrr, VPANDQZ128rr, VPANDDZ128rr)
414ENTRY(VORPSrm, VORPDrm, VPORQZ128rm, VPORDZ128rm)
415ENTRY(VORPSrr, VORPDrr, VPORQZ128rr, VPORDZ128rr)
416ENTRY(VXORPSrm, VXORPDrm, VPXORQZ128rm, VPXORDZ128rm)
417ENTRY(VXORPSrr, VXORPDrr, VPXORQZ128rr, VPXORDZ128rr)
418ENTRY(VANDNPSYrm, VANDNPDYrm, VPANDNQZ256rm, VPANDNDZ256rm)
419ENTRY(VANDNPSYrr, VANDNPDYrr, VPANDNQZ256rr, VPANDNDZ256rr)
420ENTRY(VANDPSYrm, VANDPDYrm, VPANDQZ256rm, VPANDDZ256rm)
421ENTRY(VANDPSYrr, VANDPDYrr, VPANDQZ256rr, VPANDDZ256rr)
422ENTRY(VORPSYrm, VORPDYrm, VPORQZ256rm, VPORDZ256rm)
423ENTRY(VORPSYrr, VORPDYrr, VPORQZ256rr, VPORDZ256rr)
424ENTRY(VXORPSYrm, VXORPDYrm, VPXORQZ256rm, VPXORDZ256rm)
425ENTRY(VXORPSYrr, VXORPDYrr, VPXORQZ256rr, VPXORDZ256rr)
426};
427