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