OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 __ fmulp(3); | 357 __ fmulp(3); |
358 __ fdivp(3); | 358 __ fdivp(3); |
359 __ fcompp(); | 359 __ fcompp(); |
360 __ fwait(); | 360 __ fwait(); |
361 __ frndint(); | 361 __ frndint(); |
362 __ fninit(); | 362 __ fninit(); |
363 __ nop(); | 363 __ nop(); |
364 | 364 |
365 // SSE instruction | 365 // SSE instruction |
366 { | 366 { |
367 if (CpuFeatures::IsSupported(SSE2)) { | 367 // Move operation |
368 CpuFeatureScope fscope(&assm, SSE2); | 368 __ movaps(xmm0, xmm1); |
369 // Move operation | 369 __ shufps(xmm0, xmm0, 0x0); |
370 __ movaps(xmm0, xmm1); | |
371 __ shufps(xmm0, xmm0, 0x0); | |
372 | 370 |
373 // logic operation | 371 // logic operation |
374 __ andps(xmm0, xmm1); | 372 __ andps(xmm0, xmm1); |
375 __ andps(xmm0, Operand(ebx, ecx, times_4, 10000)); | 373 __ andps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
376 __ orps(xmm0, xmm1); | 374 __ orps(xmm0, xmm1); |
377 __ orps(xmm0, Operand(ebx, ecx, times_4, 10000)); | 375 __ orps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
378 __ xorps(xmm0, xmm1); | 376 __ xorps(xmm0, xmm1); |
379 __ xorps(xmm0, Operand(ebx, ecx, times_4, 10000)); | 377 __ xorps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
380 | 378 |
381 // Arithmetic operation | 379 // Arithmetic operation |
382 __ addps(xmm1, xmm0); | 380 __ addps(xmm1, xmm0); |
383 __ addps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 381 __ addps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
384 __ subps(xmm1, xmm0); | 382 __ subps(xmm1, xmm0); |
385 __ subps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 383 __ subps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
386 __ mulps(xmm1, xmm0); | 384 __ mulps(xmm1, xmm0); |
387 __ mulps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 385 __ mulps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
388 __ divps(xmm1, xmm0); | 386 __ divps(xmm1, xmm0); |
389 __ divps(xmm1, Operand(ebx, ecx, times_4, 10000)); | 387 __ divps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
390 } | |
391 } | 388 } |
392 { | 389 { |
393 if (CpuFeatures::IsSupported(SSE2)) { | 390 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); |
394 CpuFeatureScope fscope(&assm, SSE2); | 391 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
395 __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); | 392 __ movsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
396 __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); | 393 __ movsd(Operand(ebx, ecx, times_4, 10000), xmm1); |
397 __ movsd(xmm1, Operand(ebx, ecx, times_4, 10000)); | 394 // 128 bit move instructions. |
398 __ movsd(Operand(ebx, ecx, times_4, 10000), xmm1); | 395 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); |
399 // 128 bit move instructions. | 396 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0); |
400 __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); | 397 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); |
401 __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0); | 398 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); |
402 __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); | |
403 __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); | |
404 | 399 |
405 __ addsd(xmm1, xmm0); | 400 __ addsd(xmm1, xmm0); |
406 __ mulsd(xmm1, xmm0); | 401 __ mulsd(xmm1, xmm0); |
407 __ subsd(xmm1, xmm0); | 402 __ subsd(xmm1, xmm0); |
408 __ divsd(xmm1, xmm0); | 403 __ divsd(xmm1, xmm0); |
409 __ ucomisd(xmm0, xmm1); | 404 __ ucomisd(xmm0, xmm1); |
410 __ cmpltsd(xmm0, xmm1); | 405 __ cmpltsd(xmm0, xmm1); |
411 | 406 |
412 __ andpd(xmm0, xmm1); | 407 __ andpd(xmm0, xmm1); |
413 __ psllq(xmm0, 17); | 408 __ psllq(xmm0, 17); |
414 __ psllq(xmm0, xmm1); | 409 __ psllq(xmm0, xmm1); |
415 __ psrlq(xmm0, 17); | 410 __ psrlq(xmm0, 17); |
416 __ psrlq(xmm0, xmm1); | 411 __ psrlq(xmm0, xmm1); |
417 __ por(xmm0, xmm1); | 412 __ por(xmm0, xmm1); |
418 } | |
419 } | 413 } |
420 | 414 |
421 // cmov. | 415 // cmov. |
422 { | 416 { |
423 if (CpuFeatures::IsSupported(CMOV)) { | 417 if (CpuFeatures::IsSupported(CMOV)) { |
424 CpuFeatureScope use_cmov(&assm, CMOV); | 418 CpuFeatureScope use_cmov(&assm, CMOV); |
425 __ cmov(overflow, eax, Operand(eax, 0)); | 419 __ cmov(overflow, eax, Operand(eax, 0)); |
426 __ cmov(no_overflow, eax, Operand(eax, 1)); | 420 __ cmov(no_overflow, eax, Operand(eax, 1)); |
427 __ cmov(below, eax, Operand(eax, 2)); | 421 __ cmov(below, eax, Operand(eax, 2)); |
428 __ cmov(above_equal, eax, Operand(eax, 3)); | 422 __ cmov(above_equal, eax, Operand(eax, 3)); |
429 __ cmov(equal, eax, Operand(ebx, 0)); | 423 __ cmov(equal, eax, Operand(ebx, 0)); |
430 __ cmov(not_equal, eax, Operand(ebx, 1)); | 424 __ cmov(not_equal, eax, Operand(ebx, 1)); |
431 __ cmov(below_equal, eax, Operand(ebx, 2)); | 425 __ cmov(below_equal, eax, Operand(ebx, 2)); |
432 __ cmov(above, eax, Operand(ebx, 3)); | 426 __ cmov(above, eax, Operand(ebx, 3)); |
433 __ cmov(sign, eax, Operand(ecx, 0)); | 427 __ cmov(sign, eax, Operand(ecx, 0)); |
434 __ cmov(not_sign, eax, Operand(ecx, 1)); | 428 __ cmov(not_sign, eax, Operand(ecx, 1)); |
435 __ cmov(parity_even, eax, Operand(ecx, 2)); | 429 __ cmov(parity_even, eax, Operand(ecx, 2)); |
436 __ cmov(parity_odd, eax, Operand(ecx, 3)); | 430 __ cmov(parity_odd, eax, Operand(ecx, 3)); |
437 __ cmov(less, eax, Operand(edx, 0)); | 431 __ cmov(less, eax, Operand(edx, 0)); |
438 __ cmov(greater_equal, eax, Operand(edx, 1)); | 432 __ cmov(greater_equal, eax, Operand(edx, 1)); |
439 __ cmov(less_equal, eax, Operand(edx, 2)); | 433 __ cmov(less_equal, eax, Operand(edx, 2)); |
440 __ cmov(greater, eax, Operand(edx, 3)); | 434 __ cmov(greater, eax, Operand(edx, 3)); |
441 } | 435 } |
442 } | 436 } |
443 | 437 |
444 { | 438 { |
445 if (CpuFeatures::IsSupported(SSE2) && | 439 if (CpuFeatures::IsSupported(SSE4_1)) { |
446 CpuFeatures::IsSupported(SSE4_1)) { | |
447 CpuFeatureScope scope(&assm, SSE4_1); | 440 CpuFeatureScope scope(&assm, SSE4_1); |
448 __ pextrd(eax, xmm0, 1); | 441 __ pextrd(eax, xmm0, 1); |
449 __ pinsrd(xmm1, eax, 0); | 442 __ pinsrd(xmm1, eax, 0); |
450 __ extractps(eax, xmm1, 0); | 443 __ extractps(eax, xmm1, 0); |
451 } | 444 } |
452 } | 445 } |
453 | 446 |
454 // Nop instructions | 447 // Nop instructions |
455 for (int i = 0; i < 16; i++) { | 448 for (int i = 0; i < 16; i++) { |
456 __ Nop(i); | 449 __ Nop(i); |
457 } | 450 } |
458 | 451 |
459 __ ret(0); | 452 __ ret(0); |
460 | 453 |
461 CodeDesc desc; | 454 CodeDesc desc; |
462 assm.GetCode(&desc); | 455 assm.GetCode(&desc); |
463 Handle<Code> code = isolate->factory()->NewCode( | 456 Handle<Code> code = isolate->factory()->NewCode( |
464 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 457 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
465 USE(code); | 458 USE(code); |
466 #ifdef OBJECT_PRINT | 459 #ifdef OBJECT_PRINT |
467 code->Print(); | 460 code->Print(); |
468 byte* begin = code->instruction_start(); | 461 byte* begin = code->instruction_start(); |
469 byte* end = begin + code->instruction_size(); | 462 byte* end = begin + code->instruction_size(); |
470 disasm::Disassembler::Disassemble(stdout, begin, end); | 463 disasm::Disassembler::Disassemble(stdout, begin, end); |
471 #endif | 464 #endif |
472 } | 465 } |
473 | 466 |
474 #undef __ | 467 #undef __ |
OLD | NEW |