blob: f81b173e132b87ad1547857eb5249940d4f748f8 [file] [log] [blame]
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +00001// Copyright 2011 the V8 project authors. All rights reserved.
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +00002// 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
ulan@chromium.org57ff8812013-05-10 08:16:55 +000030// TODO(dcarney): remove
31#define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
32#define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW
33
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000034#include "v8.h"
35
36#include "debug.h"
37#include "disasm.h"
38#include "disassembler.h"
39#include "macro-assembler.h"
40#include "serialize.h"
41#include "cctest.h"
42
43using namespace v8::internal;
44
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000045
46#define __ assm.
47
48
49static void DummyStaticFunction(Object* result) {
50}
51
52
53TEST(DisasmIa320) {
mstarzinger@chromium.orge27d6172013-04-17 11:51:44 +000054 CcTest::InitializeVM();
55 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate());
svenpanne@chromium.org2bda5432013-03-15 12:39:50 +000056 HandleScope scope(isolate);
fschneider@chromium.org0c20e672010-01-14 15:28:53 +000057 v8::internal::byte buffer[2048];
svenpanne@chromium.org2bda5432013-03-15 12:39:50 +000058 Assembler assm(isolate, buffer, sizeof buffer);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000059 DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging)
60
61 // Short immediate instructions
62 __ adc(eax, 12345678);
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +000063 __ add(eax, Immediate(12345678));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000064 __ or_(eax, 12345678);
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +000065 __ sub(eax, Immediate(12345678));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000066 __ xor_(eax, 12345678);
67 __ and_(eax, 12345678);
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +000068 Handle<FixedArray> foo = FACTORY->NewFixedArray(10, TENURED);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000069 __ cmp(eax, foo);
70
71 // ---- This one caused crash
72 __ mov(ebx, Operand(esp, ecx, times_2, 0)); // [esp+ecx*4]
73
74 // ---- All instructions that I can think of
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +000075 __ add(edx, ebx);
jkummerow@chromium.org59297c72013-01-09 16:32:23 +000076 __ add(edx, Operand(12, RelocInfo::NONE32));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000077 __ add(edx, Operand(ebx, 0));
78 __ add(edx, Operand(ebx, 16));
79 __ add(edx, Operand(ebx, 1999));
80 __ add(edx, Operand(esp, 0));
81 __ add(edx, Operand(esp, 16));
82 __ add(edx, Operand(esp, 1999));
83 __ nop();
84 __ add(edi, Operand(ebp, ecx, times_4, 0));
85 __ add(edi, Operand(ebp, ecx, times_4, 12));
86 __ add(Operand(ebp, ecx, times_4, 12), Immediate(12));
87
88 __ nop();
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +000089 __ add(ebx, Immediate(12));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +000090 __ nop();
91 __ adc(ecx, 12);
92 __ adc(ecx, 1000);
93 __ nop();
94 __ and_(edx, 3);
95 __ and_(edx, Operand(esp, 4));
96 __ cmp(edx, 3);
97 __ cmp(edx, Operand(esp, 4));
98 __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000));
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +000099 Handle<FixedArray> foo2 = FACTORY->NewFixedArray(10, TENURED);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000100 __ cmp(ebx, foo2);
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000101 __ cmpb(ebx, Operand(ebp, ecx, times_2, 0));
102 __ cmpb(Operand(ebp, ecx, times_2, 0), ebx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000103 __ or_(edx, 3);
104 __ xor_(edx, 3);
105 __ nop();
106 {
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000107 CHECK(CpuFeatures::IsSupported(CPUID));
ulan@chromium.org750145a2013-03-07 15:14:13 +0000108 CpuFeatureScope fscope(&assm, CPUID);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000109 __ cpuid();
110 }
111 {
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000112 CHECK(CpuFeatures::IsSupported(RDTSC));
ulan@chromium.org750145a2013-03-07 15:14:13 +0000113 CpuFeatureScope fscope(&assm, RDTSC);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000114 __ rdtsc();
115 }
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000116 __ movsx_b(edx, ecx);
117 __ movsx_w(edx, ecx);
118 __ movzx_b(edx, ecx);
119 __ movzx_w(edx, ecx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000120
121 __ nop();
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000122 __ imul(edx, ecx);
123 __ shld(edx, ecx);
124 __ shrd(edx, ecx);
125 __ bts(edx, ecx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000126 __ bts(Operand(ebx, ecx, times_4, 0), ecx);
127 __ nop();
128 __ pushad();
129 __ popad();
130 __ pushfd();
131 __ popfd();
132 __ push(Immediate(12));
133 __ push(Immediate(23456));
134 __ push(ecx);
135 __ push(esi);
136 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
137 __ push(Operand(ebx, ecx, times_4, 0));
138 __ push(Operand(ebx, ecx, times_4, 0));
139 __ push(Operand(ebx, ecx, times_4, 10000));
140 __ pop(edx);
141 __ pop(eax);
142 __ pop(Operand(ebx, ecx, times_4, 0));
143 __ nop();
144
145 __ add(edx, Operand(esp, 16));
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000146 __ add(edx, ecx);
147 __ mov_b(edx, ecx);
148 __ mov_b(ecx, 6);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000149 __ mov_b(Operand(ebx, ecx, times_4, 10000), 6);
150 __ mov_b(Operand(esp, 16), edx);
151 __ mov_w(edx, Operand(esp, 16));
152 __ mov_w(Operand(esp, 16), edx);
153 __ nop();
154 __ movsx_w(edx, Operand(esp, 12));
155 __ movsx_b(edx, Operand(esp, 12));
156 __ movzx_w(edx, Operand(esp, 12));
157 __ movzx_b(edx, Operand(esp, 12));
158 __ nop();
159 __ mov(edx, 1234567);
160 __ mov(edx, Operand(esp, 12));
161 __ mov(Operand(ebx, ecx, times_4, 10000), Immediate(12345));
162 __ mov(Operand(ebx, ecx, times_4, 10000), edx);
163 __ nop();
164 __ dec_b(edx);
whesse@chromium.org4a1fe7d2010-09-27 12:32:04 +0000165 __ dec_b(Operand(eax, 10));
166 __ dec_b(Operand(ebx, ecx, times_4, 10000));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000167 __ dec(edx);
168 __ cdq();
169
170 __ nop();
171 __ idiv(edx);
172 __ mul(edx);
173 __ neg(edx);
174 __ not_(edx);
175 __ test(Operand(ebx, ecx, times_4, 10000), Immediate(123456));
176
177 __ imul(edx, Operand(ebx, ecx, times_4, 10000));
178 __ imul(edx, ecx, 12);
179 __ imul(edx, ecx, 1000);
180
181 __ inc(edx);
182 __ inc(Operand(ebx, ecx, times_4, 10000));
183 __ push(Operand(ebx, ecx, times_4, 10000));
184 __ pop(Operand(ebx, ecx, times_4, 10000));
185 __ call(Operand(ebx, ecx, times_4, 10000));
186 __ jmp(Operand(ebx, ecx, times_4, 10000));
187
188 __ lea(edx, Operand(ebx, ecx, times_4, 10000));
189 __ or_(edx, 12345);
190 __ or_(edx, Operand(ebx, ecx, times_4, 10000));
191
192 __ nop();
193
194 __ rcl(edx, 1);
195 __ rcl(edx, 7);
ager@chromium.orgea4f62e2010-08-16 16:28:43 +0000196 __ rcr(edx, 1);
197 __ rcr(edx, 7);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000198 __ sar(edx, 1);
199 __ sar(edx, 6);
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000200 __ sar_cl(edx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000201 __ sbb(edx, Operand(ebx, ecx, times_4, 10000));
202 __ shld(edx, Operand(ebx, ecx, times_4, 10000));
203 __ shl(edx, 1);
204 __ shl(edx, 6);
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000205 __ shl_cl(edx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000206 __ shrd(edx, Operand(ebx, ecx, times_4, 10000));
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000207 __ shr(edx, 1);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000208 __ shr(edx, 7);
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000209 __ shr_cl(edx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000210
211
212 // Immediates
213
214 __ adc(edx, 12345);
215
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000216 __ add(ebx, Immediate(12));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000217 __ add(Operand(edx, ecx, times_4, 10000), Immediate(12));
218
219 __ and_(ebx, 12345);
220
221 __ cmp(ebx, 12345);
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000222 __ cmp(ebx, Immediate(12));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000223 __ cmp(Operand(edx, ecx, times_4, 10000), Immediate(12));
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000224 __ cmpb(eax, 100);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000225
226 __ or_(ebx, 12345);
227
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000228 __ sub(ebx, Immediate(12));
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000229 __ sub(Operand(edx, ecx, times_4, 10000), Immediate(12));
230
231 __ xor_(ebx, 12345);
232
233 __ imul(edx, ecx, 12);
234 __ imul(edx, ecx, 1000);
235
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000236 __ cld();
fschneider@chromium.org0c20e672010-01-14 15:28:53 +0000237 __ rep_movs();
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000238 __ rep_stos();
erik.corry@gmail.com9dfbea42010-05-21 12:58:28 +0000239 __ stos();
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000240
241 __ sub(edx, Operand(ebx, ecx, times_4, 10000));
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000242 __ sub(edx, ebx);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000243
244 __ test(edx, Immediate(12345));
245 __ test(edx, Operand(ebx, ecx, times_8, 10000));
vegorov@chromium.org2356e6f2010-06-09 09:38:56 +0000246 __ test(Operand(esi, edi, times_1, -20000000), Immediate(300000000));
247 __ test_b(edx, Operand(ecx, ebx, times_2, 1000));
248 __ test_b(Operand(eax, -20), 0x9A);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000249 __ nop();
250
251 __ xor_(edx, 12345);
252 __ xor_(edx, Operand(ebx, ecx, times_8, 10000));
253 __ bts(Operand(ebx, ecx, times_8, 10000), edx);
254 __ hlt();
255 __ int3();
256 __ ret(0);
257 __ ret(8);
258
259 // Calls
260
261 Label L1, L2;
262 __ bind(&L1);
263 __ nop();
264 __ call(&L1);
265 __ call(&L2);
266 __ nop();
267 __ bind(&L2);
268 __ call(Operand(ebx, ecx, times_4, 10000));
269 __ nop();
svenpanne@chromium.org2bda5432013-03-15 12:39:50 +0000270 Handle<Code> ic(isolate->builtins()->builtin(Builtins::kLoadIC_Initialize));
ager@chromium.org236ad962008-09-25 09:45:57 +0000271 __ call(ic, RelocInfo::CODE_TARGET);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000272 __ nop();
ager@chromium.org236ad962008-09-25 09:45:57 +0000273 __ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000274 __ nop();
275
276 __ jmp(&L1);
277 __ jmp(Operand(ebx, ecx, times_4, 10000));
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000278#ifdef ENABLE_DEBUGGER_SUPPORT
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000279 ExternalReference after_break_target =
svenpanne@chromium.org2bda5432013-03-15 12:39:50 +0000280 ExternalReference(Debug_Address::AfterBreakTarget(), isolate);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000281 __ jmp(Operand::StaticVariable(after_break_target));
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000282#endif // ENABLE_DEBUGGER_SUPPORT
ager@chromium.org236ad962008-09-25 09:45:57 +0000283 __ jmp(ic, RelocInfo::CODE_TARGET);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000284 __ nop();
285
286
287 Label Ljcc;
288 __ nop();
289 // long jumps
290 __ j(overflow, &Ljcc);
291 __ j(no_overflow, &Ljcc);
292 __ j(below, &Ljcc);
293 __ j(above_equal, &Ljcc);
294 __ j(equal, &Ljcc);
295 __ j(not_equal, &Ljcc);
296 __ j(below_equal, &Ljcc);
297 __ j(above, &Ljcc);
298 __ j(sign, &Ljcc);
299 __ j(not_sign, &Ljcc);
300 __ j(parity_even, &Ljcc);
301 __ j(parity_odd, &Ljcc);
302 __ j(less, &Ljcc);
303 __ j(greater_equal, &Ljcc);
304 __ j(less_equal, &Ljcc);
305 __ j(greater, &Ljcc);
306 __ nop();
307 __ bind(&Ljcc);
308 // short jumps
309 __ j(overflow, &Ljcc);
310 __ j(no_overflow, &Ljcc);
311 __ j(below, &Ljcc);
312 __ j(above_equal, &Ljcc);
313 __ j(equal, &Ljcc);
314 __ j(not_equal, &Ljcc);
315 __ j(below_equal, &Ljcc);
316 __ j(above, &Ljcc);
317 __ j(sign, &Ljcc);
318 __ j(not_sign, &Ljcc);
319 __ j(parity_even, &Ljcc);
320 __ j(parity_odd, &Ljcc);
321 __ j(less, &Ljcc);
322 __ j(greater_equal, &Ljcc);
323 __ j(less_equal, &Ljcc);
324 __ j(greater, &Ljcc);
325
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000326 // 0xD9 instructions
327 __ nop();
328
whesse@chromium.org4a1fe7d2010-09-27 12:32:04 +0000329 __ fld(1);
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000330 __ fld1();
331 __ fldz();
whesse@chromium.org4a1fe7d2010-09-27 12:32:04 +0000332 __ fldpi();
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000333 __ fabs();
334 __ fchs();
335 __ fprem();
336 __ fprem1();
337 __ fincstp();
338 __ ftst();
339 __ fxch(3);
340 __ fld_s(Operand(ebx, ecx, times_4, 10000));
341 __ fstp_s(Operand(ebx, ecx, times_4, 10000));
342 __ ffree(3);
343 __ fld_d(Operand(ebx, ecx, times_4, 10000));
344 __ fstp_d(Operand(ebx, ecx, times_4, 10000));
345 __ nop();
346
347 __ fild_s(Operand(ebx, ecx, times_4, 10000));
348 __ fistp_s(Operand(ebx, ecx, times_4, 10000));
349 __ fild_d(Operand(ebx, ecx, times_4, 10000));
350 __ fistp_d(Operand(ebx, ecx, times_4, 10000));
351 __ fnstsw_ax();
352 __ nop();
353 __ fadd(3);
354 __ fsub(3);
355 __ fmul(3);
356 __ fdiv(3);
357
358 __ faddp(3);
359 __ fsubp(3);
360 __ fmulp(3);
361 __ fdivp(3);
362 __ fcompp();
363 __ fwait();
364 __ nop();
365 {
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000366 if (CpuFeatures::IsSupported(SSE2)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000367 CpuFeatureScope fscope(&assm, SSE2);
fschneider@chromium.org086aac62010-03-17 13:18:24 +0000368 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000));
369 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000));
370 __ addsd(xmm1, xmm0);
371 __ mulsd(xmm1, xmm0);
372 __ subsd(xmm1, xmm0);
373 __ divsd(xmm1, xmm0);
374 __ movdbl(xmm1, Operand(ebx, ecx, times_4, 10000));
375 __ movdbl(Operand(ebx, ecx, times_4, 10000), xmm1);
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000376 __ ucomisd(xmm0, xmm1);
fschneider@chromium.org0c20e672010-01-14 15:28:53 +0000377
fschneider@chromium.org086aac62010-03-17 13:18:24 +0000378 // 128 bit move instructions.
379 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000));
380 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0);
381 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000));
382 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0);
383 }
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000384 }
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000385
386 // cmov.
387 {
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000388 if (CpuFeatures::IsSupported(CMOV)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000389 CpuFeatureScope use_cmov(&assm, CMOV);
fschneider@chromium.org086aac62010-03-17 13:18:24 +0000390 __ cmov(overflow, eax, Operand(eax, 0));
391 __ cmov(no_overflow, eax, Operand(eax, 1));
392 __ cmov(below, eax, Operand(eax, 2));
393 __ cmov(above_equal, eax, Operand(eax, 3));
394 __ cmov(equal, eax, Operand(ebx, 0));
395 __ cmov(not_equal, eax, Operand(ebx, 1));
396 __ cmov(below_equal, eax, Operand(ebx, 2));
397 __ cmov(above, eax, Operand(ebx, 3));
398 __ cmov(sign, eax, Operand(ecx, 0));
399 __ cmov(not_sign, eax, Operand(ecx, 1));
400 __ cmov(parity_even, eax, Operand(ecx, 2));
401 __ cmov(parity_odd, eax, Operand(ecx, 3));
402 __ cmov(less, eax, Operand(edx, 0));
403 __ cmov(greater_equal, eax, Operand(edx, 1));
404 __ cmov(less_equal, eax, Operand(edx, 2));
405 __ cmov(greater, eax, Operand(edx, 3));
406 }
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000407 }
408
sgjesse@chromium.orgc6c57182011-01-17 12:24:25 +0000409 // andpd, cmpltsd, movaps, psllq, psrlq, por.
fschneider@chromium.orgc20610a2010-09-22 09:44:58 +0000410 {
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000411 if (CpuFeatures::IsSupported(SSE2)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000412 CpuFeatureScope fscope(&assm, SSE2);
fschneider@chromium.orgc20610a2010-09-22 09:44:58 +0000413 __ andpd(xmm0, xmm1);
414 __ andpd(xmm1, xmm2);
415
416 __ cmpltsd(xmm0, xmm1);
417 __ cmpltsd(xmm1, xmm2);
418
419 __ movaps(xmm0, xmm1);
420 __ movaps(xmm1, xmm2);
421
422 __ psllq(xmm0, 17);
423 __ psllq(xmm1, 42);
sgjesse@chromium.orgc6c57182011-01-17 12:24:25 +0000424
425 __ psllq(xmm0, xmm1);
426 __ psllq(xmm1, xmm2);
427
428 __ psrlq(xmm0, 17);
429 __ psrlq(xmm1, 42);
430
431 __ psrlq(xmm0, xmm1);
432 __ psrlq(xmm1, xmm2);
433
434 __ por(xmm0, xmm1);
435 __ por(xmm1, xmm2);
fschneider@chromium.orgc20610a2010-09-22 09:44:58 +0000436 }
437 }
438
erik.corry@gmail.comd91075f2011-02-10 07:45:38 +0000439 {
yangguo@chromium.orga6bbcc82012-12-21 12:35:02 +0000440 if (CpuFeatures::IsSupported(SSE2) &&
441 CpuFeatures::IsSupported(SSE4_1)) {
ulan@chromium.org750145a2013-03-07 15:14:13 +0000442 CpuFeatureScope scope(&assm, SSE4_1);
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000443 __ pextrd(eax, xmm0, 1);
444 __ pinsrd(xmm1, eax, 0);
erik.corry@gmail.comd91075f2011-02-10 07:45:38 +0000445 }
446 }
447
ricow@chromium.org64e3a4b2011-12-13 08:07:27 +0000448 // Nop instructions
449 for (int i = 0; i < 16; i++) {
450 __ Nop(i);
451 }
452
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000453 __ ret(0);
454
455 CodeDesc desc;
456 assm.GetCode(&desc);
ulan@chromium.org09d7ab52013-02-25 15:50:35 +0000457 Object* code = isolate->heap()->CreateCode(
lrn@chromium.org303ada72010-10-27 09:33:13 +0000458 desc,
459 Code::ComputeFlags(Code::STUB),
ulan@chromium.org09d7ab52013-02-25 15:50:35 +0000460 Handle<Code>())->ToObjectChecked();
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000461 CHECK(code->IsCode());
fschneider@chromium.org9e3e0b62011-01-03 10:16:46 +0000462#ifdef OBJECT_PRINT
mads.s.ager@gmail.com9a4089a2008-09-01 08:55:01 +0000463 Code::cast(code)->Print();
464 byte* begin = Code::cast(code)->instruction_start();
465 byte* end = begin + Code::cast(code)->instruction_size();
466 disasm::Disassembler::Disassemble(stdout, begin, end);
467#endif
468}
469
470#undef __