llvm.org GIT mirror llvm / 5d8772f
Line endings fix. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227374 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Pilgrim 5 years ago
1 changed file(s) with 786 addition(s) and 786 deletion(s). Raw diff Collapse all Expand all
None //===-- X86InstComments.cpp - Generate verbose-asm comments for instrs ----===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This defines functionality used to emit comments about X86 instructions to
10 // an output stream for -fverbose-asm.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "X86InstComments.h"
15 #include "MCTargetDesc/X86MCTargetDesc.h"
16 #include "Utils/X86ShuffleDecode.h"
17 #include "llvm/MC/MCInst.h"
18 #include "llvm/CodeGen/MachineValueType.h"
19 #include "llvm/Support/raw_ostream.h"
20
21 using namespace llvm;
22
23 //===----------------------------------------------------------------------===//
24 // Top Level Entrypoint
25 //===----------------------------------------------------------------------===//
26
27 /// EmitAnyX86InstComments - This function decodes x86 instructions and prints
28 /// newline terminated strings to the specified string if desired. This
29 /// information is shown in disassembly dumps when verbose assembly is enabled.
30 bool llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
31 const char *(*getRegName)(unsigned)) {
32 // If this is a shuffle operation, the switch should fill in this state.
33 SmallVector ShuffleMask;
34 const char *DestName = nullptr, *Src1Name = nullptr, *Src2Name = nullptr;
35
36 switch (MI->getOpcode()) {
37 default:
38 // Not an instruction for which we can decode comments.
39 return false;
40
41 case X86::BLENDPDrri:
42 case X86::VBLENDPDrri:
43 Src2Name = getRegName(MI->getOperand(2).getReg());
44 // FALL THROUGH.
45 case X86::BLENDPDrmi:
46 case X86::VBLENDPDrmi:
47 if(MI->getOperand(MI->getNumOperands()-1).isImm())
48 DecodeBLENDMask(MVT::v2f64,
49 MI->getOperand(MI->getNumOperands()-1).getImm(),
50 ShuffleMask);
51 Src1Name = getRegName(MI->getOperand(1).getReg());
52 DestName = getRegName(MI->getOperand(0).getReg());
53 break;
54 case X86::VBLENDPDYrri:
55 Src2Name = getRegName(MI->getOperand(2).getReg());
56 // FALL THROUGH.
57 case X86::VBLENDPDYrmi:
58 if(MI->getOperand(MI->getNumOperands()-1).isImm())
59 DecodeBLENDMask(MVT::v4f64,
60 MI->getOperand(MI->getNumOperands()-1).getImm(),
61 ShuffleMask);
62 Src1Name = getRegName(MI->getOperand(1).getReg());
63 DestName = getRegName(MI->getOperand(0).getReg());
64 break;
65
66 case X86::BLENDPSrri:
67 case X86::VBLENDPSrri:
68 Src2Name = getRegName(MI->getOperand(2).getReg());
69 // FALL THROUGH.
70 case X86::BLENDPSrmi:
71 case X86::VBLENDPSrmi:
72 if(MI->getOperand(MI->getNumOperands()-1).isImm())
73 DecodeBLENDMask(MVT::v4f32,
74 MI->getOperand(MI->getNumOperands()-1).getImm(),
75 ShuffleMask);
76 Src1Name = getRegName(MI->getOperand(1).getReg());
77 DestName = getRegName(MI->getOperand(0).getReg());
78 break;
79 case X86::VBLENDPSYrri:
80 Src2Name = getRegName(MI->getOperand(2).getReg());
81 // FALL THROUGH.
82 case X86::VBLENDPSYrmi:
83 if(MI->getOperand(MI->getNumOperands()-1).isImm())
84 DecodeBLENDMask(MVT::v8f32,
85 MI->getOperand(MI->getNumOperands()-1).getImm(),
86 ShuffleMask);
87 Src1Name = getRegName(MI->getOperand(1).getReg());
88 DestName = getRegName(MI->getOperand(0).getReg());
89 break;
90
91 case X86::PBLENDWrri:
92 case X86::VPBLENDWrri:
93 Src2Name = getRegName(MI->getOperand(2).getReg());
94 // FALL THROUGH.
95 case X86::PBLENDWrmi:
96 case X86::VPBLENDWrmi:
97 if(MI->getOperand(MI->getNumOperands()-1).isImm())
98 DecodeBLENDMask(MVT::v8i16,
99 MI->getOperand(MI->getNumOperands()-1).getImm(),
100 ShuffleMask);
101 Src1Name = getRegName(MI->getOperand(1).getReg());
102 DestName = getRegName(MI->getOperand(0).getReg());
103 break;
104 case X86::VPBLENDWYrri:
105 Src2Name = getRegName(MI->getOperand(2).getReg());
106 // FALL THROUGH.
107 case X86::VPBLENDWYrmi:
108 if(MI->getOperand(MI->getNumOperands()-1).isImm())
109 DecodeBLENDMask(MVT::v16i16,
110 MI->getOperand(MI->getNumOperands()-1).getImm(),
111 ShuffleMask);
112 Src1Name = getRegName(MI->getOperand(1).getReg());
113 DestName = getRegName(MI->getOperand(0).getReg());
114 break;
115
116 case X86::VPBLENDDrri:
117 Src2Name = getRegName(MI->getOperand(2).getReg());
118 // FALL THROUGH.
119 case X86::VPBLENDDrmi:
120 if(MI->getOperand(MI->getNumOperands()-1).isImm())
121 DecodeBLENDMask(MVT::v4i32,
122 MI->getOperand(MI->getNumOperands()-1).getImm(),
123 ShuffleMask);
124 Src1Name = getRegName(MI->getOperand(1).getReg());
125 DestName = getRegName(MI->getOperand(0).getReg());
126 break;
127
128 case X86::VPBLENDDYrri:
129 Src2Name = getRegName(MI->getOperand(2).getReg());
130 // FALL THROUGH.
131 case X86::VPBLENDDYrmi:
132 if(MI->getOperand(MI->getNumOperands()-1).isImm())
133 DecodeBLENDMask(MVT::v8i32,
134 MI->getOperand(MI->getNumOperands()-1).getImm(),
135 ShuffleMask);
136 Src1Name = getRegName(MI->getOperand(1).getReg());
137 DestName = getRegName(MI->getOperand(0).getReg());
138 break;
139
140 case X86::INSERTPSrr:
141 case X86::VINSERTPSrr:
142 Src2Name = getRegName(MI->getOperand(2).getReg());
143 // FALL THROUGH.
144 case X86::INSERTPSrm:
145 case X86::VINSERTPSrm:
146 DestName = getRegName(MI->getOperand(0).getReg());
147 Src1Name = getRegName(MI->getOperand(1).getReg());
148 if(MI->getOperand(MI->getNumOperands()-1).isImm())
149 DecodeINSERTPSMask(MI->getOperand(MI->getNumOperands()-1).getImm(),
150 ShuffleMask);
151 break;
152
153 case X86::MOVLHPSrr:
154 case X86::VMOVLHPSrr:
155 Src2Name = getRegName(MI->getOperand(2).getReg());
156 Src1Name = getRegName(MI->getOperand(1).getReg());
157 DestName = getRegName(MI->getOperand(0).getReg());
158 DecodeMOVLHPSMask(2, ShuffleMask);
159 break;
160
161 case X86::MOVHLPSrr:
162 case X86::VMOVHLPSrr:
163 Src2Name = getRegName(MI->getOperand(2).getReg());
164 Src1Name = getRegName(MI->getOperand(1).getReg());
165 DestName = getRegName(MI->getOperand(0).getReg());
166 DecodeMOVHLPSMask(2, ShuffleMask);
167 break;
168
169 case X86::MOVSLDUPrr:
170 case X86::VMOVSLDUPrr:
171 Src1Name = getRegName(MI->getOperand(1).getReg());
172 // FALL THROUGH.
173 case X86::MOVSLDUPrm:
174 case X86::VMOVSLDUPrm:
175 DestName = getRegName(MI->getOperand(0).getReg());
176 DecodeMOVSLDUPMask(MVT::v4f32, ShuffleMask);
177 break;
178
179 case X86::VMOVSHDUPYrr:
180 Src1Name = getRegName(MI->getOperand(1).getReg());
181 // FALL THROUGH.
182 case X86::VMOVSHDUPYrm:
183 DestName = getRegName(MI->getOperand(0).getReg());
184 DecodeMOVSHDUPMask(MVT::v8f32, ShuffleMask);
185 break;
186
187 case X86::VMOVSLDUPYrr:
188 Src1Name = getRegName(MI->getOperand(1).getReg());
189 // FALL THROUGH.
190 case X86::VMOVSLDUPYrm:
191 DestName = getRegName(MI->getOperand(0).getReg());
192 DecodeMOVSLDUPMask(MVT::v8f32, ShuffleMask);
193 break;
194
195 case X86::MOVSHDUPrr:
196 case X86::VMOVSHDUPrr:
197 Src1Name = getRegName(MI->getOperand(1).getReg());
198 // FALL THROUGH.
199 case X86::MOVSHDUPrm:
200 case X86::VMOVSHDUPrm:
201 DestName = getRegName(MI->getOperand(0).getReg());
0 //===-- X86InstComments.cpp - Generate verbose-asm comments for instrs ----===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This defines functionality used to emit comments about X86 instructions to
10 // an output stream for -fverbose-asm.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "X86InstComments.h"
15 #include "MCTargetDesc/X86MCTargetDesc.h"
16 #include "Utils/X86ShuffleDecode.h"
17 #include "llvm/MC/MCInst.h"
18 #include "llvm/CodeGen/MachineValueType.h"
19 #include "llvm/Support/raw_ostream.h"
20
21 using namespace llvm;
22
23 //===----------------------------------------------------------------------===//
24 // Top Level Entrypoint
25 //===----------------------------------------------------------------------===//
26
27 /// EmitAnyX86InstComments - This function decodes x86 instructions and prints
28 /// newline terminated strings to the specified string if desired. This
29 /// information is shown in disassembly dumps when verbose assembly is enabled.
30 bool llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
31 const char *(*getRegName)(unsigned)) {
32 // If this is a shuffle operation, the switch should fill in this state.
33 SmallVector ShuffleMask;
34 const char *DestName = nullptr, *Src1Name = nullptr, *Src2Name = nullptr;
35
36 switch (MI->getOpcode()) {
37 default:
38 // Not an instruction for which we can decode comments.
39 return false;
40
41 case X86::BLENDPDrri:
42 case X86::VBLENDPDrri:
43 Src2Name = getRegName(MI->getOperand(2).getReg());
44 // FALL THROUGH.
45 case X86::BLENDPDrmi:
46 case X86::VBLENDPDrmi:
47 if(MI->getOperand(MI->getNumOperands()-1).isImm())
48 DecodeBLENDMask(MVT::v2f64,
49 MI->getOperand(MI->getNumOperands()-1).getImm(),
50 ShuffleMask);
51 Src1Name = getRegName(MI->getOperand(1).getReg());
52 DestName = getRegName(MI->getOperand(0).getReg());
53 break;
54 case X86::VBLENDPDYrri:
55 Src2Name = getRegName(MI->getOperand(2).getReg());
56 // FALL THROUGH.
57 case X86::VBLENDPDYrmi:
58 if(MI->getOperand(MI->getNumOperands()-1).isImm())
59 DecodeBLENDMask(MVT::v4f64,
60 MI->getOperand(MI->getNumOperands()-1).getImm(),
61 ShuffleMask);
62 Src1Name = getRegName(MI->getOperand(1).getReg());
63 DestName = getRegName(MI->getOperand(0).getReg());
64 break;
65
66 case X86::BLENDPSrri:
67 case X86::VBLENDPSrri:
68 Src2Name = getRegName(MI->getOperand(2).getReg());
69 // FALL THROUGH.
70 case X86::BLENDPSrmi:
71 case X86::VBLENDPSrmi:
72 if(MI->getOperand(MI->getNumOperands()-1).isImm())
73 DecodeBLENDMask(MVT::v4f32,
74 MI->getOperand(MI->getNumOperands()-1).getImm(),
75 ShuffleMask);
76 Src1Name = getRegName(MI->getOperand(1).getReg());
77 DestName = getRegName(MI->getOperand(0).getReg());
78 break;
79 case X86::VBLENDPSYrri:
80 Src2Name = getRegName(MI->getOperand(2).getReg());
81 // FALL THROUGH.
82 case X86::VBLENDPSYrmi:
83 if(MI->getOperand(MI->getNumOperands()-1).isImm())
84 DecodeBLENDMask(MVT::v8f32,
85 MI->getOperand(MI->getNumOperands()-1).getImm(),
86 ShuffleMask);
87 Src1Name = getRegName(MI->getOperand(1).getReg());
88 DestName = getRegName(MI->getOperand(0).getReg());
89 break;
90
91 case X86::PBLENDWrri:
92 case X86::VPBLENDWrri:
93 Src2Name = getRegName(MI->getOperand(2).getReg());
94 // FALL THROUGH.
95 case X86::PBLENDWrmi:
96 case X86::VPBLENDWrmi:
97 if(MI->getOperand(MI->getNumOperands()-1).isImm())
98 DecodeBLENDMask(MVT::v8i16,
99 MI->getOperand(MI->getNumOperands()-1).getImm(),
100 ShuffleMask);
101 Src1Name = getRegName(MI->getOperand(1).getReg());
102 DestName = getRegName(MI->getOperand(0).getReg());
103 break;
104 case X86::VPBLENDWYrri:
105 Src2Name = getRegName(MI->getOperand(2).getReg());
106 // FALL THROUGH.
107 case X86::VPBLENDWYrmi:
108 if(MI->getOperand(MI->getNumOperands()-1).isImm())
109 DecodeBLENDMask(MVT::v16i16,
110 MI->getOperand(MI->getNumOperands()-1).getImm(),
111 ShuffleMask);
112 Src1Name = getRegName(MI->getOperand(1).getReg());
113 DestName = getRegName(MI->getOperand(0).getReg());
114 break;
115
116 case X86::VPBLENDDrri:
117 Src2Name = getRegName(MI->getOperand(2).getReg());
118 // FALL THROUGH.
119 case X86::VPBLENDDrmi:
120 if(MI->getOperand(MI->getNumOperands()-1).isImm())
121 DecodeBLENDMask(MVT::v4i32,
122 MI->getOperand(MI->getNumOperands()-1).getImm(),
123 ShuffleMask);
124 Src1Name = getRegName(MI->getOperand(1).getReg());
125 DestName = getRegName(MI->getOperand(0).getReg());
126 break;
127
128 case X86::VPBLENDDYrri:
129 Src2Name = getRegName(MI->getOperand(2).getReg());
130 // FALL THROUGH.
131 case X86::VPBLENDDYrmi:
132 if(MI->getOperand(MI->getNumOperands()-1).isImm())
133 DecodeBLENDMask(MVT::v8i32,
134 MI->getOperand(MI->getNumOperands()-1).getImm(),
135 ShuffleMask);
136 Src1Name = getRegName(MI->getOperand(1).getReg());
137 DestName = getRegName(MI->getOperand(0).getReg());
138 break;
139
140 case X86::INSERTPSrr:
141 case X86::VINSERTPSrr:
142 Src2Name = getRegName(MI->getOperand(2).getReg());
143 // FALL THROUGH.
144 case X86::INSERTPSrm:
145 case X86::VINSERTPSrm:
146 DestName = getRegName(MI->getOperand(0).getReg());
147 Src1Name = getRegName(MI->getOperand(1).getReg());
148 if(MI->getOperand(MI->getNumOperands()-1).isImm())
149 DecodeINSERTPSMask(MI->getOperand(MI->getNumOperands()-1).getImm(),
150 ShuffleMask);
151 break;
152
153 case X86::MOVLHPSrr:
154 case X86::VMOVLHPSrr:
155 Src2Name = getRegName(MI->getOperand(2).getReg());
156 Src1Name = getRegName(MI->getOperand(1).getReg());
157 DestName = getRegName(MI->getOperand(0).getReg());
158 DecodeMOVLHPSMask(2, ShuffleMask);
159 break;
160
161 case X86::MOVHLPSrr:
162 case X86::VMOVHLPSrr:
163 Src2Name = getRegName(MI->getOperand(2).getReg());
164 Src1Name = getRegName(MI->getOperand(1).getReg());
165 DestName = getRegName(MI->getOperand(0).getReg());
166 DecodeMOVHLPSMask(2, ShuffleMask);
167 break;
168
169 case X86::MOVSLDUPrr:
170 case X86::VMOVSLDUPrr:
171 Src1Name = getRegName(MI->getOperand(1).getReg());
172 // FALL THROUGH.
173 case X86::MOVSLDUPrm:
174 case X86::VMOVSLDUPrm:
175 DestName = getRegName(MI->getOperand(0).getReg());
176 DecodeMOVSLDUPMask(MVT::v4f32, ShuffleMask);
177 break;
178
179 case X86::VMOVSHDUPYrr:
180 Src1Name = getRegName(MI->getOperand(1).getReg());
181 // FALL THROUGH.
182 case X86::VMOVSHDUPYrm:
183 DestName = getRegName(MI->getOperand(0).getReg());
184 DecodeMOVSHDUPMask(MVT::v8f32, ShuffleMask);
185 break;
186
187 case X86::VMOVSLDUPYrr:
188 Src1Name = getRegName(MI->getOperand(1).getReg());
189 // FALL THROUGH.
190 case X86::VMOVSLDUPYrm:
191 DestName = getRegName(MI->getOperand(0).getReg());
192 DecodeMOVSLDUPMask(MVT::v8f32, ShuffleMask);
193 break;
194
195 case X86::MOVSHDUPrr:
196 case X86::VMOVSHDUPrr:
197 Src1Name = getRegName(MI->getOperand(1).getReg());
198 // FALL THROUGH.
199 case X86::MOVSHDUPrm:
200 case X86::VMOVSHDUPrm:
201 DestName = getRegName(MI->getOperand(0).getReg());
202202 DecodeMOVSHDUPMask(MVT::v4f32, ShuffleMask);
203203 break;
204204
223223 case X86::PSLLDQri:
224224 case X86::VPSLLDQri:
225225 Src1Name = getRegName(MI->getOperand(1).getReg());
226 DestName = getRegName(MI->getOperand(0).getReg());
227 if(MI->getOperand(MI->getNumOperands()-1).isImm())
228 DecodePSLLDQMask(MVT::v16i8,
229 MI->getOperand(MI->getNumOperands()-1).getImm(),
230 ShuffleMask);
231 break;
232
233 case X86::VPSLLDQYri:
234 Src1Name = getRegName(MI->getOperand(1).getReg());
235 DestName = getRegName(MI->getOperand(0).getReg());
236 if(MI->getOperand(MI->getNumOperands()-1).isImm())
237 DecodePSLLDQMask(MVT::v32i8,
238 MI->getOperand(MI->getNumOperands()-1).getImm(),
239 ShuffleMask);
240 break;
241
242 case X86::PSRLDQri:
243 case X86::VPSRLDQri:
244 Src1Name = getRegName(MI->getOperand(1).getReg());
245 DestName = getRegName(MI->getOperand(0).getReg());
246 if(MI->getOperand(MI->getNumOperands()-1).isImm())
247 DecodePSRLDQMask(MVT::v16i8,
248 MI->getOperand(MI->getNumOperands()-1).getImm(),
249 ShuffleMask);
250 break;
251
252 case X86::VPSRLDQYri:
253 Src1Name = getRegName(MI->getOperand(1).getReg());
254 DestName = getRegName(MI->getOperand(0).getReg());
255 if(MI->getOperand(MI->getNumOperands()-1).isImm())
256 DecodePSRLDQMask(MVT::v32i8,
257 MI->getOperand(MI->getNumOperands()-1).getImm(),
258 ShuffleMask);
259 break;
260
261 case X86::PALIGNR128rr:
262 case X86::VPALIGNR128rr:
263 Src1Name = getRegName(MI->getOperand(2).getReg());
264 // FALL THROUGH.
265 case X86::PALIGNR128rm:
266 case X86::VPALIGNR128rm:
267 Src2Name = getRegName(MI->getOperand(1).getReg());
268 DestName = getRegName(MI->getOperand(0).getReg());
269 if(MI->getOperand(MI->getNumOperands()-1).isImm())
270 DecodePALIGNRMask(MVT::v16i8,
271 MI->getOperand(MI->getNumOperands()-1).getImm(),
272 ShuffleMask);
273 break;
274 case X86::VPALIGNR256rr:
275 Src1Name = getRegName(MI->getOperand(2).getReg());
276 // FALL THROUGH.
277 case X86::VPALIGNR256rm:
278 Src2Name = getRegName(MI->getOperand(1).getReg());
279 DestName = getRegName(MI->getOperand(0).getReg());
280 if(MI->getOperand(MI->getNumOperands()-1).isImm())
281 DecodePALIGNRMask(MVT::v32i8,
282 MI->getOperand(MI->getNumOperands()-1).getImm(),
283 ShuffleMask);
284 break;
285
286 case X86::PSHUFDri:
287 case X86::VPSHUFDri:
288 Src1Name = getRegName(MI->getOperand(1).getReg());
289 // FALL THROUGH.
290 case X86::PSHUFDmi:
291 case X86::VPSHUFDmi:
292 DestName = getRegName(MI->getOperand(0).getReg());
293 if(MI->getOperand(MI->getNumOperands()-1).isImm())
294 DecodePSHUFMask(MVT::v4i32,
295 MI->getOperand(MI->getNumOperands()-1).getImm(),
296 ShuffleMask);
297 break;
298 case X86::VPSHUFDYri:
299 Src1Name = getRegName(MI->getOperand(1).getReg());
300 // FALL THROUGH.
301 case X86::VPSHUFDYmi:
302 DestName = getRegName(MI->getOperand(0).getReg());
303 if(MI->getOperand(MI->getNumOperands()-1).isImm())
304 DecodePSHUFMask(MVT::v8i32,
305 MI->getOperand(MI->getNumOperands()-1).getImm(),
306 ShuffleMask);
307 break;
308
309
310 case X86::PSHUFHWri:
311 case X86::VPSHUFHWri:
312 Src1Name = getRegName(MI->getOperand(1).getReg());
313 // FALL THROUGH.
314 case X86::PSHUFHWmi:
315 case X86::VPSHUFHWmi:
316 DestName = getRegName(MI->getOperand(0).getReg());
317 if(MI->getOperand(MI->getNumOperands()-1).isImm())
318 DecodePSHUFHWMask(MVT::v8i16,
319 MI->getOperand(MI->getNumOperands()-1).getImm(),
320 ShuffleMask);
321 break;
322 case X86::VPSHUFHWYri:
323 Src1Name = getRegName(MI->getOperand(1).getReg());
324 // FALL THROUGH.
325 case X86::VPSHUFHWYmi:
326 DestName = getRegName(MI->getOperand(0).getReg());
327 if(MI->getOperand(MI->getNumOperands()-1).isImm())
328 DecodePSHUFHWMask(MVT::v16i16,
329 MI->getOperand(MI->getNumOperands()-1).getImm(),
330 ShuffleMask);
331 break;
332 case X86::PSHUFLWri:
333 case X86::VPSHUFLWri:
334 Src1Name = getRegName(MI->getOperand(1).getReg());
335 // FALL THROUGH.
336 case X86::PSHUFLWmi:
337 case X86::VPSHUFLWmi:
338 DestName = getRegName(MI->getOperand(0).getReg());
339 if(MI->getOperand(MI->getNumOperands()-1).isImm())
340 DecodePSHUFLWMask(MVT::v8i16,
341 MI->getOperand(MI->getNumOperands()-1).getImm(),
342 ShuffleMask);
343 break;
344 case X86::VPSHUFLWYri:
345 Src1Name = getRegName(MI->getOperand(1).getReg());
346 // FALL THROUGH.
347 case X86::VPSHUFLWYmi:
348 DestName = getRegName(MI->getOperand(0).getReg());
349 if(MI->getOperand(MI->getNumOperands()-1).isImm())
350 DecodePSHUFLWMask(MVT::v16i16,
351 MI->getOperand(MI->getNumOperands()-1).getImm(),
352 ShuffleMask);
353 break;
354
355 case X86::PUNPCKHBWrr:
356 case X86::VPUNPCKHBWrr:
357 Src2Name = getRegName(MI->getOperand(2).getReg());
358 // FALL THROUGH.
359 case X86::PUNPCKHBWrm:
360 case X86::VPUNPCKHBWrm:
361 Src1Name = getRegName(MI->getOperand(1).getReg());
362 DestName = getRegName(MI->getOperand(0).getReg());
363 DecodeUNPCKHMask(MVT::v16i8, ShuffleMask);
364 break;
365 case X86::VPUNPCKHBWYrr:
366 Src2Name = getRegName(MI->getOperand(2).getReg());
367 // FALL THROUGH.
368 case X86::VPUNPCKHBWYrm:
369 Src1Name = getRegName(MI->getOperand(1).getReg());
370 DestName = getRegName(MI->getOperand(0).getReg());
371 DecodeUNPCKHMask(MVT::v32i8, ShuffleMask);
372 break;
373 case X86::PUNPCKHWDrr:
374 case X86::VPUNPCKHWDrr:
375 Src2Name = getRegName(MI->getOperand(2).getReg());
376 // FALL THROUGH.
377 case X86::PUNPCKHWDrm:
378 case X86::VPUNPCKHWDrm:
379 Src1Name = getRegName(MI->getOperand(1).getReg());
380 DestName = getRegName(MI->getOperand(0).getReg());
381 DecodeUNPCKHMask(MVT::v8i16, ShuffleMask);
382 break;
383 case X86::VPUNPCKHWDYrr:
384 Src2Name = getRegName(MI->getOperand(2).getReg());
385 // FALL THROUGH.
386 case X86::VPUNPCKHWDYrm:
387 Src1Name = getRegName(MI->getOperand(1).getReg());
388 DestName = getRegName(MI->getOperand(0).getReg());
389 DecodeUNPCKHMask(MVT::v16i16, ShuffleMask);
390 break;
391 case X86::PUNPCKHDQrr:
392 case X86::VPUNPCKHDQrr:
393 Src2Name = getRegName(MI->getOperand(2).getReg());
394 // FALL THROUGH.
395 case X86::PUNPCKHDQrm:
396 case X86::VPUNPCKHDQrm:
397 Src1Name = getRegName(MI->getOperand(1).getReg());
398 DestName = getRegName(MI->getOperand(0).getReg());
399 DecodeUNPCKHMask(MVT::v4i32, ShuffleMask);
400 break;
401 case X86::VPUNPCKHDQYrr:
402 Src2Name = getRegName(MI->getOperand(2).getReg());
403 // FALL THROUGH.
404 case X86::VPUNPCKHDQYrm:
405 Src1Name = getRegName(MI->getOperand(1).getReg());
406 DestName = getRegName(MI->getOperand(0).getReg());
407 DecodeUNPCKHMask(MVT::v8i32, ShuffleMask);
408 break;
409 case X86::VPUNPCKHDQZrr:
410 Src2Name = getRegName(MI->getOperand(2).getReg());
411 // FALL THROUGH.
412 case X86::VPUNPCKHDQZrm:
413 Src1Name = getRegName(MI->getOperand(1).getReg());
414 DestName = getRegName(MI->getOperand(0).getReg());
415 DecodeUNPCKHMask(MVT::v16i32, ShuffleMask);
416 break;
417 case X86::PUNPCKHQDQrr:
418 case X86::VPUNPCKHQDQrr:
419 Src2Name = getRegName(MI->getOperand(2).getReg());
420 // FALL THROUGH.
421 case X86::PUNPCKHQDQrm:
422 case X86::VPUNPCKHQDQrm:
423 Src1Name = getRegName(MI->getOperand(1).getReg());
424 DestName = getRegName(MI->getOperand(0).getReg());
425 DecodeUNPCKHMask(MVT::v2i64, ShuffleMask);
426 break;
427 case X86::VPUNPCKHQDQYrr:
428 Src2Name = getRegName(MI->getOperand(2).getReg());
429 // FALL THROUGH.
430 case X86::VPUNPCKHQDQYrm:
431 Src1Name = getRegName(MI->getOperand(1).getReg());
432 DestName = getRegName(MI->getOperand(0).getReg());
433 DecodeUNPCKHMask(MVT::v4i64, ShuffleMask);
434 break;
435 case X86::VPUNPCKHQDQZrr:
436 Src2Name = getRegName(MI->getOperand(2).getReg());
437 // FALL THROUGH.
438 case X86::VPUNPCKHQDQZrm:
439 Src1Name = getRegName(MI->getOperand(1).getReg());
440 DestName = getRegName(MI->getOperand(0).getReg());
441 DecodeUNPCKHMask(MVT::v8i64, ShuffleMask);
442 break;
443
444 case X86::PUNPCKLBWrr:
445 case X86::VPUNPCKLBWrr:
446 Src2Name = getRegName(MI->getOperand(2).getReg());
447 // FALL THROUGH.
448 case X86::PUNPCKLBWrm:
449 case X86::VPUNPCKLBWrm:
450 Src1Name = getRegName(MI->getOperand(1).getReg());
451 DestName = getRegName(MI->getOperand(0).getReg());
452 DecodeUNPCKLMask(MVT::v16i8, ShuffleMask);
453 break;
454 case X86::VPUNPCKLBWYrr:
455 Src2Name = getRegName(MI->getOperand(2).getReg());
456 // FALL THROUGH.
457 case X86::VPUNPCKLBWYrm:
458 Src1Name = getRegName(MI->getOperand(1).getReg());
459 DestName = getRegName(MI->getOperand(0).getReg());
460 DecodeUNPCKLMask(MVT::v32i8, ShuffleMask);
461 break;
462 case X86::PUNPCKLWDrr:
463 case X86::VPUNPCKLWDrr:
464 Src2Name = getRegName(MI->getOperand(2).getReg());
465 // FALL THROUGH.
466 case X86::PUNPCKLWDrm:
467 case X86::VPUNPCKLWDrm:
468 Src1Name = getRegName(MI->getOperand(1).getReg());
469 DestName = getRegName(MI->getOperand(0).getReg());
470 DecodeUNPCKLMask(MVT::v8i16, ShuffleMask);
471 break;
472 case X86::VPUNPCKLWDYrr:
473 Src2Name = getRegName(MI->getOperand(2).getReg());
474 // FALL THROUGH.
475 case X86::VPUNPCKLWDYrm:
476 Src1Name = getRegName(MI->getOperand(1).getReg());
477 DestName = getRegName(MI->getOperand(0).getReg());
478 DecodeUNPCKLMask(MVT::v16i16, ShuffleMask);
479 break;
480 case X86::PUNPCKLDQrr:
481 case X86::VPUNPCKLDQrr:
482 Src2Name = getRegName(MI->getOperand(2).getReg());
483 // FALL THROUGH.
484 case X86::PUNPCKLDQrm:
485 case X86::VPUNPCKLDQrm:
486 Src1Name = getRegName(MI->getOperand(1).getReg());
487 DestName = getRegName(MI->getOperand(0).getReg());
488 DecodeUNPCKLMask(MVT::v4i32, ShuffleMask);
489 break;
490 case X86::VPUNPCKLDQYrr:
491 Src2Name = getRegName(MI->getOperand(2).getReg());
492 // FALL THROUGH.
493 case X86::VPUNPCKLDQYrm:
494 Src1Name = getRegName(MI->getOperand(1).getReg());
495 DestName = getRegName(MI->getOperand(0).getReg());
496 DecodeUNPCKLMask(MVT::v8i32, ShuffleMask);
497 break;
498 case X86::VPUNPCKLDQZrr:
499 Src2Name = getRegName(MI->getOperand(2).getReg());
500 // FALL THROUGH.
501 case X86::VPUNPCKLDQZrm:
502 Src1Name = getRegName(MI->getOperand(1).getReg());
503 DestName = getRegName(MI->getOperand(0).getReg());
504 DecodeUNPCKLMask(MVT::v16i32, ShuffleMask);
505 break;
506 case X86::PUNPCKLQDQrr:
507 case X86::VPUNPCKLQDQrr:
508 Src2Name = getRegName(MI->getOperand(2).getReg());
509 // FALL THROUGH.
510 case X86::PUNPCKLQDQrm:
511 case X86::VPUNPCKLQDQrm:
512 Src1Name = getRegName(MI->getOperand(1).getReg());
513 DestName = getRegName(MI->getOperand(0).getReg());
514 DecodeUNPCKLMask(MVT::v2i64, ShuffleMask);
515 break;
516 case X86::VPUNPCKLQDQYrr:
517 Src2Name = getRegName(MI->getOperand(2).getReg());
518 // FALL THROUGH.
519 case X86::VPUNPCKLQDQYrm:
520 Src1Name = getRegName(MI->getOperand(1).getReg());
521 DestName = getRegName(MI->getOperand(0).getReg());
522 DecodeUNPCKLMask(MVT::v4i64, ShuffleMask);
523 break;
524 case X86::VPUNPCKLQDQZrr:
525 Src2Name = getRegName(MI->getOperand(2).getReg());
526 // FALL THROUGH.
527 case X86::VPUNPCKLQDQZrm:
528 Src1Name = getRegName(MI->getOperand(1).getReg());
529 DestName = getRegName(MI->getOperand(0).getReg());
530 DecodeUNPCKLMask(MVT::v8i64, ShuffleMask);
531 break;
532
533 case X86::SHUFPDrri:
534 case X86::VSHUFPDrri:
535 Src2Name = getRegName(MI->getOperand(2).getReg());
536 // FALL THROUGH.
537 case X86::SHUFPDrmi:
538 case X86::VSHUFPDrmi:
539 if(MI->getOperand(MI->getNumOperands()-1).isImm())
540 DecodeSHUFPMask(MVT::v2f64,
541 MI->getOperand(MI->getNumOperands()-1).getImm(),
542 ShuffleMask);
543 Src1Name = getRegName(MI->getOperand(1).getReg());
544 DestName = getRegName(MI->getOperand(0).getReg());
545 break;
546 case X86::VSHUFPDYrri:
547 Src2Name = getRegName(MI->getOperand(2).getReg());
548 // FALL THROUGH.
549 case X86::VSHUFPDYrmi:
550 if(MI->getOperand(MI->getNumOperands()-1).isImm())
551 DecodeSHUFPMask(MVT::v4f64,
552 MI->getOperand(MI->getNumOperands()-1).getImm(),
553 ShuffleMask);
554 Src1Name = getRegName(MI->getOperand(1).getReg());
555 DestName = getRegName(MI->getOperand(0).getReg());
556 break;
557
558 case X86::SHUFPSrri:
559 case X86::VSHUFPSrri:
560 Src2Name = getRegName(MI->getOperand(2).getReg());
561 // FALL THROUGH.
562 case X86::SHUFPSrmi:
563 case X86::VSHUFPSrmi:
564 if(MI->getOperand(MI->getNumOperands()-1).isImm())
565 DecodeSHUFPMask(MVT::v4f32,
566 MI->getOperand(MI->getNumOperands()-1).getImm(),
567 ShuffleMask);
568 Src1Name = getRegName(MI->getOperand(1).getReg());
569 DestName = getRegName(MI->getOperand(0).getReg());
570 break;
571 case X86::VSHUFPSYrri:
572 Src2Name = getRegName(MI->getOperand(2).getReg());
573 // FALL THROUGH.
574 case X86::VSHUFPSYrmi:
575 if(MI->getOperand(MI->getNumOperands()-1).isImm())
576 DecodeSHUFPMask(MVT::v8f32,
577 MI->getOperand(MI->getNumOperands()-1).getImm(),
578 ShuffleMask);
579 Src1Name = getRegName(MI->getOperand(1).getReg());
580 DestName = getRegName(MI->getOperand(0).getReg());
581 break;
582
583 case X86::UNPCKLPDrr:
584 case X86::VUNPCKLPDrr:
585 Src2Name = getRegName(MI->getOperand(2).getReg());
586 // FALL THROUGH.
587 case X86::UNPCKLPDrm:
588 case X86::VUNPCKLPDrm:
589 DecodeUNPCKLMask(MVT::v2f64, ShuffleMask);
590 Src1Name = getRegName(MI->getOperand(1).getReg());
591 DestName = getRegName(MI->getOperand(0).getReg());
592 break;
593 case X86::VUNPCKLPDYrr:
594 Src2Name = getRegName(MI->getOperand(2).getReg());
595 // FALL THROUGH.
596 case X86::VUNPCKLPDYrm:
597 DecodeUNPCKLMask(MVT::v4f64, ShuffleMask);
598 Src1Name = getRegName(MI->getOperand(1).getReg());
599 DestName = getRegName(MI->getOperand(0).getReg());
600 break;
601 case X86::VUNPCKLPDZrr:
602 Src2Name = getRegName(MI->getOperand(2).getReg());
603 // FALL THROUGH.
604 case X86::VUNPCKLPDZrm:
605 DecodeUNPCKLMask(MVT::v8f64, ShuffleMask);
606 Src1Name = getRegName(MI->getOperand(1).getReg());
607 DestName = getRegName(MI->getOperand(0).getReg());
608 break;
609 case X86::UNPCKLPSrr:
610 case X86::VUNPCKLPSrr:
611 Src2Name = getRegName(MI->getOperand(2).getReg());
612 // FALL THROUGH.
613 case X86::UNPCKLPSrm:
614 case X86::VUNPCKLPSrm:
615 DecodeUNPCKLMask(MVT::v4f32, ShuffleMask);
616 Src1Name = getRegName(MI->getOperand(1).getReg());
617 DestName = getRegName(MI->getOperand(0).getReg());
618 break;
619 case X86::VUNPCKLPSYrr:
620 Src2Name = getRegName(MI->getOperand(2).getReg());
621 // FALL THROUGH.
622 case X86::VUNPCKLPSYrm:
623 DecodeUNPCKLMask(MVT::v8f32, ShuffleMask);
624 Src1Name = getRegName(MI->getOperand(1).getReg());
625 DestName = getRegName(MI->getOperand(0).getReg());
626 break;
627 case X86::VUNPCKLPSZrr:
628 Src2Name = getRegName(MI->getOperand(2).getReg());
629 // FALL THROUGH.
630 case X86::VUNPCKLPSZrm:
631 DecodeUNPCKLMask(MVT::v16f32, ShuffleMask);
632 Src1Name = getRegName(MI->getOperand(1).getReg());
633 DestName = getRegName(MI->getOperand(0).getReg());
634 break;
635 case X86::UNPCKHPDrr:
636 case X86::VUNPCKHPDrr:
637 Src2Name = getRegName(MI->getOperand(2).getReg());
638 // FALL THROUGH.
639 case X86::UNPCKHPDrm:
640 case X86::VUNPCKHPDrm:
641 DecodeUNPCKHMask(MVT::v2f64, ShuffleMask);
642 Src1Name = getRegName(MI->getOperand(1).getReg());
643 DestName = getRegName(MI->getOperand(0).getReg());
644 break;
645 case X86::VUNPCKHPDYrr:
646 Src2Name = getRegName(MI->getOperand(2).getReg());
647 // FALL THROUGH.
648 case X86::VUNPCKHPDYrm:
649 DecodeUNPCKHMask(MVT::v4f64, ShuffleMask);
650 Src1Name = getRegName(MI->getOperand(1).getReg());
651 DestName = getRegName(MI->getOperand(0).getReg());
652 break;
653 case X86::VUNPCKHPDZrr:
654 Src2Name = getRegName(MI->getOperand(2).getReg());
655 // FALL THROUGH.
656 case X86::VUNPCKHPDZrm:
657 DecodeUNPCKHMask(MVT::v8f64, ShuffleMask);
658 Src1Name = getRegName(MI->getOperand(1).getReg());
659 DestName = getRegName(MI->getOperand(0).getReg());
660 break;
661 case X86::UNPCKHPSrr:
662 case X86::VUNPCKHPSrr:
663 Src2Name = getRegName(MI->getOperand(2).getReg());
664 // FALL THROUGH.
665 case X86::UNPCKHPSrm:
666 case X86::VUNPCKHPSrm:
667 DecodeUNPCKHMask(MVT::v4f32, ShuffleMask);
668 Src1Name = getRegName(MI->getOperand(1).getReg());
669 DestName = getRegName(MI->getOperand(0).getReg());
670 break;
671 case X86::VUNPCKHPSYrr:
672 Src2Name = getRegName(MI->getOperand(2).getReg());
673 // FALL THROUGH.
674 case X86::VUNPCKHPSYrm:
675 DecodeUNPCKHMask(MVT::v8f32, ShuffleMask);
676 Src1Name = getRegName(MI->getOperand(1).getReg());
677 DestName = getRegName(MI->getOperand(0).getReg());
678 break;
679 case X86::VUNPCKHPSZrr:
680 Src2Name = getRegName(MI->getOperand(2).getReg());
681 // FALL THROUGH.
682 case X86::VUNPCKHPSZrm:
683 DecodeUNPCKHMask(MVT::v16f32, ShuffleMask);
684 Src1Name = getRegName(MI->getOperand(1).getReg());
685 DestName = getRegName(MI->getOperand(0).getReg());
686 break;
687 case X86::VPERMILPSri:
688 Src1Name = getRegName(MI->getOperand(1).getReg());
689 // FALL THROUGH.
690 case X86::VPERMILPSmi:
691 if(MI->getOperand(MI->getNumOperands()-1).isImm())
692 DecodePSHUFMask(MVT::v4f32,
693 MI->getOperand(MI->getNumOperands()-1).getImm(),
694 ShuffleMask);
695 DestName = getRegName(MI->getOperand(0).getReg());
696 break;
697 case X86::VPERMILPSYri:
698 Src1Name = getRegName(MI->getOperand(1).getReg());
699 // FALL THROUGH.
700 case X86::VPERMILPSYmi:
701 if(MI->getOperand(MI->getNumOperands()-1).isImm())
702 DecodePSHUFMask(MVT::v8f32,
703 MI->getOperand(MI->getNumOperands()-1).getImm(),
704 ShuffleMask);
705 DestName = getRegName(MI->getOperand(0).getReg());
706 break;
707 case X86::VPERMILPDri:
708 Src1Name = getRegName(MI->getOperand(1).getReg());
709 // FALL THROUGH.
710 case X86::VPERMILPDmi:
711 if(MI->getOperand(MI->getNumOperands()-1).isImm())
712 DecodePSHUFMask(MVT::v2f64,
713 MI->getOperand(MI->getNumOperands()-1).getImm(),
714 ShuffleMask);
715 DestName = getRegName(MI->getOperand(0).getReg());
716 break;
717 case X86::VPERMILPDYri:
718 Src1Name = getRegName(MI->getOperand(1).getReg());
719 // FALL THROUGH.
720 case X86::VPERMILPDYmi:
721 if(MI->getOperand(MI->getNumOperands()-1).isImm())
722 DecodePSHUFMask(MVT::v4f64,
723 MI->getOperand(MI->getNumOperands()-1).getImm(),
724 ShuffleMask);
725 DestName = getRegName(MI->getOperand(0).getReg());
726 break;
727 case X86::VPERM2F128rr:
728 case X86::VPERM2I128rr:
729 Src2Name = getRegName(MI->getOperand(2).getReg());
730 // FALL THROUGH.
731 case X86::VPERM2F128rm:
732 case X86::VPERM2I128rm:
733 // For instruction comments purpose, assume the 256-bit vector is v4i64.
734 if(MI->getOperand(MI->getNumOperands()-1).isImm())
735 DecodeVPERM2X128Mask(MVT::v4i64,
736 MI->getOperand(MI->getNumOperands()-1).getImm(),
737 ShuffleMask);
738 Src1Name = getRegName(MI->getOperand(1).getReg());
739 DestName = getRegName(MI->getOperand(0).getReg());
740 break;
741 case X86::VPERMQYri:
742 case X86::VPERMPDYri:
743 Src1Name = getRegName(MI->getOperand(1).getReg());
744 // FALL THROUGH.
745 case X86::VPERMQYmi:
746 case X86::VPERMPDYmi:
747 if(MI->getOperand(MI->getNumOperands()-1).isImm())
748 DecodeVPERMMask(MI->getOperand(MI->getNumOperands()-1).getImm(),
749 ShuffleMask);
750 DestName = getRegName(MI->getOperand(0).getReg());
751 break;
752 }
753
754 // The only comments we decode are shuffles, so give up if we were unable to
755 // decode a shuffle mask.
756 if (ShuffleMask.empty())
757 return false;
758
759 if (!DestName) DestName = Src1Name;
760 OS << (DestName ? DestName : "mem") << " = ";
761
762 // If the two sources are the same, canonicalize the input elements to be
763 // from the first src so that we get larger element spans.
764 if (Src1Name == Src2Name) {
765 for (unsigned i = 0, e = ShuffleMask.size(); i != e; ++i) {
766 if ((int)ShuffleMask[i] >= 0 && // Not sentinel.
767 ShuffleMask[i] >= (int)e) // From second mask.
768 ShuffleMask[i] -= e;
769 }
770 }
771
772 // The shuffle mask specifies which elements of the src1/src2 fill in the
773 // destination, with a few sentinel values. Loop through and print them
774 // out.
775 for (unsigned i = 0, e = ShuffleMask.size(); i != e; ++i) {
776 if (i != 0)
777 OS << ',';
778 if (ShuffleMask[i] == SM_SentinelZero) {
779 OS << "zero";
780 continue;
781 }
782
783 // Otherwise, it must come from src1 or src2. Print the span of elements
784 // that comes from this src.
785 bool isSrc1 = ShuffleMask[i] < (int)ShuffleMask.size();
786 const char *SrcName = isSrc1 ? Src1Name : Src2Name;
787 OS << (SrcName ? SrcName : "mem") << '[';
788 bool IsFirst = true;
789 while (i != e && (int)ShuffleMask[i] != SM_SentinelZero &&
790 (ShuffleMask[i] < (int)ShuffleMask.size()) == isSrc1) {
791 if (!IsFirst)
792 OS << ',';
793 else
794 IsFirst = false;
795 if (ShuffleMask[i] == SM_SentinelUndef)
796 OS << "u";
797 else
798 OS << ShuffleMask[i] % ShuffleMask.size();
799 ++i;
800 }
801 OS << ']';
802 --i; // For loop increments element #.
803 }
804 //MI->print(OS, 0);
805 OS << "\n";
806
807 // We successfully added a comment to this instruction.
808 return true;
809 }
226 DestName = getRegName(MI->getOperand(0).getReg());
227 if(MI->getOperand(MI->getNumOperands()-1).isImm())
228 DecodePSLLDQMask(MVT::v16i8,
229 MI->getOperand(MI->getNumOperands()-1).getImm(),
230 ShuffleMask);
231 break;
232
233 case X86::VPSLLDQYri:
234 Src1Name = getRegName(MI->getOperand(1).getReg());
235 DestName = getRegName(MI->getOperand(0).getReg());
236 if(MI->getOperand(MI->getNumOperands()-1).isImm())
237 DecodePSLLDQMask(MVT::v32i8,
238 MI->getOperand(MI->getNumOperands()-1).getImm(),
239 ShuffleMask);
240 break;
241
242 case X86::PSRLDQri:
243 case X86::VPSRLDQri:
244 Src1Name = getRegName(MI->getOperand(1).getReg());
245 DestName = getRegName(MI->getOperand(0).getReg());
246 if(MI->getOperand(MI->getNumOperands()-1).isImm())
247 DecodePSRLDQMask(MVT::v16i8,
248 MI->getOperand(MI->getNumOperands()-1).getImm(),
249 ShuffleMask);
250 break;
251
252 case X86::VPSRLDQYri:
253 Src1Name = getRegName(MI->getOperand(1).getReg());
254 DestName = getRegName(MI->getOperand(0).getReg());
255 if(MI->getOperand(MI->getNumOperands()-1).isImm())
256 DecodePSRLDQMask(MVT::v32i8,
257 MI->getOperand(MI->getNumOperands()-1).getImm(),
258 ShuffleMask);
259 break;
260
261 case X86::PALIGNR128rr:
262 case X86::VPALIGNR128rr:
263 Src1Name = getRegName(MI->getOperand(2).getReg());
264 // FALL THROUGH.
265 case X86::PALIGNR128rm:
266 case X86::VPALIGNR128rm:
267 Src2Name = getRegName(MI->getOperand(1).getReg());
268 DestName = getRegName(MI->getOperand(0).getReg());
269 if(MI->getOperand(MI->getNumOperands()-1).isImm())
270 DecodePALIGNRMask(MVT::v16i8,
271 MI->getOperand(MI->getNumOperands()-1).getImm(),
272 ShuffleMask);
273 break;
274 case X86::VPALIGNR256rr:
275 Src1Name = getRegName(MI->getOperand(2).getReg());
276 // FALL THROUGH.
277 case X86::VPALIGNR256rm:
278 Src2Name = getRegName(MI->getOperand(1).getReg());
279 DestName = getRegName(MI->getOperand(0).getReg());
280 if(MI->getOperand(MI->getNumOperands()-1).isImm())
281 DecodePALIGNRMask(MVT::v32i8,
282 MI->getOperand(MI->getNumOperands()-1).getImm(),
283 ShuffleMask);
284 break;
285
286 case X86::PSHUFDri:
287 case X86::VPSHUFDri:
288 Src1Name = getRegName(MI->getOperand(1).getReg());
289 // FALL THROUGH.
290 case X86::PSHUFDmi:
291 case X86::VPSHUFDmi:
292 DestName = getRegName(MI->getOperand(0).getReg());
293 if(MI->getOperand(MI->getNumOperands()-1).isImm())
294 DecodePSHUFMask(MVT::v4i32,
295 MI->getOperand(MI->getNumOperands()-1).getImm(),
296 ShuffleMask);
297 break;
298 case X86::VPSHUFDYri:
299 Src1Name = getRegName(MI->getOperand(1).getReg());
300 // FALL THROUGH.
301 case X86::VPSHUFDYmi:
302 DestName = getRegName(MI->getOperand(0).getReg());
303 if(MI->getOperand(MI->getNumOperands()-1).isImm())
304 DecodePSHUFMask(MVT::v8i32,
305 MI->getOperand(MI->getNumOperands()-1).getImm(),
306 ShuffleMask);
307 break;
308
309
310 case X86::PSHUFHWri:
311 case X86::VPSHUFHWri:
312 Src1Name = getRegName(MI->getOperand(1).getReg());
313 // FALL THROUGH.
314 case X86::PSHUFHWmi:
315 case X86::VPSHUFHWmi:
316 DestName = getRegName(MI->getOperand(0).getReg());
317 if(MI->getOperand(MI->getNumOperands()-1).isImm())
318 DecodePSHUFHWMask(MVT::v8i16,
319 MI->getOperand(MI->getNumOperands()-1).getImm(),
320 ShuffleMask);
321 break;
322 case X86::VPSHUFHWYri:
323 Src1Name = getRegName(MI->getOperand(1).getReg());
324 // FALL THROUGH.
325 case X86::VPSHUFHWYmi:
326 DestName = getRegName(MI->getOperand(0).getReg());
327 if(MI->getOperand(MI->getNumOperands()-1).isImm())
328 DecodePSHUFHWMask(MVT::v16i16,
329 MI->getOperand(MI->getNumOperands()-1).getImm(),
330 ShuffleMask);
331 break;
332 case X86::PSHUFLWri:
333 case X86::VPSHUFLWri:
334 Src1Name = getRegName(MI->getOperand(1).getReg());
335 // FALL THROUGH.
336 case X86::PSHUFLWmi:
337 case X86::VPSHUFLWmi:
338 DestName = getRegName(MI->getOperand(0).getReg());
339 if(MI->getOperand(MI->getNumOperands()-1).isImm())
340 DecodePSHUFLWMask(MVT::v8i16,
341 MI->getOperand(MI->getNumOperands()-1).getImm(),
342 ShuffleMask);
343 break;
344 case X86::VPSHUFLWYri:
345 Src1Name = getRegName(MI->getOperand(1).getReg());
346 // FALL THROUGH.
347 case X86::VPSHUFLWYmi:
348 DestName = getRegName(MI->getOperand(0).getReg());
349 if(MI->getOperand(MI->getNumOperands()-1).isImm())
350 DecodePSHUFLWMask(MVT::v16i16,
351 MI->getOperand(MI->getNumOperands()-1).getImm(),
352 ShuffleMask);
353 break;
354
355 case X86::PUNPCKHBWrr:
356 case X86::VPUNPCKHBWrr:
357 Src2Name = getRegName(MI->getOperand(2).getReg());
358 // FALL THROUGH.
359 case X86::PUNPCKHBWrm:
360 case X86::VPUNPCKHBWrm:
361 Src1Name = getRegName(MI->getOperand(1).getReg());
362 DestName = getRegName(MI->getOperand(0).getReg());
363 DecodeUNPCKHMask(MVT::v16i8, ShuffleMask);
364 break;
365 case X86::VPUNPCKHBWYrr:
366 Src2Name = getRegName(MI->getOperand(2).getReg());
367 // FALL THROUGH.
368 case X86::VPUNPCKHBWYrm:
369 Src1Name = getRegName(MI->getOperand(1).getReg());
370 DestName = getRegName(MI->getOperand(0).getReg());
371 DecodeUNPCKHMask(MVT::v32i8, ShuffleMask);
372 break;
373 case X86::PUNPCKHWDrr:
374 case X86::VPUNPCKHWDrr:
375 Src2Name = getRegName(MI->getOperand(2).getReg());
376 // FALL THROUGH.
377 case X86::PUNPCKHWDrm:
378 case X86::VPUNPCKHWDrm:
379 Src1Name = getRegName(MI->getOperand(1).getReg());
380 DestName = getRegName(MI->getOperand(0).getReg());
381 DecodeUNPCKHMask(MVT::v8i16, ShuffleMask);
382 break;
383 case X86::VPUNPCKHWDYrr:
384 Src2Name = getRegName(MI->getOperand(2).getReg());
385 // FALL THROUGH.
386 case X86::VPUNPCKHWDYrm:
387 Src1Name = getRegName(MI->getOperand(1).getReg());
388 DestName = getRegName(MI->getOperand(0).getReg());
389 DecodeUNPCKHMask(MVT::v16i16, ShuffleMask);
390 break;
391 case X86::PUNPCKHDQrr:
392 case X86::VPUNPCKHDQrr:
393 Src2Name = getRegName(MI->getOperand(2).getReg());
394 // FALL THROUGH.
395 case X86::PUNPCKHDQrm:
396 case X86::VPUNPCKHDQrm:
397 Src1Name = getRegName(MI->getOperand(1).getReg());
398 DestName = getRegName(MI->getOperand(0).getReg());
399 DecodeUNPCKHMask(MVT::v4i32, ShuffleMask);
400 break;
401 case X86::VPUNPCKHDQYrr:
402 Src2Name = getRegName(MI->getOperand(2).getReg());
403 // FALL THROUGH.
404 case X86::VPUNPCKHDQYrm:
405 Src1Name = getRegName(MI->getOperand(1).getReg());
406 DestName = getRegName(MI->getOperand(0).getReg());
407 DecodeUNPCKHMask(MVT::v8i32, ShuffleMask);
408 break;
409 case X86::VPUNPCKHDQZrr:
410 Src2Name = getRegName(MI->getOperand(2).getReg());
411 // FALL THROUGH.
412 case X86::VPUNPCKHDQZrm:
413 Src1Name = getRegName(MI->getOperand(1).getReg());
414 DestName = getRegName(MI->getOperand(0).getReg());
415 DecodeUNPCKHMask(MVT::v16i32, ShuffleMask);
416 break;
417 case X86::PUNPCKHQDQrr:
418 case X86::VPUNPCKHQDQrr:
419 Src2Name = getRegName(MI->getOperand(2).getReg());
420 // FALL THROUGH.
421 case X86::PUNPCKHQDQrm:
422 case X86::VPUNPCKHQDQrm:
423 Src1Name = getRegName(MI->getOperand(1).getReg());
424 DestName = getRegName(MI->getOperand(0).getReg());
425 DecodeUNPCKHMask(MVT::v2i64, ShuffleMask);
426 break;
427 case X86::VPUNPCKHQDQYrr:
428 Src2Name = getRegName(MI->getOperand(2).getReg());
429 // FALL THROUGH.
430 case X86::VPUNPCKHQDQYrm:
431 Src1Name = getRegName(MI->getOperand(1).getReg());
432 DestName = getRegName(MI->getOperand(0).getReg());
433 DecodeUNPCKHMask(MVT::v4i64, ShuffleMask);
434 break;
435 case X86::VPUNPCKHQDQZrr:
436 Src2Name = getRegName(MI->getOperand(2).getReg());
437 // FALL THROUGH.
438 case X86::VPUNPCKHQDQZrm:
439 Src1Name = getRegName(MI->getOperand(1).getReg());
440 DestName = getRegName(MI->getOperand(0).getReg());
441 DecodeUNPCKHMask(MVT::v8i64, ShuffleMask);
442 break;
443
444 case X86::PUNPCKLBWrr:
445 case X86::VPUNPCKLBWrr:
446 Src2Name = getRegName(MI->getOperand(2).getReg());
447 // FALL THROUGH.
448 case X86::PUNPCKLBWrm:
449 case X86::VPUNPCKLBWrm:
450 Src1Name = getRegName(MI->getOperand(1).getReg());
451 DestName = getRegName(MI->getOperand(0).getReg());
452 DecodeUNPCKLMask(MVT::v16i8, ShuffleMask);
453 break;
454 case X86::VPUNPCKLBWYrr:
455 Src2Name = getRegName(MI->getOperand(2).getReg());
456 // FALL THROUGH.
457 case X86::VPUNPCKLBWYrm:
458 Src1Name = getRegName(MI->getOperand(1).getReg());
459 DestName = getRegName(MI->getOperand(0).getReg());
460 DecodeUNPCKLMask(MVT::v32i8, ShuffleMask);
461 break;
462 case X86::PUNPCKLWDrr:
463 case X86::VPUNPCKLWDrr:
464 Src2Name = getRegName(MI->getOperand(2).getReg());
465 // FALL THROUGH.
466 case X86::PUNPCKLWDrm:
467 case X86::VPUNPCKLWDrm:
468 Src1Name = getRegName(MI->getOperand(1).getReg());
469 DestName = getRegName(MI->getOperand(0).getReg());
470 DecodeUNPCKLMask(MVT::v8i16, ShuffleMask);
471 break;
472 case X86::VPUNPCKLWDYrr:
473 Src2Name = getRegName(MI->getOperand(2).getReg());
474 // FALL THROUGH.
475 case X86::VPUNPCKLWDYrm:
476 Src1Name = getRegName(MI->getOperand(1).getReg());
477 DestName = getRegName(MI->getOperand(0).getReg());
478 DecodeUNPCKLMask(MVT::v16i16, ShuffleMask);
479 break;
480 case X86::PUNPCKLDQrr:
481 case X86::VPUNPCKLDQrr:
482 Src2Name = getRegName(MI->getOperand(2).getReg());
483 // FALL THROUGH.
484 case X86::PUNPCKLDQrm:
485 case X86::VPUNPCKLDQrm:
486 Src1Name = getRegName(MI->getOperand(1).getReg());
487 DestName = getRegName(MI->getOperand(0).getReg());
488 DecodeUNPCKLMask(MVT::v4i32, ShuffleMask);
489 break;
490 case X86::VPUNPCKLDQYrr:
491 Src2Name = getRegName(MI->getOperand(2).getReg());
492 // FALL THROUGH.
493 case X86::VPUNPCKLDQYrm:
494 Src1Name = getRegName(MI->getOperand(1).getReg());
495 DestName = getRegName(MI->getOperand(0).getReg());
496 DecodeUNPCKLMask(MVT::v8i32, ShuffleMask);
497 break;
498 case X86::VPUNPCKLDQZrr:
499 Src2Name = getRegName(MI->getOperand(2).getReg());
500 // FALL THROUGH.
501 case X86::VPUNPCKLDQZrm:
502 Src1Name = getRegName(MI->getOperand(1).getReg());
503 DestName = getRegName(MI->getOperand(0).getReg());
504 DecodeUNPCKLMask(MVT::v16i32, ShuffleMask);
505 break;
506 case X86::PUNPCKLQDQrr:
507 case X86::VPUNPCKLQDQrr:
508 Src2Name = getRegName(MI->getOperand(2).getReg());
509 // FALL THROUGH.
510 case X86::PUNPCKLQDQrm:
511 case X86::VPUNPCKLQDQrm:
512 Src1Name = getRegName(MI->getOperand(1).getReg());
513 DestName = getRegName(MI->getOperand(0).getReg());
514 DecodeUNPCKLMask(MVT::v2i64, ShuffleMask);
515 break;
516 case X86::VPUNPCKLQDQYrr:
517 Src2Name = getRegName(MI->getOperand(2).getReg());
518 // FALL THROUGH.
519 case X86::VPUNPCKLQDQYrm:
520 Src1Name = getRegName(MI->getOperand(1).getReg());
521 DestName = getRegName(MI->getOperand(0).getReg());
522 DecodeUNPCKLMask(MVT::v4i64, ShuffleMask);
523 break;
524 case X86::VPUNPCKLQDQZrr:
525 Src2Name = getRegName(MI->getOperand(2).getReg());
526 // FALL THROUGH.
527 case X86::VPUNPCKLQDQZrm:
528 Src1Name = getRegName(MI->getOperand(1).getReg());
529 DestName = getRegName(MI->getOperand(0).getReg());
530 DecodeUNPCKLMask(MVT::v8i64, ShuffleMask);
531 break;
532
533 case X86::SHUFPDrri:
534 case X86::VSHUFPDrri:
535 Src2Name = getRegName(MI->getOperand(2).getReg());
536 // FALL THROUGH.
537 case X86::SHUFPDrmi:
538 case X86::VSHUFPDrmi:
539 if(MI->getOperand(MI->getNumOperands()-1).isImm())
540 DecodeSHUFPMask(MVT::v2f64,
541 MI->getOperand(MI->getNumOperands()-1).getImm(),
542 ShuffleMask);
543 Src1Name = getRegName(MI->getOperand(1).getReg());
544 DestName = getRegName(MI->getOperand(0).getReg());
545 break;
546 case X86::VSHUFPDYrri:
547 Src2Name = getRegName(MI->getOperand(2).getReg());
548 // FALL THROUGH.
549 case X86::VSHUFPDYrmi:
550 if(MI->getOperand(MI->getNumOperands()-1).isImm())
551 DecodeSHUFPMask(MVT::v4f64,
552 MI->getOperand(MI->getNumOperands()-1).getImm(),
553 ShuffleMask);
554 Src1Name = getRegName(MI->getOperand(1).getReg());
555 DestName = getRegName(MI->getOperand(0).getReg());
556 break;
557
558 case X86::SHUFPSrri:
559 case X86::VSHUFPSrri:
560 Src2Name = getRegName(MI->getOperand(2).getReg());
561 // FALL THROUGH.
562 case X86::SHUFPSrmi:
563 case X86::VSHUFPSrmi:
564 if(MI->getOperand(MI->getNumOperands()-1).isImm())
565 DecodeSHUFPMask(MVT::v4f32,
566 MI->getOperand(MI->getNumOperands()-1).getImm(),
567 ShuffleMask);
568 Src1Name = getRegName(MI->getOperand(1).getReg());
569 DestName = getRegName(MI->getOperand(0).getReg());
570 break;
571 case X86::VSHUFPSYrri:
572 Src2Name = getRegName(MI->getOperand(2).getReg());
573 // FALL THROUGH.
574 case X86::VSHUFPSYrmi:
575 if(MI->getOperand(MI->getNumOperands()-1).isImm())
576 DecodeSHUFPMask(MVT::v8f32,
577 MI->getOperand(MI->getNumOperands()-1).getImm(),
578 ShuffleMask);
579 Src1Name = getRegName(MI->getOperand(1).getReg());
580 DestName = getRegName(MI->getOperand(0).getReg());
581 break;
582
583 case X86::UNPCKLPDrr:
584 case X86::VUNPCKLPDrr:
585 Src2Name = getRegName(MI->getOperand(2).getReg());
586 // FALL THROUGH.
587 case X86::UNPCKLPDrm:
588 case X86::VUNPCKLPDrm:
589 DecodeUNPCKLMask(MVT::v2f64, ShuffleMask);
590 Src1Name = getRegName(MI->getOperand(1).getReg());
591 DestName = getRegName(MI->getOperand(0).getReg());
592 break;
593 case X86::VUNPCKLPDYrr:
594 Src2Name = getRegName(MI->getOperand(2).getReg());
595 // FALL THROUGH.
596 case X86::VUNPCKLPDYrm:
597 DecodeUNPCKLMask(MVT::v4f64, ShuffleMask);
598 Src1Name = getRegName(MI->getOperand(1).getReg());
599 DestName = getRegName(MI->getOperand(0).getReg());
600 break;
601 case X86::VUNPCKLPDZrr:
602 Src2Name = getRegName(MI->getOperand(2).getReg());
603 // FALL THROUGH.
604 case X86::VUNPCKLPDZrm:
605 DecodeUNPCKLMask(MVT::v8f64, ShuffleMask);
606 Src1Name = getRegName(MI->getOperand(1).getReg());
607 DestName = getRegName(MI->getOperand(0).getReg());
608 break;
609 case X86::UNPCKLPSrr:
610 case X86::VUNPCKLPSrr:
611 Src2Name = getRegName(MI->getOperand(2).getReg());
612 // FALL THROUGH.
613 case X86::UNPCKLPSrm:
614 case X86::VUNPCKLPSrm:
615 DecodeUNPCKLMask(MVT::v4f32, ShuffleMask);
616 Src1Name = getRegName(MI->getOperand(1).getReg());
617 DestName = getRegName(MI->getOperand(0).getReg());
618 break;
619 case X86::VUNPCKLPSYrr:
620 Src2Name = getRegName(MI->getOperand(2).getReg());
621 // FALL THROUGH.
622 case X86::VUNPCKLPSYrm:
623 DecodeUNPCKLMask(MVT::v8f32, ShuffleMask);
624 Src1Name = getRegName(MI->getOperand(1).getReg());
625 DestName = getRegName(MI->getOperand(0).getReg());
626 break;
627 case X86::VUNPCKLPSZrr:
628 Src2Name = getRegName(MI->getOperand(2).getReg());
629 // FALL THROUGH.
630 case X86::VUNPCKLPSZrm:
631 DecodeUNPCKLMask(MVT::v16f32, ShuffleMask);
632 Src1Name = getRegName(MI->getOperand(1).getReg());
633 DestName = getRegName(MI->getOperand(0).getReg());
634 break;
635 case X86::UNPCKHPDrr:
636 case X86::VUNPCKHPDrr:
637 Src2Name = getRegName(MI->getOperand(2).getReg());
638 // FALL THROUGH.
639 case X86::UNPCKHPDrm:
640 case X86::VUNPCKHPDrm:
641 DecodeUNPCKHMask(MVT::v2f64, ShuffleMask);
642 Src1Name = getRegName(MI->getOperand(1).getReg());
643 DestName = getRegName(MI->getOperand(0).getReg());
644 break;
645 case X86::VUNPCKHPDYrr:
646 Src2Name = getRegName(MI->getOperand(2).getReg());
647 // FALL THROUGH.
648 case X86::VUNPCKHPDYrm:
649 DecodeUNPCKHMask(MVT::v4f64, ShuffleMask);
650 Src1Name = getRegName(MI->getOperand(1).getReg());
651 DestName = getRegName(MI->getOperand(0).getReg());
652 break;
653 case X86::VUNPCKHPDZrr:
654 Src2Name = getRegName(MI->getOperand(2).getReg());
655 // FALL THROUGH.
656 case X86::VUNPCKHPDZrm:
657 DecodeUNPCKHMask(MVT::v8f64, ShuffleMask);
658 Src1Name = getRegName(MI->getOperand(1).getReg());
659 DestName = getRegName(MI->getOperand(0).getReg());
660 break;
661 case X86::UNPCKHPSrr:
662 case X86::VUNPCKHPSrr:
663 Src2Name = getRegName(MI->getOperand(2).getReg());
664 // FALL THROUGH.
665 case X86::UNPCKHPSrm:
666 case X86::VUNPCKHPSrm:
667 DecodeUNPCKHMask(MVT::v4f32, ShuffleMask);
668 Src1Name = getRegName(MI->getOperand(1).getReg());
669 DestName = getRegName(MI->getOperand(0).getReg());
670 break;
671 case X86::VUNPCKHPSYrr:
672 Src2Name = getRegName(MI->getOperand(2).getReg());
673 // FALL THROUGH.
674 case X86::VUNPCKHPSYrm:
675 DecodeUNPCKHMask(MVT::v8f32, ShuffleMask);
676 Src1Name = getRegName(MI->getOperand(1).getReg());
677 DestName = getRegName(MI->getOperand(0).getReg());
678 break;
679 case X86::VUNPCKHPSZrr:
680 Src2Name = getRegName(MI->getOperand(2).getReg());
681 // FALL THROUGH.
682 case X86::VUNPCKHPSZrm:
683 DecodeUNPCKHMask(MVT::v16f32, ShuffleMask);
684 Src1Name = getRegName(MI->getOperand(1).getReg());
685 DestName = getRegName(MI->getOperand(0).getReg());
686 break;
687 case X86::VPERMILPSri:
688 Src1Name = getRegName(MI->getOperand(1).getReg());
689 // FALL THROUGH.
690 case X86::VPERMILPSmi:
691 if(MI->getOperand(MI->getNumOperands()-1).isImm())
692 DecodePSHUFMask(MVT::v4f32,
693 MI->getOperand(MI->getNumOperands()-1).getImm(),
694 ShuffleMask);
695 DestName = getRegName(MI->getOperand(0).getReg());
696 break;
697 case X86::VPERMILPSYri:
698 Src1Name = getRegName(MI->getOperand(1).getReg());
699 // FALL THROUGH.
700 case X86::VPERMILPSYmi:
701 if(MI->getOperand(MI->getNumOperands()-1).isImm())
702 DecodePSHUFMask(MVT::v8f32,
703 MI->getOperand(MI->getNumOperands()-1).getImm(),
704 ShuffleMask);
705 DestName = getRegName(MI->getOperand(0).getReg());
706 break;
707 case X86::VPERMILPDri:
708 Src1Name = getRegName(MI->getOperand(1).getReg());
709 // FALL THROUGH.
710 case X86::VPERMILPDmi:
711 if(MI->getOperand(MI->getNumOperands()-1).isImm())
712 DecodePSHUFMask(MVT::v2f64,
713 MI->getOperand(MI->getNumOperands()-1).getImm(),
714 ShuffleMask);
715 DestName = getRegName(MI->getOperand(0).getReg());
716 break;
717 case X86::VPERMILPDYri:
718 Src1Name = getRegName(MI->getOperand(1).getReg());
719 // FALL THROUGH.
720 case X86::VPERMILPDYmi:
721 if(MI->getOperand(MI->getNumOperands()-1).isImm())
722 DecodePSHUFMask(MVT::v4f64,
723 MI->getOperand(MI->getNumOperands()-1).getImm(),
724 ShuffleMask);
725 DestName = getRegName(MI->getOperand(0).getReg());
726 break;
727 case X86::VPERM2F128rr:
728 case X86::VPERM2I128rr:
729 Src2Name = getRegName(MI->getOperand(2).getReg());
730 // FALL THROUGH.
731 case X86::VPERM2F128rm:
732 case X86::VPERM2I128rm:
733 // For instruction comments purpose, assume the 256-bit vector is v4i64.
734 if(MI->getOperand(MI->getNumOperands()-1).isImm())
735 DecodeVPERM2X128Mask(MVT::v4i64,
736 MI->getOperand(MI->getNumOperands()-1).getImm(),
737 ShuffleMask);
738 Src1Name = getRegName(MI->getOperand(1).getReg());
739 DestName = getRegName(MI->getOperand(0).getReg());
740 break;
741 case X86::VPERMQYri:
742 case X86::VPERMPDYri:
743 Src1Name = getRegName(MI->getOperand(1).getReg());
744 // FALL THROUGH.
745 case X86::VPERMQYmi:
746 case X86::VPERMPDYmi:
747 if(MI->getOperand(MI->getNumOperands()-1).isImm())
748 DecodeVPERMMask(MI->getOperand(MI->getNumOperands()-1).getImm(),
749 ShuffleMask);
750 DestName = getRegName(MI->getOperand(0).getReg());
751 break;
752 }
753
754 // The only comments we decode are shuffles, so give up if we were unable to
755 // decode a shuffle mask.
756 if (ShuffleMask.empty())
757 return false;
758
759 if (!DestName) DestName = Src1Name;
760 OS << (DestName ? DestName : "mem") << " = ";
761
762 // If the two sources are the same, canonicalize the input elements to be
763 // from the first src so that we get larger element spans.
764 if (Src1Name == Src2Name) {
765 for (unsigned i = 0, e = ShuffleMask.size(); i != e; ++i) {
766 if ((int)ShuffleMask[i] >= 0 && // Not sentinel.
767 ShuffleMask[i] >= (int)e) // From second mask.
768 ShuffleMask[i] -= e;
769 }
770 }
771
772 // The shuffle mask specifies which elements of the src1/src2 fill in the
773 // destination, with a few sentinel values. Loop through and print them
774 // out.
775 for (unsigned i = 0, e = ShuffleMask.size(); i != e; ++i) {
776 if (i != 0)
777 OS << ',';
778 if (ShuffleMask[i] == SM_SentinelZero) {
779 OS << "zero";
780 continue;
781 }
782
783 // Otherwise, it must come from src1 or src2. Print the span of elements
784 // that comes from this src.
785 bool isSrc1 = ShuffleMask[i] < (int)ShuffleMask.size();
786 const char *SrcName = isSrc1 ? Src1Name : Src2Name;
787 OS << (SrcName ? SrcName : "mem") << '[';
788 bool IsFirst = true;
789 while (i != e && (int)ShuffleMask[i] != SM_SentinelZero &&
790 (ShuffleMask[i] < (int)ShuffleMask.size()) == isSrc1) {
791 if (!IsFirst)
792 OS << ',';
793 else
794 IsFirst = false;
795 if (ShuffleMask[i] == SM_SentinelUndef)
796 OS << "u";
797 else
798 OS << ShuffleMask[i] % ShuffleMask.size();
799 ++i;
800 }
801 OS << ']';
802 --i; // For loop increments element #.
803 }
804 //MI->print(OS, 0);
805 OS << "\n";
806
807 // We successfully added a comment to this instruction.
808 return true;
809 }