Line data Source code
1 : // Copyright 2011 the V8 project authors. All rights reserved.
2 : // Redistribution and use in source and binary forms, with or without
3 : // modification, are permitted provided that the following conditions are
4 : // met:
5 : //
6 : // * Redistributions of source code must retain the above copyright
7 : // notice, this list of conditions and the following disclaimer.
8 : // * Redistributions in binary form must reproduce the above
9 : // copyright notice, this list of conditions and the following
10 : // disclaimer in the documentation and/or other materials provided
11 : // with the distribution.
12 : // * Neither the name of Google Inc. nor the names of its
13 : // contributors may be used to endorse or promote products derived
14 : // from this software without specific prior written permission.
15 : //
16 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 : // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 :
28 : #include <stdlib.h>
29 :
30 : #include "src/v8.h"
31 :
32 : #include "src/code-factory.h"
33 : #include "src/debug/debug.h"
34 : #include "src/disasm.h"
35 : #include "src/disassembler.h"
36 : #include "src/frames-inl.h"
37 : #include "src/macro-assembler.h"
38 : #include "src/objects-inl.h"
39 : #include "src/ostreams.h"
40 : #include "test/cctest/cctest.h"
41 :
42 : namespace v8 {
43 : namespace internal {
44 :
45 : #define __ assm.
46 :
47 26644 : TEST(DisasmX64) {
48 5 : CcTest::InitializeVM();
49 : Isolate* isolate = CcTest::i_isolate();
50 : HandleScope scope(isolate);
51 : v8::internal::byte buffer[8192];
52 : Assembler assm(AssemblerOptions{},
53 20 : ExternalAssemblerBuffer(buffer, sizeof buffer));
54 :
55 : // Short immediate instructions
56 : __ addq(rax, Immediate(12345678));
57 : __ orq(rax, Immediate(12345678));
58 : __ subq(rax, Immediate(12345678));
59 : __ xorq(rax, Immediate(12345678));
60 : __ andq(rax, Immediate(12345678));
61 :
62 : // ---- This one caused crash
63 10 : __ movq(rbx, Operand(rsp, rcx, times_2, 0)); // [rsp+rcx*4]
64 :
65 : // ---- All instructions that I can think of
66 : __ addq(rdx, rbx);
67 5 : __ addq(rdx, Operand(rbx, 0));
68 5 : __ addq(rdx, Operand(rbx, 16));
69 5 : __ addq(rdx, Operand(rbx, 1999));
70 5 : __ addq(rdx, Operand(rbx, -4));
71 5 : __ addq(rdx, Operand(rbx, -1999));
72 5 : __ addq(rdx, Operand(rsp, 0));
73 5 : __ addq(rdx, Operand(rsp, 16));
74 5 : __ addq(rdx, Operand(rsp, 1999));
75 5 : __ addq(rdx, Operand(rsp, -4));
76 5 : __ addq(rdx, Operand(rsp, -1999));
77 5 : __ nop();
78 5 : __ addq(rsi, Operand(rcx, times_4, 0));
79 5 : __ addq(rsi, Operand(rcx, times_4, 24));
80 5 : __ addq(rsi, Operand(rcx, times_4, -4));
81 5 : __ addq(rsi, Operand(rcx, times_4, -1999));
82 5 : __ nop();
83 5 : __ addq(rdi, Operand(rbp, rcx, times_4, 0));
84 5 : __ addq(rdi, Operand(rbp, rcx, times_4, 12));
85 5 : __ addq(rdi, Operand(rbp, rcx, times_4, -8));
86 5 : __ addq(rdi, Operand(rbp, rcx, times_4, -3999));
87 5 : __ addq(Operand(rbp, rcx, times_4, 12), Immediate(12));
88 :
89 5 : __ bswapl(rax);
90 5 : __ bswapq(rdi);
91 5 : __ bsrl(rax, r15);
92 5 : __ bsrl(r9, Operand(rcx, times_8, 91919));
93 :
94 5 : __ nop();
95 : __ addq(rbx, Immediate(12));
96 5 : __ nop();
97 5 : __ nop();
98 : __ andq(rdx, Immediate(3));
99 5 : __ andq(rdx, Operand(rsp, 4));
100 : __ cmpq(rdx, Immediate(3));
101 5 : __ cmpq(rdx, Operand(rsp, 4));
102 5 : __ cmpq(Operand(rbp, rcx, times_4, 0), Immediate(1000));
103 10 : __ cmpb(rbx, Operand(rbp, rcx, times_2, 0));
104 10 : __ cmpb(Operand(rbp, rcx, times_2, 0), rbx);
105 : __ orq(rdx, Immediate(3));
106 : __ xorq(rdx, Immediate(3));
107 5 : __ nop();
108 5 : __ cpuid();
109 5 : __ movsxbl(rdx, Operand(rcx, 0));
110 5 : __ movsxbq(rdx, Operand(rcx, 0));
111 5 : __ movsxwl(rdx, Operand(rcx, 0));
112 5 : __ movsxwq(rdx, Operand(rcx, 0));
113 10 : __ movzxbl(rdx, Operand(rcx, 0));
114 10 : __ movzxwl(rdx, Operand(rcx, 0));
115 10 : __ movzxbq(rdx, Operand(rcx, 0));
116 10 : __ movzxwq(rdx, Operand(rcx, 0));
117 :
118 5 : __ nop();
119 : __ imulq(rdx, rcx);
120 5 : __ shld(rdx, rcx);
121 5 : __ shrd(rdx, rcx);
122 10 : __ shlq(Operand(rdi, rax, times_4, 100), Immediate(1));
123 10 : __ shlq(Operand(rdi, rax, times_4, 100), Immediate(6));
124 10 : __ shlq(Operand(r15, 0), Immediate(1));
125 10 : __ shlq(Operand(r15, 0), Immediate(6));
126 10 : __ shlq_cl(Operand(r15, 0));
127 10 : __ shlq_cl(Operand(r15, 0));
128 10 : __ shlq_cl(Operand(rdi, rax, times_4, 100));
129 10 : __ shlq_cl(Operand(rdi, rax, times_4, 100));
130 : __ shlq(rdx, Immediate(1));
131 : __ shlq(rdx, Immediate(6));
132 10 : __ shll(Operand(rdi, rax, times_4, 100), Immediate(1));
133 10 : __ shll(Operand(rdi, rax, times_4, 100), Immediate(6));
134 10 : __ shll(Operand(r15, 0), Immediate(1));
135 10 : __ shll(Operand(r15, 0), Immediate(6));
136 10 : __ shll_cl(Operand(r15, 0));
137 10 : __ shll_cl(Operand(r15, 0));
138 10 : __ shll_cl(Operand(rdi, rax, times_4, 100));
139 10 : __ shll_cl(Operand(rdi, rax, times_4, 100));
140 : __ shll(rdx, Immediate(1));
141 : __ shll(rdx, Immediate(6));
142 5 : __ btq(Operand(rdx, 0), rcx);
143 5 : __ btsq(Operand(rdx, 0), rcx);
144 5 : __ btsq(Operand(rbx, rcx, times_4, 0), rcx);
145 5 : __ btsq(rcx, Immediate(13));
146 5 : __ btrq(rcx, Immediate(13));
147 5 : __ nop();
148 5 : __ pushq(Immediate(12));
149 5 : __ pushq(Immediate(23456));
150 5 : __ pushq(rcx);
151 5 : __ pushq(rsi);
152 5 : __ pushq(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
153 5 : __ pushq(Operand(rbx, rcx, times_4, 0));
154 5 : __ pushq(Operand(rbx, rcx, times_4, 0));
155 5 : __ pushq(Operand(rbx, rcx, times_4, 10000));
156 5 : __ popq(rdx);
157 5 : __ popq(rax);
158 5 : __ popq(Operand(rbx, rcx, times_4, 0));
159 5 : __ nop();
160 :
161 5 : __ addq(rdx, Operand(rsp, 16));
162 : __ addq(rdx, rcx);
163 5 : __ movb(rdx, Operand(rcx, 0));
164 5 : __ movb(rcx, Immediate(6));
165 5 : __ movb(Operand(rsp, 16), rdx);
166 5 : __ movw(Operand(rsp, 16), rdx);
167 5 : __ nop();
168 5 : __ movsxwq(rdx, Operand(rsp, 12));
169 5 : __ movsxbq(rdx, Operand(rsp, 12));
170 5 : __ movsxlq(rdx, Operand(rsp, 12));
171 10 : __ movzxwq(rdx, Operand(rsp, 12));
172 10 : __ movzxbq(rdx, Operand(rsp, 12));
173 5 : __ nop();
174 : __ movq(rdx, Immediate(1234567));
175 10 : __ movq(rdx, Operand(rsp, 12));
176 10 : __ movq(Operand(rbx, rcx, times_4, 10000), Immediate(12345));
177 10 : __ movq(Operand(rbx, rcx, times_4, 10000), rdx);
178 5 : __ nop();
179 5 : __ decb(rdx);
180 5 : __ decb(Operand(rax, 10));
181 5 : __ decb(Operand(rbx, rcx, times_4, 10000));
182 : __ decq(rdx);
183 5 : __ cdq();
184 :
185 5 : __ nop();
186 : __ idivq(rdx);
187 5 : __ mull(rdx);
188 5 : __ mulq(rdx);
189 : __ negq(rdx);
190 : __ notq(rdx);
191 10 : __ testq(Operand(rbx, rcx, times_4, 10000), rdx);
192 :
193 : __ imulq(rdx, rcx, Immediate(12));
194 : __ imulq(rdx, rcx, Immediate(1000));
195 10 : __ imulq(rdx, Operand(rbx, rcx, times_4, 10000));
196 10 : __ imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(12));
197 10 : __ imulq(rdx, Operand(rbx, rcx, times_4, 10000), Immediate(1000));
198 : __ imull(r15, rcx, Immediate(12));
199 : __ imull(r15, rcx, Immediate(1000));
200 10 : __ imull(r15, Operand(rbx, rcx, times_4, 10000));
201 10 : __ imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(12));
202 10 : __ imull(r15, Operand(rbx, rcx, times_4, 10000), Immediate(1000));
203 :
204 : __ incq(rdx);
205 10 : __ incq(Operand(rbx, rcx, times_4, 10000));
206 5 : __ pushq(Operand(rbx, rcx, times_4, 10000));
207 5 : __ popq(Operand(rbx, rcx, times_4, 10000));
208 5 : __ jmp(Operand(rbx, rcx, times_4, 10000));
209 :
210 10 : __ leaq(rdx, Operand(rbx, rcx, times_4, 10000));
211 : __ orq(rdx, Immediate(12345));
212 5 : __ orq(rdx, Operand(rbx, rcx, times_4, 10000));
213 :
214 5 : __ nop();
215 :
216 : __ rclq(rdx, Immediate(1));
217 : __ rclq(rdx, Immediate(7));
218 : __ rcrq(rdx, Immediate(1));
219 : __ rcrq(rdx, Immediate(7));
220 : __ sarq(rdx, Immediate(1));
221 : __ sarq(rdx, Immediate(6));
222 : __ sarq_cl(rdx);
223 : __ sbbq(rdx, rbx);
224 5 : __ shld(rdx, rbx);
225 : __ shlq(rdx, Immediate(1));
226 : __ shlq(rdx, Immediate(6));
227 : __ shlq_cl(rdx);
228 5 : __ shrd(rdx, rbx);
229 : __ shrq(rdx, Immediate(1));
230 : __ shrq(rdx, Immediate(7));
231 : __ shrq_cl(rdx);
232 :
233 :
234 : // Immediates
235 :
236 : __ addq(rbx, Immediate(12));
237 5 : __ addq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
238 :
239 : __ andq(rbx, Immediate(12345));
240 :
241 : __ cmpq(rbx, Immediate(12345));
242 : __ cmpq(rbx, Immediate(12));
243 5 : __ cmpq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
244 : __ cmpb(rax, Immediate(100));
245 :
246 : __ orq(rbx, Immediate(12345));
247 :
248 : __ subq(rbx, Immediate(12));
249 5 : __ subq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
250 :
251 : __ xorq(rbx, Immediate(12345));
252 :
253 : __ imulq(rdx, rcx, Immediate(12));
254 : __ imulq(rdx, rcx, Immediate(1000));
255 :
256 5 : __ cld();
257 :
258 5 : __ subq(rdx, Operand(rbx, rcx, times_4, 10000));
259 : __ subq(rdx, rbx);
260 :
261 : __ testq(rdx, Immediate(12345));
262 10 : __ testq(Operand(rbx, rcx, times_8, 10000), rdx);
263 5 : __ testb(Operand(rcx, rbx, times_2, 1000), rdx);
264 5 : __ testb(Operand(rax, -20), Immediate(0x9A));
265 5 : __ nop();
266 :
267 : __ xorq(rdx, Immediate(12345));
268 5 : __ xorq(rdx, Operand(rbx, rcx, times_8, 10000));
269 5 : __ pshufw(xmm5, xmm1, 3);
270 5 : __ hlt();
271 5 : __ int3();
272 5 : __ ret(0);
273 5 : __ ret(8);
274 :
275 : // Calls
276 :
277 5 : Label L1, L2;
278 5 : __ bind(&L1);
279 5 : __ nop();
280 5 : __ call(&L1);
281 5 : __ call(&L2);
282 5 : __ nop();
283 5 : __ bind(&L2);
284 : // TODO(mstarzinger): The following is protected.
285 : // __ call(Operand(rbx, rcx, times_4, 10000));
286 5 : __ nop();
287 5 : Handle<Code> ic = BUILTIN_CODE(isolate, LoadIC);
288 5 : __ call(ic, RelocInfo::CODE_TARGET);
289 5 : __ nop();
290 5 : __ nop();
291 :
292 5 : __ jmp(&L1);
293 5 : __ jmp(Operand(rbx, rcx, times_4, 10000));
294 5 : __ jmp(ic, RelocInfo::CODE_TARGET);
295 5 : __ nop();
296 :
297 :
298 5 : Label Ljcc;
299 5 : __ nop();
300 : // long jumps
301 5 : __ j(overflow, &Ljcc);
302 5 : __ j(no_overflow, &Ljcc);
303 5 : __ j(below, &Ljcc);
304 5 : __ j(above_equal, &Ljcc);
305 5 : __ j(equal, &Ljcc);
306 5 : __ j(not_equal, &Ljcc);
307 5 : __ j(below_equal, &Ljcc);
308 5 : __ j(above, &Ljcc);
309 5 : __ j(sign, &Ljcc);
310 5 : __ j(not_sign, &Ljcc);
311 5 : __ j(parity_even, &Ljcc);
312 5 : __ j(parity_odd, &Ljcc);
313 5 : __ j(less, &Ljcc);
314 5 : __ j(greater_equal, &Ljcc);
315 5 : __ j(less_equal, &Ljcc);
316 5 : __ j(greater, &Ljcc);
317 5 : __ nop();
318 5 : __ bind(&Ljcc);
319 : // short jumps
320 5 : __ j(overflow, &Ljcc);
321 5 : __ j(no_overflow, &Ljcc);
322 5 : __ j(below, &Ljcc);
323 5 : __ j(above_equal, &Ljcc);
324 5 : __ j(equal, &Ljcc);
325 5 : __ j(not_equal, &Ljcc);
326 5 : __ j(below_equal, &Ljcc);
327 5 : __ j(above, &Ljcc);
328 5 : __ j(sign, &Ljcc);
329 5 : __ j(not_sign, &Ljcc);
330 5 : __ j(parity_even, &Ljcc);
331 5 : __ j(parity_odd, &Ljcc);
332 5 : __ j(less, &Ljcc);
333 5 : __ j(greater_equal, &Ljcc);
334 5 : __ j(less_equal, &Ljcc);
335 5 : __ j(greater, &Ljcc);
336 :
337 : // 0xD9 instructions
338 5 : __ nop();
339 :
340 5 : __ fld(1);
341 5 : __ fld1();
342 5 : __ fldz();
343 5 : __ fldpi();
344 5 : __ fabs();
345 5 : __ fchs();
346 5 : __ fprem();
347 5 : __ fprem1();
348 5 : __ fincstp();
349 5 : __ ftst();
350 5 : __ fxch(3);
351 5 : __ fld_s(Operand(rbx, rcx, times_4, 10000));
352 5 : __ fstp_s(Operand(rbx, rcx, times_4, 10000));
353 5 : __ ffree(3);
354 5 : __ fld_d(Operand(rbx, rcx, times_4, 10000));
355 5 : __ fstp_d(Operand(rbx, rcx, times_4, 10000));
356 5 : __ nop();
357 :
358 5 : __ fild_s(Operand(rbx, rcx, times_4, 10000));
359 5 : __ fistp_s(Operand(rbx, rcx, times_4, 10000));
360 5 : __ fild_d(Operand(rbx, rcx, times_4, 10000));
361 5 : __ fistp_d(Operand(rbx, rcx, times_4, 10000));
362 5 : __ fnstsw_ax();
363 5 : __ nop();
364 5 : __ fadd(3);
365 5 : __ fsub(3);
366 5 : __ fmul(3);
367 5 : __ fdiv(3);
368 :
369 5 : __ faddp(3);
370 5 : __ fsubp(3);
371 5 : __ fmulp(3);
372 5 : __ fdivp(3);
373 5 : __ fcompp();
374 5 : __ fwait();
375 5 : __ frndint();
376 5 : __ fninit();
377 5 : __ nop();
378 :
379 : // SSE instruction
380 : {
381 : // Move operation
382 5 : __ cvttss2si(rdx, Operand(rbx, rcx, times_4, 10000));
383 5 : __ cvttss2si(rdx, xmm1);
384 5 : __ cvtsd2ss(xmm0, xmm1);
385 5 : __ cvtsd2ss(xmm0, Operand(rbx, rcx, times_4, 10000));
386 5 : __ cvttps2dq(xmm0, xmm1);
387 5 : __ cvttps2dq(xmm0, Operand(rbx, rcx, times_4, 10000));
388 5 : __ movaps(xmm0, xmm1);
389 5 : __ movdqa(xmm0, Operand(rsp, 12));
390 5 : __ movdqa(Operand(rsp, 12), xmm0);
391 5 : __ movdqu(xmm0, Operand(rsp, 12));
392 5 : __ movdqu(Operand(rsp, 12), xmm0);
393 5 : __ shufps(xmm0, xmm9, 0x0);
394 :
395 : // logic operation
396 5 : __ andps(xmm0, xmm1);
397 5 : __ andps(xmm0, Operand(rbx, rcx, times_4, 10000));
398 5 : __ andnps(xmm0, xmm1);
399 5 : __ andnps(xmm0, Operand(rbx, rcx, times_4, 10000));
400 5 : __ orps(xmm0, xmm1);
401 5 : __ orps(xmm0, Operand(rbx, rcx, times_4, 10000));
402 5 : __ xorps(xmm0, xmm1);
403 5 : __ xorps(xmm0, Operand(rbx, rcx, times_4, 10000));
404 :
405 : // Arithmetic operation
406 5 : __ addss(xmm1, xmm0);
407 5 : __ addss(xmm1, Operand(rbx, rcx, times_4, 10000));
408 5 : __ mulss(xmm1, xmm0);
409 5 : __ mulss(xmm1, Operand(rbx, rcx, times_4, 10000));
410 5 : __ subss(xmm1, xmm0);
411 5 : __ subss(xmm1, Operand(rbx, rcx, times_4, 10000));
412 5 : __ divss(xmm1, xmm0);
413 5 : __ divss(xmm1, Operand(rbx, rcx, times_4, 10000));
414 5 : __ maxss(xmm1, xmm0);
415 5 : __ maxss(xmm1, Operand(rbx, rcx, times_4, 10000));
416 5 : __ minss(xmm1, xmm0);
417 5 : __ minss(xmm1, Operand(rbx, rcx, times_4, 10000));
418 5 : __ sqrtss(xmm1, xmm0);
419 5 : __ sqrtss(xmm1, Operand(rbx, rcx, times_4, 10000));
420 5 : __ addps(xmm1, xmm0);
421 5 : __ addps(xmm1, Operand(rbx, rcx, times_4, 10000));
422 5 : __ subps(xmm1, xmm0);
423 5 : __ subps(xmm1, Operand(rbx, rcx, times_4, 10000));
424 5 : __ mulps(xmm1, xmm0);
425 5 : __ mulps(xmm1, Operand(rbx, rcx, times_4, 10000));
426 5 : __ divps(xmm1, xmm0);
427 5 : __ divps(xmm1, Operand(rbx, rcx, times_4, 10000));
428 :
429 5 : __ ucomiss(xmm0, xmm1);
430 5 : __ ucomiss(xmm0, Operand(rbx, rcx, times_4, 10000));
431 : }
432 :
433 : // SSE2 instructions
434 : {
435 5 : __ cvttsd2si(rdx, Operand(rbx, rcx, times_4, 10000));
436 5 : __ cvttsd2si(rdx, xmm1);
437 5 : __ cvttsd2siq(rdx, xmm1);
438 5 : __ cvttsd2siq(rdx, Operand(rbx, rcx, times_4, 10000));
439 5 : __ cvtqsi2sd(xmm1, Operand(rbx, rcx, times_4, 10000));
440 5 : __ cvtqsi2sd(xmm1, rdx);
441 5 : __ movsd(xmm1, Operand(rbx, rcx, times_4, 10000));
442 5 : __ movsd(Operand(rbx, rcx, times_4, 10000), xmm1);
443 : // 128 bit move instructions.
444 5 : __ movupd(xmm0, Operand(rbx, rcx, times_4, 10000));
445 5 : __ movupd(Operand(rbx, rcx, times_4, 10000), xmm0);
446 5 : __ movdqa(xmm0, Operand(rbx, rcx, times_4, 10000));
447 5 : __ movdqa(Operand(rbx, rcx, times_4, 10000), xmm0);
448 :
449 5 : __ addsd(xmm1, xmm0);
450 5 : __ addsd(xmm1, Operand(rbx, rcx, times_4, 10000));
451 5 : __ mulsd(xmm1, xmm0);
452 5 : __ mulsd(xmm1, Operand(rbx, rcx, times_4, 10000));
453 5 : __ subsd(xmm1, xmm0);
454 5 : __ subsd(xmm1, Operand(rbx, rcx, times_4, 10000));
455 5 : __ divsd(xmm1, xmm0);
456 5 : __ divsd(xmm1, Operand(rbx, rcx, times_4, 10000));
457 5 : __ minsd(xmm1, xmm0);
458 5 : __ minsd(xmm1, Operand(rbx, rcx, times_4, 10000));
459 5 : __ maxsd(xmm1, xmm0);
460 5 : __ maxsd(xmm1, Operand(rbx, rcx, times_4, 10000));
461 5 : __ sqrtsd(xmm1, xmm0);
462 5 : __ sqrtsd(xmm1, Operand(rbx, rcx, times_4, 10000));
463 5 : __ ucomisd(xmm0, xmm1);
464 :
465 5 : __ andpd(xmm0, xmm1);
466 5 : __ andpd(xmm0, Operand(rbx, rcx, times_4, 10000));
467 5 : __ orpd(xmm0, xmm1);
468 5 : __ orpd(xmm0, Operand(rbx, rcx, times_4, 10000));
469 5 : __ xorpd(xmm0, xmm1);
470 5 : __ xorpd(xmm0, Operand(rbx, rcx, times_4, 10000));
471 :
472 5 : __ pslld(xmm0, 6);
473 5 : __ psrld(xmm0, 6);
474 5 : __ psllq(xmm0, 6);
475 5 : __ psrlq(xmm0, 6);
476 :
477 : __ pcmpeqd(xmm1, xmm0);
478 :
479 : __ punpckldq(xmm1, xmm11);
480 10 : __ punpckldq(xmm5, Operand(rdx, 4));
481 : __ punpckhdq(xmm8, xmm15);
482 :
483 5 : __ pshuflw(xmm2, xmm4, 3);
484 5 : __ pshufhw(xmm1, xmm9, 6);
485 :
486 : #define EMIT_SSE2_INSTR(instruction, notUsed1, notUsed2, notUsed3) \
487 : __ instruction(xmm5, xmm1); \
488 : __ instruction(xmm5, Operand(rdx, 4));
489 :
490 470 : SSE2_INSTRUCTION_LIST(EMIT_SSE2_INSTR)
491 : #undef EMIT_SSE2_INSTR
492 : }
493 :
494 : // cmov.
495 : {
496 5 : __ cmovq(overflow, rax, Operand(rax, 0));
497 5 : __ cmovq(no_overflow, rax, Operand(rax, 1));
498 5 : __ cmovq(below, rax, Operand(rax, 2));
499 5 : __ cmovq(above_equal, rax, Operand(rax, 3));
500 5 : __ cmovq(equal, rax, Operand(rbx, 0));
501 5 : __ cmovq(not_equal, rax, Operand(rbx, 1));
502 5 : __ cmovq(below_equal, rax, Operand(rbx, 2));
503 5 : __ cmovq(above, rax, Operand(rbx, 3));
504 5 : __ cmovq(sign, rax, Operand(rcx, 0));
505 5 : __ cmovq(not_sign, rax, Operand(rcx, 1));
506 5 : __ cmovq(parity_even, rax, Operand(rcx, 2));
507 5 : __ cmovq(parity_odd, rax, Operand(rcx, 3));
508 5 : __ cmovq(less, rax, Operand(rdx, 0));
509 5 : __ cmovq(greater_equal, rax, Operand(rdx, 1));
510 5 : __ cmovq(less_equal, rax, Operand(rdx, 2));
511 5 : __ cmovq(greater, rax, Operand(rdx, 3));
512 : }
513 :
514 : {
515 5 : if (CpuFeatures::IsSupported(SSE3)) {
516 : CpuFeatureScope scope(&assm, SSE3);
517 5 : __ haddps(xmm1, xmm0);
518 5 : __ haddps(xmm1, Operand(rbx, rcx, times_4, 10000));
519 5 : __ lddqu(xmm1, Operand(rdx, 4));
520 : }
521 : }
522 :
523 : #define EMIT_SSE34_INSTR(instruction, notUsed1, notUsed2, notUsed3, notUsed4) \
524 : __ instruction(xmm5, xmm1); \
525 : __ instruction(xmm5, Operand(rdx, 4));
526 :
527 : {
528 5 : if (CpuFeatures::IsSupported(SSSE3)) {
529 : CpuFeatureScope scope(&assm, SSSE3);
530 5 : __ palignr(xmm5, xmm1, 5);
531 5 : __ palignr(xmm5, Operand(rdx, 4), 5);
532 90 : SSSE3_INSTRUCTION_LIST(EMIT_SSE34_INSTR)
533 : }
534 : }
535 :
536 : {
537 5 : if (CpuFeatures::IsSupported(SSE4_1)) {
538 : CpuFeatureScope scope(&assm, SSE4_1);
539 5 : __ insertps(xmm5, xmm1, 123);
540 5 : __ extractps(rax, xmm1, 0);
541 5 : __ pextrw(rbx, xmm2, 1);
542 5 : __ pinsrw(xmm2, rcx, 1);
543 5 : __ pextrd(rbx, xmm15, 0);
544 5 : __ pextrd(r12, xmm0, 1);
545 5 : __ pinsrd(xmm9, r9, 0);
546 5 : __ pinsrd(xmm5, Operand(rax, 4), 1);
547 5 : __ pblendw(xmm5, xmm1, 1);
548 5 : __ pblendw(xmm9, Operand(rax, 4), 1);
549 :
550 5 : __ cmpps(xmm5, xmm1, 1);
551 5 : __ cmpps(xmm5, Operand(rbx, rcx, times_4, 10000), 1);
552 : __ cmpeqps(xmm5, xmm1);
553 10 : __ cmpeqps(xmm5, Operand(rbx, rcx, times_4, 10000));
554 : __ cmpltps(xmm5, xmm1);
555 10 : __ cmpltps(xmm5, Operand(rbx, rcx, times_4, 10000));
556 : __ cmpleps(xmm5, xmm1);
557 10 : __ cmpleps(xmm5, Operand(rbx, rcx, times_4, 10000));
558 : __ cmpneqps(xmm5, xmm1);
559 10 : __ cmpneqps(xmm5, Operand(rbx, rcx, times_4, 10000));
560 : __ cmpnltps(xmm5, xmm1);
561 10 : __ cmpnltps(xmm5, Operand(rbx, rcx, times_4, 10000));
562 : __ cmpnleps(xmm5, xmm1);
563 10 : __ cmpnleps(xmm5, Operand(rbx, rcx, times_4, 10000));
564 5 : __ cmppd(xmm5, xmm1, 1);
565 5 : __ cmppd(xmm5, Operand(rbx, rcx, times_4, 10000), 1);
566 : __ cmpeqpd(xmm5, xmm1);
567 10 : __ cmpeqpd(xmm5, Operand(rbx, rcx, times_4, 10000));
568 : __ cmpltpd(xmm5, xmm1);
569 10 : __ cmpltpd(xmm5, Operand(rbx, rcx, times_4, 10000));
570 : __ cmplepd(xmm5, xmm1);
571 10 : __ cmplepd(xmm5, Operand(rbx, rcx, times_4, 10000));
572 : __ cmpneqpd(xmm5, xmm1);
573 10 : __ cmpneqpd(xmm5, Operand(rbx, rcx, times_4, 10000));
574 : __ cmpnltpd(xmm5, xmm1);
575 10 : __ cmpnltpd(xmm5, Operand(rbx, rcx, times_4, 10000));
576 : __ cmpnlepd(xmm5, xmm1);
577 10 : __ cmpnlepd(xmm5, Operand(rbx, rcx, times_4, 10000));
578 :
579 5 : __ minps(xmm5, xmm1);
580 5 : __ minps(xmm5, Operand(rdx, 4));
581 5 : __ maxps(xmm5, xmm1);
582 5 : __ maxps(xmm5, Operand(rdx, 4));
583 5 : __ rcpps(xmm5, xmm1);
584 5 : __ rcpps(xmm5, Operand(rdx, 4));
585 5 : __ sqrtps(xmm5, xmm1);
586 5 : __ sqrtps(xmm5, Operand(rdx, 4));
587 5 : __ movups(xmm5, xmm1);
588 5 : __ movups(xmm5, Operand(rdx, 4));
589 5 : __ movups(Operand(rdx, 4), xmm5);
590 : __ pmulld(xmm5, xmm1);
591 10 : __ pmulld(xmm5, Operand(rdx, 4));
592 : __ pmullw(xmm5, xmm1);
593 10 : __ pmullw(xmm5, Operand(rdx, 4));
594 : __ pmuludq(xmm5, xmm1);
595 10 : __ pmuludq(xmm5, Operand(rdx, 4));
596 5 : __ psrldq(xmm5, 123);
597 5 : __ pshufd(xmm5, xmm1, 3);
598 : __ cvtps2dq(xmm5, xmm1);
599 10 : __ cvtps2dq(xmm5, Operand(rdx, 4));
600 5 : __ cvtdq2ps(xmm5, xmm1);
601 5 : __ cvtdq2ps(xmm5, Operand(rdx, 4));
602 :
603 150 : SSE4_INSTRUCTION_LIST(EMIT_SSE34_INSTR)
604 : }
605 : }
606 : #undef EMIT_SSE34_INSTR
607 :
608 : // AVX instruction
609 : {
610 5 : if (CpuFeatures::IsSupported(AVX)) {
611 : CpuFeatureScope scope(&assm, AVX);
612 : __ vmovss(xmm6, xmm14, xmm2);
613 10 : __ vmovss(xmm9, Operand(rbx, rcx, times_4, 10000));
614 10 : __ vmovss(Operand(rbx, rcx, times_4, 10000), xmm0);
615 :
616 : __ vaddss(xmm0, xmm1, xmm2);
617 10 : __ vaddss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
618 : __ vmulss(xmm0, xmm1, xmm2);
619 10 : __ vmulss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
620 : __ vsubss(xmm0, xmm1, xmm2);
621 10 : __ vsubss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
622 : __ vdivss(xmm0, xmm1, xmm2);
623 10 : __ vdivss(xmm0, xmm1, Operand(rbx, rcx, times_2, 10000));
624 : __ vminss(xmm8, xmm1, xmm2);
625 10 : __ vminss(xmm9, xmm1, Operand(rbx, rcx, times_8, 10000));
626 : __ vmaxss(xmm8, xmm1, xmm2);
627 10 : __ vmaxss(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
628 : __ vsqrtss(xmm8, xmm1, xmm2);
629 10 : __ vsqrtss(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
630 10 : __ vmovss(xmm9, Operand(r11, rcx, times_8, -10000));
631 10 : __ vmovss(Operand(rbx, r9, times_4, 10000), xmm1);
632 5 : __ vucomiss(xmm9, xmm1);
633 5 : __ vucomiss(xmm8, Operand(rbx, rdx, times_2, 10981));
634 :
635 5 : __ vmovd(xmm5, rdi);
636 5 : __ vmovd(xmm9, Operand(rbx, rcx, times_4, 10000));
637 5 : __ vmovd(r9, xmm6);
638 5 : __ vmovq(xmm5, rdi);
639 5 : __ vmovq(xmm9, Operand(rbx, rcx, times_4, 10000));
640 5 : __ vmovq(r9, xmm6);
641 :
642 5 : __ vmovsd(xmm6, xmm14, xmm2);
643 5 : __ vmovsd(xmm9, Operand(rbx, rcx, times_4, 10000));
644 5 : __ vmovsd(Operand(rbx, rcx, times_4, 10000), xmm0);
645 :
646 5 : __ vaddsd(xmm0, xmm1, xmm2);
647 5 : __ vaddsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
648 5 : __ vmulsd(xmm0, xmm1, xmm2);
649 5 : __ vmulsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
650 5 : __ vsubsd(xmm0, xmm1, xmm2);
651 5 : __ vsubsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
652 5 : __ vdivsd(xmm0, xmm1, xmm2);
653 5 : __ vdivsd(xmm0, xmm1, Operand(rbx, rcx, times_2, 10000));
654 5 : __ vminsd(xmm8, xmm1, xmm2);
655 5 : __ vminsd(xmm9, xmm1, Operand(rbx, rcx, times_8, 10000));
656 5 : __ vmaxsd(xmm8, xmm1, xmm2);
657 5 : __ vmaxsd(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
658 : __ vroundsd(xmm8, xmm3, xmm0, kRoundDown);
659 5 : __ vsqrtsd(xmm8, xmm1, xmm2);
660 5 : __ vsqrtsd(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
661 : __ vucomisd(xmm9, xmm1);
662 10 : __ vucomisd(xmm8, Operand(rbx, rdx, times_2, 10981));
663 :
664 : __ vcvtss2sd(xmm4, xmm9, xmm11);
665 5 : __ vcvtsd2ss(xmm9, xmm3, xmm2);
666 10 : __ vcvtss2sd(xmm4, xmm9, Operand(rbx, rcx, times_1, 10000));
667 5 : __ vcvtsd2ss(xmm9, xmm3, Operand(rbx, rcx, times_1, 10000));
668 : __ vcvtlsi2sd(xmm5, xmm9, rcx);
669 10 : __ vcvtlsi2sd(xmm9, xmm3, Operand(rbx, r9, times_4, 10000));
670 : __ vcvtqsi2sd(xmm5, xmm9, r11);
671 : __ vcvttsd2si(r9, xmm6);
672 10 : __ vcvttsd2si(rax, Operand(rbx, r9, times_4, 10000));
673 : __ vcvttsd2siq(rdi, xmm9);
674 10 : __ vcvttsd2siq(r8, Operand(r9, rbx, times_4, 10000));
675 : __ vcvtsd2si(rdi, xmm9);
676 :
677 : __ vmovaps(xmm10, xmm11);
678 : __ vmovapd(xmm7, xmm0);
679 10 : __ vmovupd(xmm0, Operand(rbx, rcx, times_4, 10000));
680 10 : __ vmovupd(Operand(rbx, rcx, times_4, 10000), xmm0);
681 : __ vmovmskpd(r9, xmm4);
682 :
683 : __ vmovups(xmm5, xmm1);
684 10 : __ vmovups(xmm5, Operand(rdx, 4));
685 10 : __ vmovups(Operand(rdx, 4), xmm5);
686 :
687 : __ vandps(xmm0, xmm9, xmm2);
688 10 : __ vandps(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000));
689 : __ vandnps(xmm0, xmm9, xmm2);
690 10 : __ vandnps(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000));
691 : __ vxorps(xmm0, xmm1, xmm9);
692 10 : __ vxorps(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
693 5 : __ vhaddps(xmm0, xmm1, xmm9);
694 5 : __ vhaddps(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
695 :
696 : __ vandpd(xmm0, xmm9, xmm2);
697 10 : __ vandpd(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000));
698 : __ vorpd(xmm0, xmm1, xmm9);
699 10 : __ vorpd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
700 : __ vxorpd(xmm0, xmm1, xmm9);
701 10 : __ vxorpd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
702 :
703 : __ vpcmpeqd(xmm0, xmm15, xmm5);
704 10 : __ vpcmpeqd(xmm15, xmm0, Operand(rbx, rcx, times_4, 10000));
705 : __ vpsllq(xmm0, xmm15, 21);
706 : __ vpsrlq(xmm15, xmm0, 21);
707 :
708 : __ vcmpps(xmm5, xmm4, xmm1, 1);
709 10 : __ vcmpps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000), 1);
710 5 : __ vcmpeqps(xmm5, xmm4, xmm1);
711 5 : __ vcmpeqps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
712 5 : __ vcmpltps(xmm5, xmm4, xmm1);
713 5 : __ vcmpltps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
714 5 : __ vcmpleps(xmm5, xmm4, xmm1);
715 5 : __ vcmpleps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
716 5 : __ vcmpneqps(xmm5, xmm4, xmm1);
717 5 : __ vcmpneqps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
718 5 : __ vcmpnltps(xmm5, xmm4, xmm1);
719 5 : __ vcmpnltps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
720 5 : __ vcmpnleps(xmm5, xmm4, xmm1);
721 5 : __ vcmpnleps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
722 : __ vcmppd(xmm5, xmm4, xmm1, 1);
723 10 : __ vcmppd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000), 1);
724 5 : __ vcmpeqpd(xmm5, xmm4, xmm1);
725 5 : __ vcmpeqpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
726 5 : __ vcmpltpd(xmm5, xmm4, xmm1);
727 5 : __ vcmpltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
728 5 : __ vcmplepd(xmm5, xmm4, xmm1);
729 5 : __ vcmplepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
730 5 : __ vcmpneqpd(xmm5, xmm4, xmm1);
731 5 : __ vcmpneqpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
732 5 : __ vcmpnltpd(xmm5, xmm4, xmm1);
733 5 : __ vcmpnltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
734 5 : __ vcmpnlepd(xmm5, xmm4, xmm1);
735 5 : __ vcmpnlepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
736 :
737 : #define EMIT_SSE2_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3) \
738 : __ v##instruction(xmm10, xmm5, xmm1); \
739 : __ v##instruction(xmm10, xmm5, Operand(rdx, 4));
740 :
741 : #define EMIT_SSE34_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3, \
742 : notUsed4) \
743 : __ v##instruction(xmm10, xmm5, xmm1); \
744 : __ v##instruction(xmm10, xmm5, Operand(rdx, 4));
745 :
746 470 : SSE2_INSTRUCTION_LIST(EMIT_SSE2_AVXINSTR)
747 90 : SSSE3_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR)
748 150 : SSE4_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR)
749 : #undef EMIT_SSE2_AVXINSTR
750 : #undef EMIT_SSE34_AVXINSTR
751 :
752 10 : __ vlddqu(xmm1, Operand(rbx, rcx, times_4, 10000));
753 : __ vpsllw(xmm0, xmm15, 21);
754 : __ vpsrlw(xmm0, xmm15, 21);
755 : __ vpsraw(xmm0, xmm15, 21);
756 : __ vpsrad(xmm0, xmm15, 21);
757 5 : __ vpextrb(rax, xmm2, 12);
758 10 : __ vpextrb(Operand(rbx, rcx, times_4, 10000), xmm2, 12);
759 5 : __ vpextrw(rax, xmm2, 5);
760 10 : __ vpextrw(Operand(rbx, rcx, times_4, 10000), xmm2, 5);
761 5 : __ vpextrd(rax, xmm2, 2);
762 10 : __ vpextrd(Operand(rbx, rcx, times_4, 10000), xmm2, 2);
763 :
764 : __ vpinsrb(xmm1, xmm2, rax, 12);
765 10 : __ vpinsrb(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 12);
766 : __ vpinsrw(xmm1, xmm2, rax, 5);
767 10 : __ vpinsrw(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 5);
768 : __ vpinsrd(xmm1, xmm2, rax, 2);
769 10 : __ vpinsrd(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 2);
770 : __ vpshufd(xmm1, xmm2, 85);
771 : }
772 : }
773 :
774 : // FMA3 instruction
775 : {
776 5 : if (CpuFeatures::IsSupported(FMA3)) {
777 : CpuFeatureScope scope(&assm, FMA3);
778 : __ vfmadd132sd(xmm0, xmm1, xmm2);
779 0 : __ vfmadd132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
780 : __ vfmadd213sd(xmm0, xmm1, xmm2);
781 0 : __ vfmadd213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
782 : __ vfmadd231sd(xmm0, xmm1, xmm2);
783 0 : __ vfmadd231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
784 :
785 : __ vfmadd132sd(xmm9, xmm10, xmm11);
786 0 : __ vfmadd132sd(xmm9, xmm10, Operand(r9, r11, times_4, 10000));
787 : __ vfmadd213sd(xmm9, xmm10, xmm11);
788 0 : __ vfmadd213sd(xmm9, xmm10, Operand(r9, r11, times_4, 10000));
789 : __ vfmadd231sd(xmm9, xmm10, xmm11);
790 0 : __ vfmadd231sd(xmm9, xmm10, Operand(r9, r11, times_4, 10000));
791 :
792 : __ vfmsub132sd(xmm0, xmm1, xmm2);
793 0 : __ vfmsub132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
794 : __ vfmsub213sd(xmm0, xmm1, xmm2);
795 0 : __ vfmsub213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
796 : __ vfmsub231sd(xmm0, xmm1, xmm2);
797 0 : __ vfmsub231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
798 :
799 : __ vfnmadd132sd(xmm0, xmm1, xmm2);
800 0 : __ vfnmadd132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
801 : __ vfnmadd213sd(xmm0, xmm1, xmm2);
802 0 : __ vfnmadd213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
803 : __ vfnmadd231sd(xmm0, xmm1, xmm2);
804 0 : __ vfnmadd231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
805 :
806 : __ vfnmsub132sd(xmm0, xmm1, xmm2);
807 0 : __ vfnmsub132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
808 : __ vfnmsub213sd(xmm0, xmm1, xmm2);
809 0 : __ vfnmsub213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
810 : __ vfnmsub231sd(xmm0, xmm1, xmm2);
811 0 : __ vfnmsub231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
812 :
813 : __ vfmadd132ss(xmm0, xmm1, xmm2);
814 0 : __ vfmadd132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
815 : __ vfmadd213ss(xmm0, xmm1, xmm2);
816 0 : __ vfmadd213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
817 : __ vfmadd231ss(xmm0, xmm1, xmm2);
818 0 : __ vfmadd231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
819 :
820 : __ vfmsub132ss(xmm0, xmm1, xmm2);
821 0 : __ vfmsub132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
822 : __ vfmsub213ss(xmm0, xmm1, xmm2);
823 0 : __ vfmsub213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
824 : __ vfmsub231ss(xmm0, xmm1, xmm2);
825 0 : __ vfmsub231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
826 :
827 : __ vfnmadd132ss(xmm0, xmm1, xmm2);
828 0 : __ vfnmadd132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
829 : __ vfnmadd213ss(xmm0, xmm1, xmm2);
830 0 : __ vfnmadd213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
831 : __ vfnmadd231ss(xmm0, xmm1, xmm2);
832 0 : __ vfnmadd231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
833 :
834 : __ vfnmsub132ss(xmm0, xmm1, xmm2);
835 0 : __ vfnmsub132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
836 : __ vfnmsub213ss(xmm0, xmm1, xmm2);
837 0 : __ vfnmsub213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
838 : __ vfnmsub231ss(xmm0, xmm1, xmm2);
839 0 : __ vfnmsub231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
840 : }
841 : }
842 :
843 : // BMI1 instructions
844 : {
845 5 : if (CpuFeatures::IsSupported(BMI1)) {
846 : CpuFeatureScope scope(&assm, BMI1);
847 : __ andnq(rax, rbx, rcx);
848 0 : __ andnq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
849 : __ andnl(rax, rbx, rcx);
850 0 : __ andnl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
851 : __ bextrq(rax, rbx, rcx);
852 0 : __ bextrq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
853 : __ bextrl(rax, rbx, rcx);
854 0 : __ bextrl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
855 : __ blsiq(rax, rbx);
856 0 : __ blsiq(rax, Operand(rbx, rcx, times_4, 10000));
857 : __ blsil(rax, rbx);
858 0 : __ blsil(rax, Operand(rbx, rcx, times_4, 10000));
859 : __ blsmskq(rax, rbx);
860 0 : __ blsmskq(rax, Operand(rbx, rcx, times_4, 10000));
861 : __ blsmskl(rax, rbx);
862 0 : __ blsmskl(rax, Operand(rbx, rcx, times_4, 10000));
863 : __ blsrq(rax, rbx);
864 0 : __ blsrq(rax, Operand(rbx, rcx, times_4, 10000));
865 : __ blsrl(rax, rbx);
866 0 : __ blsrl(rax, Operand(rbx, rcx, times_4, 10000));
867 0 : __ tzcntq(rax, rbx);
868 0 : __ tzcntq(rax, Operand(rbx, rcx, times_4, 10000));
869 0 : __ tzcntl(rax, rbx);
870 0 : __ tzcntl(rax, Operand(rbx, rcx, times_4, 10000));
871 : }
872 : }
873 :
874 : // LZCNT instructions
875 : {
876 5 : if (CpuFeatures::IsSupported(LZCNT)) {
877 : CpuFeatureScope scope(&assm, LZCNT);
878 0 : __ lzcntq(rax, rbx);
879 0 : __ lzcntq(rax, Operand(rbx, rcx, times_4, 10000));
880 0 : __ lzcntl(rax, rbx);
881 0 : __ lzcntl(rax, Operand(rbx, rcx, times_4, 10000));
882 : }
883 : }
884 :
885 : // POPCNT instructions
886 : {
887 5 : if (CpuFeatures::IsSupported(POPCNT)) {
888 : CpuFeatureScope scope(&assm, POPCNT);
889 5 : __ popcntq(rax, rbx);
890 5 : __ popcntq(rax, Operand(rbx, rcx, times_4, 10000));
891 5 : __ popcntl(rax, rbx);
892 5 : __ popcntl(rax, Operand(rbx, rcx, times_4, 10000));
893 : }
894 : }
895 :
896 : // BMI2 instructions
897 : {
898 5 : if (CpuFeatures::IsSupported(BMI2)) {
899 : CpuFeatureScope scope(&assm, BMI2);
900 : __ bzhiq(rax, rbx, rcx);
901 0 : __ bzhiq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
902 : __ bzhil(rax, rbx, rcx);
903 0 : __ bzhil(rax, Operand(rbx, rcx, times_4, 10000), rbx);
904 : __ mulxq(rax, rbx, rcx);
905 0 : __ mulxq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
906 : __ mulxl(rax, rbx, rcx);
907 0 : __ mulxl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
908 : __ pdepq(rax, rbx, rcx);
909 0 : __ pdepq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
910 : __ pdepl(rax, rbx, rcx);
911 0 : __ pdepl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
912 : __ pextq(rax, rbx, rcx);
913 0 : __ pextq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
914 : __ pextl(rax, rbx, rcx);
915 0 : __ pextl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
916 : __ sarxq(rax, rbx, rcx);
917 0 : __ sarxq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
918 : __ sarxl(rax, rbx, rcx);
919 0 : __ sarxl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
920 : __ shlxq(rax, rbx, rcx);
921 0 : __ shlxq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
922 : __ shlxl(rax, rbx, rcx);
923 0 : __ shlxl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
924 : __ shrxq(rax, rbx, rcx);
925 0 : __ shrxq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
926 : __ shrxl(rax, rbx, rcx);
927 0 : __ shrxl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
928 0 : __ rorxq(rax, rbx, 63);
929 0 : __ rorxq(rax, Operand(rbx, rcx, times_4, 10000), 63);
930 0 : __ rorxl(rax, rbx, 31);
931 0 : __ rorxl(rax, Operand(rbx, rcx, times_4, 10000), 31);
932 : }
933 : }
934 :
935 : // xchg.
936 : {
937 5 : __ xchgb(rax, Operand(rax, 8));
938 5 : __ xchgw(rax, Operand(rbx, 8));
939 : __ xchgq(rax, rax);
940 : __ xchgq(rax, rbx);
941 : __ xchgq(rbx, rbx);
942 10 : __ xchgq(rbx, Operand(rsp, 12));
943 : }
944 :
945 : // cmpxchg.
946 : {
947 5 : __ cmpxchgb(Operand(rsp, 12), rax);
948 5 : __ cmpxchgw(Operand(rbx, rcx, times_4, 10000), rax);
949 10 : __ cmpxchgl(Operand(rbx, rcx, times_4, 10000), rax);
950 10 : __ cmpxchgq(Operand(rbx, rcx, times_4, 10000), rax);
951 : }
952 :
953 : // lock prefix.
954 : {
955 5 : __ lock();
956 10 : __ cmpxchgl(Operand(rsp, 12), rbx);
957 :
958 5 : __ lock();
959 5 : __ xchgw(rax, Operand(rcx, 8));
960 : }
961 :
962 : // Nop instructions
963 165 : for (int i = 0; i < 16; i++) {
964 80 : __ Nop(i);
965 : }
966 :
967 5 : __ pause();
968 5 : __ ret(0);
969 :
970 5 : CodeDesc desc;
971 : assm.GetCode(isolate, &desc);
972 : Handle<Code> code =
973 10 : isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>());
974 : USE(code);
975 : #ifdef OBJECT_PRINT
976 : StdoutStream os;
977 : code->Print(os);
978 : Address begin = code->raw_instruction_start();
979 : Address end = code->raw_instruction_end();
980 : disasm::Disassembler::Disassemble(stdout, reinterpret_cast<byte*>(begin),
981 : reinterpret_cast<byte*>(end));
982 : #endif
983 5 : }
984 :
985 : #undef __
986 :
987 : } // namespace internal
988 79917 : } // namespace v8
|