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 25880 : 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 5 : __ addq(rax, Immediate(12345678));
57 5 : __ orq(rax, Immediate(12345678));
58 5 : __ subq(rax, Immediate(12345678));
59 5 : __ xorq(rax, Immediate(12345678));
60 5 : __ 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 5 : __ 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 5 : __ addq(rbx, Immediate(12));
96 5 : __ nop();
97 5 : __ nop();
98 5 : __ andq(rdx, Immediate(3));
99 5 : __ andq(rdx, Operand(rsp, 4));
100 5 : __ 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 5 : __ orq(rdx, Immediate(3));
106 5 : __ 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 5 : __ 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 5 : __ 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 5 : __ 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 5 : __ addq(rbx, Immediate(12));
237 5 : __ addq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
238 :
239 5 : __ andq(rbx, Immediate(12345));
240 :
241 5 : __ cmpq(rbx, Immediate(12345));
242 5 : __ cmpq(rbx, Immediate(12));
243 5 : __ cmpq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
244 : __ cmpb(rax, Immediate(100));
245 :
246 5 : __ orq(rbx, Immediate(12345));
247 :
248 5 : __ subq(rbx, Immediate(12));
249 5 : __ subq(Operand(rdx, rcx, times_4, 10000), Immediate(12));
250 :
251 5 : __ 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 5 : __ 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 5 : __ 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 : __ orps(xmm0, xmm1);
399 5 : __ orps(xmm0, Operand(rbx, rcx, times_4, 10000));
400 5 : __ xorps(xmm0, xmm1);
401 5 : __ xorps(xmm0, Operand(rbx, rcx, times_4, 10000));
402 :
403 : // Arithmetic operation
404 5 : __ addss(xmm1, xmm0);
405 5 : __ addss(xmm1, Operand(rbx, rcx, times_4, 10000));
406 5 : __ mulss(xmm1, xmm0);
407 5 : __ mulss(xmm1, Operand(rbx, rcx, times_4, 10000));
408 5 : __ subss(xmm1, xmm0);
409 5 : __ subss(xmm1, Operand(rbx, rcx, times_4, 10000));
410 5 : __ divss(xmm1, xmm0);
411 5 : __ divss(xmm1, Operand(rbx, rcx, times_4, 10000));
412 5 : __ maxss(xmm1, xmm0);
413 5 : __ maxss(xmm1, Operand(rbx, rcx, times_4, 10000));
414 5 : __ minss(xmm1, xmm0);
415 5 : __ minss(xmm1, Operand(rbx, rcx, times_4, 10000));
416 5 : __ sqrtss(xmm1, xmm0);
417 5 : __ sqrtss(xmm1, Operand(rbx, rcx, times_4, 10000));
418 5 : __ addps(xmm1, xmm0);
419 5 : __ addps(xmm1, Operand(rbx, rcx, times_4, 10000));
420 5 : __ subps(xmm1, xmm0);
421 5 : __ subps(xmm1, Operand(rbx, rcx, times_4, 10000));
422 5 : __ mulps(xmm1, xmm0);
423 5 : __ mulps(xmm1, Operand(rbx, rcx, times_4, 10000));
424 5 : __ divps(xmm1, xmm0);
425 5 : __ divps(xmm1, Operand(rbx, rcx, times_4, 10000));
426 :
427 5 : __ ucomiss(xmm0, xmm1);
428 5 : __ ucomiss(xmm0, Operand(rbx, rcx, times_4, 10000));
429 : }
430 :
431 : // SSE2 instructions
432 : {
433 5 : __ cvttsd2si(rdx, Operand(rbx, rcx, times_4, 10000));
434 5 : __ cvttsd2si(rdx, xmm1);
435 5 : __ cvttsd2siq(rdx, xmm1);
436 5 : __ cvttsd2siq(rdx, Operand(rbx, rcx, times_4, 10000));
437 5 : __ cvtqsi2sd(xmm1, Operand(rbx, rcx, times_4, 10000));
438 5 : __ cvtqsi2sd(xmm1, rdx);
439 5 : __ movsd(xmm1, Operand(rbx, rcx, times_4, 10000));
440 5 : __ movsd(Operand(rbx, rcx, times_4, 10000), xmm1);
441 : // 128 bit move instructions.
442 5 : __ movupd(xmm0, Operand(rbx, rcx, times_4, 10000));
443 5 : __ movupd(Operand(rbx, rcx, times_4, 10000), xmm0);
444 5 : __ movdqa(xmm0, Operand(rbx, rcx, times_4, 10000));
445 5 : __ movdqa(Operand(rbx, rcx, times_4, 10000), xmm0);
446 :
447 5 : __ addsd(xmm1, xmm0);
448 5 : __ addsd(xmm1, Operand(rbx, rcx, times_4, 10000));
449 5 : __ mulsd(xmm1, xmm0);
450 5 : __ mulsd(xmm1, Operand(rbx, rcx, times_4, 10000));
451 5 : __ subsd(xmm1, xmm0);
452 5 : __ subsd(xmm1, Operand(rbx, rcx, times_4, 10000));
453 5 : __ divsd(xmm1, xmm0);
454 5 : __ divsd(xmm1, Operand(rbx, rcx, times_4, 10000));
455 5 : __ minsd(xmm1, xmm0);
456 5 : __ minsd(xmm1, Operand(rbx, rcx, times_4, 10000));
457 5 : __ maxsd(xmm1, xmm0);
458 5 : __ maxsd(xmm1, Operand(rbx, rcx, times_4, 10000));
459 5 : __ sqrtsd(xmm1, xmm0);
460 5 : __ sqrtsd(xmm1, Operand(rbx, rcx, times_4, 10000));
461 5 : __ ucomisd(xmm0, xmm1);
462 :
463 5 : __ andpd(xmm0, xmm1);
464 5 : __ andpd(xmm0, Operand(rbx, rcx, times_4, 10000));
465 5 : __ orpd(xmm0, xmm1);
466 5 : __ orpd(xmm0, Operand(rbx, rcx, times_4, 10000));
467 5 : __ xorpd(xmm0, xmm1);
468 5 : __ xorpd(xmm0, Operand(rbx, rcx, times_4, 10000));
469 :
470 5 : __ pslld(xmm0, 6);
471 5 : __ psrld(xmm0, 6);
472 5 : __ psllq(xmm0, 6);
473 5 : __ psrlq(xmm0, 6);
474 :
475 : __ pcmpeqd(xmm1, xmm0);
476 :
477 : __ punpckldq(xmm1, xmm11);
478 10 : __ punpckldq(xmm5, Operand(rdx, 4));
479 : __ punpckhdq(xmm8, xmm15);
480 :
481 5 : __ pshuflw(xmm2, xmm4, 3);
482 5 : __ pshufhw(xmm1, xmm9, 6);
483 :
484 : #define EMIT_SSE2_INSTR(instruction, notUsed1, notUsed2, notUsed3) \
485 : __ instruction(xmm5, xmm1); \
486 : __ instruction(xmm5, Operand(rdx, 4));
487 :
488 470 : SSE2_INSTRUCTION_LIST(EMIT_SSE2_INSTR)
489 : #undef EMIT_SSE2_INSTR
490 : }
491 :
492 : // cmov.
493 : {
494 5 : __ cmovq(overflow, rax, Operand(rax, 0));
495 5 : __ cmovq(no_overflow, rax, Operand(rax, 1));
496 5 : __ cmovq(below, rax, Operand(rax, 2));
497 5 : __ cmovq(above_equal, rax, Operand(rax, 3));
498 5 : __ cmovq(equal, rax, Operand(rbx, 0));
499 5 : __ cmovq(not_equal, rax, Operand(rbx, 1));
500 5 : __ cmovq(below_equal, rax, Operand(rbx, 2));
501 5 : __ cmovq(above, rax, Operand(rbx, 3));
502 5 : __ cmovq(sign, rax, Operand(rcx, 0));
503 5 : __ cmovq(not_sign, rax, Operand(rcx, 1));
504 5 : __ cmovq(parity_even, rax, Operand(rcx, 2));
505 5 : __ cmovq(parity_odd, rax, Operand(rcx, 3));
506 5 : __ cmovq(less, rax, Operand(rdx, 0));
507 5 : __ cmovq(greater_equal, rax, Operand(rdx, 1));
508 5 : __ cmovq(less_equal, rax, Operand(rdx, 2));
509 5 : __ cmovq(greater, rax, Operand(rdx, 3));
510 : }
511 :
512 : {
513 5 : if (CpuFeatures::IsSupported(SSE3)) {
514 : CpuFeatureScope scope(&assm, SSE3);
515 5 : __ haddps(xmm1, xmm0);
516 5 : __ haddps(xmm1, Operand(rbx, rcx, times_4, 10000));
517 5 : __ lddqu(xmm1, Operand(rdx, 4));
518 : }
519 : }
520 :
521 : #define EMIT_SSE34_INSTR(instruction, notUsed1, notUsed2, notUsed3, notUsed4) \
522 : __ instruction(xmm5, xmm1); \
523 : __ instruction(xmm5, Operand(rdx, 4));
524 :
525 : {
526 5 : if (CpuFeatures::IsSupported(SSSE3)) {
527 : CpuFeatureScope scope(&assm, SSSE3);
528 5 : __ palignr(xmm5, xmm1, 5);
529 5 : __ palignr(xmm5, Operand(rdx, 4), 5);
530 90 : SSSE3_INSTRUCTION_LIST(EMIT_SSE34_INSTR)
531 : }
532 : }
533 :
534 : {
535 5 : if (CpuFeatures::IsSupported(SSE4_1)) {
536 : CpuFeatureScope scope(&assm, SSE4_1);
537 5 : __ insertps(xmm5, xmm1, 123);
538 5 : __ extractps(rax, xmm1, 0);
539 5 : __ pextrw(rbx, xmm2, 1);
540 5 : __ pinsrw(xmm2, rcx, 1);
541 5 : __ pextrd(rbx, xmm15, 0);
542 5 : __ pextrd(r12, xmm0, 1);
543 5 : __ pinsrd(xmm9, r9, 0);
544 5 : __ pinsrd(xmm5, Operand(rax, 4), 1);
545 5 : __ pblendw(xmm5, xmm1, 1);
546 5 : __ pblendw(xmm9, Operand(rax, 4), 1);
547 :
548 5 : __ cmpps(xmm5, xmm1, 1);
549 5 : __ cmpps(xmm5, Operand(rbx, rcx, times_4, 10000), 1);
550 : __ cmpeqps(xmm5, xmm1);
551 10 : __ cmpeqps(xmm5, Operand(rbx, rcx, times_4, 10000));
552 : __ cmpltps(xmm5, xmm1);
553 10 : __ cmpltps(xmm5, Operand(rbx, rcx, times_4, 10000));
554 : __ cmpleps(xmm5, xmm1);
555 10 : __ cmpleps(xmm5, Operand(rbx, rcx, times_4, 10000));
556 : __ cmpneqps(xmm5, xmm1);
557 10 : __ cmpneqps(xmm5, Operand(rbx, rcx, times_4, 10000));
558 : __ cmpnltps(xmm5, xmm1);
559 10 : __ cmpnltps(xmm5, Operand(rbx, rcx, times_4, 10000));
560 : __ cmpnleps(xmm5, xmm1);
561 10 : __ cmpnleps(xmm5, Operand(rbx, rcx, times_4, 10000));
562 5 : __ cmppd(xmm5, xmm1, 1);
563 5 : __ cmppd(xmm5, Operand(rbx, rcx, times_4, 10000), 1);
564 : __ cmpeqpd(xmm5, xmm1);
565 10 : __ cmpeqpd(xmm5, Operand(rbx, rcx, times_4, 10000));
566 : __ cmpltpd(xmm5, xmm1);
567 10 : __ cmpltpd(xmm5, Operand(rbx, rcx, times_4, 10000));
568 : __ cmplepd(xmm5, xmm1);
569 10 : __ cmplepd(xmm5, Operand(rbx, rcx, times_4, 10000));
570 : __ cmpneqpd(xmm5, xmm1);
571 10 : __ cmpneqpd(xmm5, Operand(rbx, rcx, times_4, 10000));
572 : __ cmpnltpd(xmm5, xmm1);
573 10 : __ cmpnltpd(xmm5, Operand(rbx, rcx, times_4, 10000));
574 : __ cmpnlepd(xmm5, xmm1);
575 10 : __ cmpnlepd(xmm5, Operand(rbx, rcx, times_4, 10000));
576 :
577 5 : __ minps(xmm5, xmm1);
578 5 : __ minps(xmm5, Operand(rdx, 4));
579 5 : __ maxps(xmm5, xmm1);
580 5 : __ maxps(xmm5, Operand(rdx, 4));
581 5 : __ rcpps(xmm5, xmm1);
582 5 : __ rcpps(xmm5, Operand(rdx, 4));
583 5 : __ sqrtps(xmm5, xmm1);
584 5 : __ sqrtps(xmm5, Operand(rdx, 4));
585 5 : __ movups(xmm5, xmm1);
586 5 : __ movups(xmm5, Operand(rdx, 4));
587 5 : __ movups(Operand(rdx, 4), xmm5);
588 : __ pmulld(xmm5, xmm1);
589 10 : __ pmulld(xmm5, Operand(rdx, 4));
590 : __ pmullw(xmm5, xmm1);
591 10 : __ pmullw(xmm5, Operand(rdx, 4));
592 : __ pmuludq(xmm5, xmm1);
593 10 : __ pmuludq(xmm5, Operand(rdx, 4));
594 5 : __ psrldq(xmm5, 123);
595 5 : __ pshufd(xmm5, xmm1, 3);
596 : __ cvtps2dq(xmm5, xmm1);
597 10 : __ cvtps2dq(xmm5, Operand(rdx, 4));
598 5 : __ cvtdq2ps(xmm5, xmm1);
599 5 : __ cvtdq2ps(xmm5, Operand(rdx, 4));
600 :
601 150 : SSE4_INSTRUCTION_LIST(EMIT_SSE34_INSTR)
602 : }
603 : }
604 : #undef EMIT_SSE34_INSTR
605 :
606 : // AVX instruction
607 : {
608 5 : if (CpuFeatures::IsSupported(AVX)) {
609 : CpuFeatureScope scope(&assm, AVX);
610 : __ vmovss(xmm6, xmm14, xmm2);
611 10 : __ vmovss(xmm9, Operand(rbx, rcx, times_4, 10000));
612 10 : __ vmovss(Operand(rbx, rcx, times_4, 10000), xmm0);
613 :
614 : __ vaddss(xmm0, xmm1, xmm2);
615 10 : __ vaddss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
616 : __ vmulss(xmm0, xmm1, xmm2);
617 10 : __ vmulss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
618 : __ vsubss(xmm0, xmm1, xmm2);
619 10 : __ vsubss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
620 : __ vdivss(xmm0, xmm1, xmm2);
621 10 : __ vdivss(xmm0, xmm1, Operand(rbx, rcx, times_2, 10000));
622 : __ vminss(xmm8, xmm1, xmm2);
623 10 : __ vminss(xmm9, xmm1, Operand(rbx, rcx, times_8, 10000));
624 : __ vmaxss(xmm8, xmm1, xmm2);
625 10 : __ vmaxss(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
626 : __ vsqrtss(xmm8, xmm1, xmm2);
627 10 : __ vsqrtss(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
628 10 : __ vmovss(xmm9, Operand(r11, rcx, times_8, -10000));
629 10 : __ vmovss(Operand(rbx, r9, times_4, 10000), xmm1);
630 5 : __ vucomiss(xmm9, xmm1);
631 5 : __ vucomiss(xmm8, Operand(rbx, rdx, times_2, 10981));
632 :
633 5 : __ vmovd(xmm5, rdi);
634 5 : __ vmovd(xmm9, Operand(rbx, rcx, times_4, 10000));
635 5 : __ vmovd(r9, xmm6);
636 5 : __ vmovq(xmm5, rdi);
637 5 : __ vmovq(xmm9, Operand(rbx, rcx, times_4, 10000));
638 5 : __ vmovq(r9, xmm6);
639 :
640 5 : __ vmovsd(xmm6, xmm14, xmm2);
641 5 : __ vmovsd(xmm9, Operand(rbx, rcx, times_4, 10000));
642 5 : __ vmovsd(Operand(rbx, rcx, times_4, 10000), xmm0);
643 :
644 5 : __ vaddsd(xmm0, xmm1, xmm2);
645 5 : __ vaddsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
646 5 : __ vmulsd(xmm0, xmm1, xmm2);
647 5 : __ vmulsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
648 5 : __ vsubsd(xmm0, xmm1, xmm2);
649 5 : __ vsubsd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
650 5 : __ vdivsd(xmm0, xmm1, xmm2);
651 5 : __ vdivsd(xmm0, xmm1, Operand(rbx, rcx, times_2, 10000));
652 5 : __ vminsd(xmm8, xmm1, xmm2);
653 5 : __ vminsd(xmm9, xmm1, Operand(rbx, rcx, times_8, 10000));
654 5 : __ vmaxsd(xmm8, xmm1, xmm2);
655 5 : __ vmaxsd(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
656 5 : __ vroundsd(xmm8, xmm3, xmm0, kRoundDown);
657 5 : __ vsqrtsd(xmm8, xmm1, xmm2);
658 5 : __ vsqrtsd(xmm9, xmm1, Operand(rbx, rcx, times_1, 10000));
659 : __ vucomisd(xmm9, xmm1);
660 10 : __ vucomisd(xmm8, Operand(rbx, rdx, times_2, 10981));
661 :
662 : __ vcvtss2sd(xmm4, xmm9, xmm11);
663 5 : __ vcvtsd2ss(xmm9, xmm3, xmm2);
664 10 : __ vcvtss2sd(xmm4, xmm9, Operand(rbx, rcx, times_1, 10000));
665 5 : __ vcvtsd2ss(xmm9, xmm3, Operand(rbx, rcx, times_1, 10000));
666 : __ vcvtlsi2sd(xmm5, xmm9, rcx);
667 10 : __ vcvtlsi2sd(xmm9, xmm3, Operand(rbx, r9, times_4, 10000));
668 : __ vcvtqsi2sd(xmm5, xmm9, r11);
669 5 : __ vcvttsd2si(r9, xmm6);
670 5 : __ vcvttsd2si(rax, Operand(rbx, r9, times_4, 10000));
671 5 : __ vcvttsd2siq(rdi, xmm9);
672 5 : __ vcvttsd2siq(r8, Operand(r9, rbx, times_4, 10000));
673 5 : __ vcvtsd2si(rdi, xmm9);
674 :
675 : __ vmovaps(xmm10, xmm11);
676 : __ vmovapd(xmm7, xmm0);
677 10 : __ vmovupd(xmm0, Operand(rbx, rcx, times_4, 10000));
678 10 : __ vmovupd(Operand(rbx, rcx, times_4, 10000), xmm0);
679 : __ vmovmskpd(r9, xmm4);
680 :
681 : __ vmovups(xmm5, xmm1);
682 10 : __ vmovups(xmm5, Operand(rdx, 4));
683 10 : __ vmovups(Operand(rdx, 4), xmm5);
684 :
685 : __ vandps(xmm0, xmm9, xmm2);
686 10 : __ vandps(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000));
687 : __ vxorps(xmm0, xmm1, xmm9);
688 10 : __ vxorps(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
689 5 : __ vhaddps(xmm0, xmm1, xmm9);
690 5 : __ vhaddps(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
691 :
692 : __ vandpd(xmm0, xmm9, xmm2);
693 10 : __ vandpd(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000));
694 : __ vorpd(xmm0, xmm1, xmm9);
695 10 : __ vorpd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
696 : __ vxorpd(xmm0, xmm1, xmm9);
697 10 : __ vxorpd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
698 :
699 : __ vpcmpeqd(xmm0, xmm15, xmm5);
700 10 : __ vpcmpeqd(xmm15, xmm0, Operand(rbx, rcx, times_4, 10000));
701 : __ vpsllq(xmm0, xmm15, 21);
702 : __ vpsrlq(xmm15, xmm0, 21);
703 :
704 : __ vcmpps(xmm5, xmm4, xmm1, 1);
705 10 : __ vcmpps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000), 1);
706 5 : __ vcmpeqps(xmm5, xmm4, xmm1);
707 5 : __ vcmpeqps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
708 5 : __ vcmpltps(xmm5, xmm4, xmm1);
709 5 : __ vcmpltps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
710 5 : __ vcmpleps(xmm5, xmm4, xmm1);
711 5 : __ vcmpleps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
712 5 : __ vcmpneqps(xmm5, xmm4, xmm1);
713 5 : __ vcmpneqps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
714 5 : __ vcmpnltps(xmm5, xmm4, xmm1);
715 5 : __ vcmpnltps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
716 5 : __ vcmpnleps(xmm5, xmm4, xmm1);
717 5 : __ vcmpnleps(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
718 : __ vcmppd(xmm5, xmm4, xmm1, 1);
719 10 : __ vcmppd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000), 1);
720 5 : __ vcmpeqpd(xmm5, xmm4, xmm1);
721 5 : __ vcmpeqpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
722 5 : __ vcmpltpd(xmm5, xmm4, xmm1);
723 5 : __ vcmpltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
724 5 : __ vcmplepd(xmm5, xmm4, xmm1);
725 5 : __ vcmplepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
726 5 : __ vcmpneqpd(xmm5, xmm4, xmm1);
727 5 : __ vcmpneqpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
728 5 : __ vcmpnltpd(xmm5, xmm4, xmm1);
729 5 : __ vcmpnltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
730 5 : __ vcmpnlepd(xmm5, xmm4, xmm1);
731 5 : __ vcmpnlepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000));
732 :
733 : #define EMIT_SSE2_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3) \
734 : __ v##instruction(xmm10, xmm5, xmm1); \
735 : __ v##instruction(xmm10, xmm5, Operand(rdx, 4));
736 :
737 : #define EMIT_SSE34_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3, \
738 : notUsed4) \
739 : __ v##instruction(xmm10, xmm5, xmm1); \
740 : __ v##instruction(xmm10, xmm5, Operand(rdx, 4));
741 :
742 470 : SSE2_INSTRUCTION_LIST(EMIT_SSE2_AVXINSTR)
743 90 : SSSE3_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR)
744 150 : SSE4_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR)
745 : #undef EMIT_SSE2_AVXINSTR
746 : #undef EMIT_SSE34_AVXINSTR
747 :
748 10 : __ vlddqu(xmm1, Operand(rbx, rcx, times_4, 10000));
749 5 : __ vpsllw(xmm0, xmm15, 21);
750 5 : __ vpsrlw(xmm0, xmm15, 21);
751 5 : __ vpsraw(xmm0, xmm15, 21);
752 5 : __ vpsrad(xmm0, xmm15, 21);
753 5 : __ vpextrb(rax, xmm2, 12);
754 5 : __ vpextrb(Operand(rbx, rcx, times_4, 10000), xmm2, 12);
755 5 : __ vpextrw(rax, xmm2, 5);
756 5 : __ vpextrw(Operand(rbx, rcx, times_4, 10000), xmm2, 5);
757 5 : __ vpextrd(rax, xmm2, 2);
758 5 : __ vpextrd(Operand(rbx, rcx, times_4, 10000), xmm2, 2);
759 :
760 5 : __ vpinsrb(xmm1, xmm2, rax, 12);
761 5 : __ vpinsrb(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 12);
762 5 : __ vpinsrw(xmm1, xmm2, rax, 5);
763 5 : __ vpinsrw(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 5);
764 5 : __ vpinsrd(xmm1, xmm2, rax, 2);
765 5 : __ vpinsrd(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 2);
766 5 : __ vpshufd(xmm1, xmm2, 85);
767 : }
768 : }
769 :
770 : // FMA3 instruction
771 : {
772 5 : if (CpuFeatures::IsSupported(FMA3)) {
773 : CpuFeatureScope scope(&assm, FMA3);
774 : __ vfmadd132sd(xmm0, xmm1, xmm2);
775 10 : __ vfmadd132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
776 : __ vfmadd213sd(xmm0, xmm1, xmm2);
777 10 : __ vfmadd213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
778 : __ vfmadd231sd(xmm0, xmm1, xmm2);
779 10 : __ vfmadd231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
780 :
781 : __ vfmadd132sd(xmm9, xmm10, xmm11);
782 10 : __ vfmadd132sd(xmm9, xmm10, Operand(r9, r11, times_4, 10000));
783 : __ vfmadd213sd(xmm9, xmm10, xmm11);
784 10 : __ vfmadd213sd(xmm9, xmm10, Operand(r9, r11, times_4, 10000));
785 : __ vfmadd231sd(xmm9, xmm10, xmm11);
786 10 : __ vfmadd231sd(xmm9, xmm10, Operand(r9, r11, times_4, 10000));
787 :
788 : __ vfmsub132sd(xmm0, xmm1, xmm2);
789 10 : __ vfmsub132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
790 : __ vfmsub213sd(xmm0, xmm1, xmm2);
791 10 : __ vfmsub213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
792 : __ vfmsub231sd(xmm0, xmm1, xmm2);
793 10 : __ vfmsub231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
794 :
795 : __ vfnmadd132sd(xmm0, xmm1, xmm2);
796 10 : __ vfnmadd132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
797 : __ vfnmadd213sd(xmm0, xmm1, xmm2);
798 10 : __ vfnmadd213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
799 : __ vfnmadd231sd(xmm0, xmm1, xmm2);
800 10 : __ vfnmadd231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
801 :
802 : __ vfnmsub132sd(xmm0, xmm1, xmm2);
803 10 : __ vfnmsub132sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
804 : __ vfnmsub213sd(xmm0, xmm1, xmm2);
805 10 : __ vfnmsub213sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
806 : __ vfnmsub231sd(xmm0, xmm1, xmm2);
807 10 : __ vfnmsub231sd(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
808 :
809 : __ vfmadd132ss(xmm0, xmm1, xmm2);
810 10 : __ vfmadd132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
811 : __ vfmadd213ss(xmm0, xmm1, xmm2);
812 10 : __ vfmadd213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
813 : __ vfmadd231ss(xmm0, xmm1, xmm2);
814 10 : __ vfmadd231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
815 :
816 : __ vfmsub132ss(xmm0, xmm1, xmm2);
817 10 : __ vfmsub132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
818 : __ vfmsub213ss(xmm0, xmm1, xmm2);
819 10 : __ vfmsub213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
820 : __ vfmsub231ss(xmm0, xmm1, xmm2);
821 10 : __ vfmsub231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
822 :
823 : __ vfnmadd132ss(xmm0, xmm1, xmm2);
824 10 : __ vfnmadd132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
825 : __ vfnmadd213ss(xmm0, xmm1, xmm2);
826 10 : __ vfnmadd213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
827 : __ vfnmadd231ss(xmm0, xmm1, xmm2);
828 10 : __ vfnmadd231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
829 :
830 : __ vfnmsub132ss(xmm0, xmm1, xmm2);
831 10 : __ vfnmsub132ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
832 : __ vfnmsub213ss(xmm0, xmm1, xmm2);
833 10 : __ vfnmsub213ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
834 : __ vfnmsub231ss(xmm0, xmm1, xmm2);
835 10 : __ vfnmsub231ss(xmm0, xmm1, Operand(rbx, rcx, times_4, 10000));
836 : }
837 : }
838 :
839 : // BMI1 instructions
840 : {
841 5 : if (CpuFeatures::IsSupported(BMI1)) {
842 : CpuFeatureScope scope(&assm, BMI1);
843 : __ andnq(rax, rbx, rcx);
844 10 : __ andnq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
845 : __ andnl(rax, rbx, rcx);
846 10 : __ andnl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
847 : __ bextrq(rax, rbx, rcx);
848 10 : __ bextrq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
849 : __ bextrl(rax, rbx, rcx);
850 10 : __ bextrl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
851 : __ blsiq(rax, rbx);
852 10 : __ blsiq(rax, Operand(rbx, rcx, times_4, 10000));
853 : __ blsil(rax, rbx);
854 10 : __ blsil(rax, Operand(rbx, rcx, times_4, 10000));
855 : __ blsmskq(rax, rbx);
856 10 : __ blsmskq(rax, Operand(rbx, rcx, times_4, 10000));
857 : __ blsmskl(rax, rbx);
858 10 : __ blsmskl(rax, Operand(rbx, rcx, times_4, 10000));
859 : __ blsrq(rax, rbx);
860 10 : __ blsrq(rax, Operand(rbx, rcx, times_4, 10000));
861 : __ blsrl(rax, rbx);
862 10 : __ blsrl(rax, Operand(rbx, rcx, times_4, 10000));
863 5 : __ tzcntq(rax, rbx);
864 5 : __ tzcntq(rax, Operand(rbx, rcx, times_4, 10000));
865 5 : __ tzcntl(rax, rbx);
866 5 : __ tzcntl(rax, Operand(rbx, rcx, times_4, 10000));
867 : }
868 : }
869 :
870 : // LZCNT instructions
871 : {
872 5 : if (CpuFeatures::IsSupported(LZCNT)) {
873 : CpuFeatureScope scope(&assm, LZCNT);
874 5 : __ lzcntq(rax, rbx);
875 5 : __ lzcntq(rax, Operand(rbx, rcx, times_4, 10000));
876 5 : __ lzcntl(rax, rbx);
877 5 : __ lzcntl(rax, Operand(rbx, rcx, times_4, 10000));
878 : }
879 : }
880 :
881 : // POPCNT instructions
882 : {
883 5 : if (CpuFeatures::IsSupported(POPCNT)) {
884 : CpuFeatureScope scope(&assm, POPCNT);
885 5 : __ popcntq(rax, rbx);
886 5 : __ popcntq(rax, Operand(rbx, rcx, times_4, 10000));
887 5 : __ popcntl(rax, rbx);
888 5 : __ popcntl(rax, Operand(rbx, rcx, times_4, 10000));
889 : }
890 : }
891 :
892 : // BMI2 instructions
893 : {
894 5 : if (CpuFeatures::IsSupported(BMI2)) {
895 : CpuFeatureScope scope(&assm, BMI2);
896 : __ bzhiq(rax, rbx, rcx);
897 10 : __ bzhiq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
898 : __ bzhil(rax, rbx, rcx);
899 10 : __ bzhil(rax, Operand(rbx, rcx, times_4, 10000), rbx);
900 : __ mulxq(rax, rbx, rcx);
901 10 : __ mulxq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
902 : __ mulxl(rax, rbx, rcx);
903 10 : __ mulxl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
904 : __ pdepq(rax, rbx, rcx);
905 10 : __ pdepq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
906 : __ pdepl(rax, rbx, rcx);
907 10 : __ pdepl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
908 : __ pextq(rax, rbx, rcx);
909 10 : __ pextq(rax, rbx, Operand(rbx, rcx, times_4, 10000));
910 : __ pextl(rax, rbx, rcx);
911 10 : __ pextl(rax, rbx, Operand(rbx, rcx, times_4, 10000));
912 : __ sarxq(rax, rbx, rcx);
913 10 : __ sarxq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
914 : __ sarxl(rax, rbx, rcx);
915 10 : __ sarxl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
916 : __ shlxq(rax, rbx, rcx);
917 10 : __ shlxq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
918 : __ shlxl(rax, rbx, rcx);
919 10 : __ shlxl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
920 : __ shrxq(rax, rbx, rcx);
921 10 : __ shrxq(rax, Operand(rbx, rcx, times_4, 10000), rbx);
922 : __ shrxl(rax, rbx, rcx);
923 10 : __ shrxl(rax, Operand(rbx, rcx, times_4, 10000), rbx);
924 5 : __ rorxq(rax, rbx, 63);
925 5 : __ rorxq(rax, Operand(rbx, rcx, times_4, 10000), 63);
926 5 : __ rorxl(rax, rbx, 31);
927 5 : __ rorxl(rax, Operand(rbx, rcx, times_4, 10000), 31);
928 : }
929 : }
930 :
931 : // xchg.
932 : {
933 5 : __ xchgb(rax, Operand(rax, 8));
934 5 : __ xchgw(rax, Operand(rbx, 8));
935 : __ xchgq(rax, rax);
936 : __ xchgq(rax, rbx);
937 : __ xchgq(rbx, rbx);
938 10 : __ xchgq(rbx, Operand(rsp, 12));
939 : }
940 :
941 : // cmpxchg.
942 : {
943 5 : __ cmpxchgb(Operand(rsp, 12), rax);
944 5 : __ cmpxchgw(Operand(rbx, rcx, times_4, 10000), rax);
945 10 : __ cmpxchgl(Operand(rbx, rcx, times_4, 10000), rax);
946 10 : __ cmpxchgq(Operand(rbx, rcx, times_4, 10000), rax);
947 : }
948 :
949 : // lock prefix.
950 : {
951 5 : __ lock();
952 10 : __ cmpxchgl(Operand(rsp, 12), rbx);
953 :
954 5 : __ lock();
955 5 : __ xchgw(rax, Operand(rcx, 8));
956 : }
957 :
958 : // Nop instructions
959 85 : for (int i = 0; i < 16; i++) {
960 80 : __ Nop(i);
961 : }
962 :
963 5 : __ pause();
964 5 : __ ret(0);
965 :
966 5 : CodeDesc desc;
967 : assm.GetCode(isolate, &desc);
968 : Handle<Code> code =
969 10 : isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>());
970 : USE(code);
971 : #ifdef OBJECT_PRINT
972 : StdoutStream os;
973 : code->Print(os);
974 : Address begin = code->raw_instruction_start();
975 : Address end = code->raw_instruction_end();
976 : disasm::Disassembler::Disassemble(stdout, reinterpret_cast<byte*>(begin),
977 : reinterpret_cast<byte*>(end));
978 : #endif
979 5 : }
980 :
981 : #undef __
982 :
983 : } // namespace internal
984 77625 : } // namespace v8
|