Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: src/compiler/ia32/code-generator-ia32.cc

Issue 1066393002: [turbofan] Add new Float32Abs and Float64Abs operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/common-operator-reducer.cc ('k') | src/compiler/ia32/instruction-codes-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/ia32/assembler-ia32.h" 10 #include "src/ia32/assembler-ia32.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 break; 470 break;
471 case kSSEFloat32Max: 471 case kSSEFloat32Max:
472 __ maxss(i.InputDoubleRegister(0), i.InputOperand(1)); 472 __ maxss(i.InputDoubleRegister(0), i.InputOperand(1));
473 break; 473 break;
474 case kSSEFloat32Min: 474 case kSSEFloat32Min:
475 __ minss(i.InputDoubleRegister(0), i.InputOperand(1)); 475 __ minss(i.InputDoubleRegister(0), i.InputOperand(1));
476 break; 476 break;
477 case kSSEFloat32Sqrt: 477 case kSSEFloat32Sqrt:
478 __ sqrtss(i.OutputDoubleRegister(), i.InputOperand(0)); 478 __ sqrtss(i.OutputDoubleRegister(), i.InputOperand(0));
479 break; 479 break;
480 case kSSEFloat32Abs: {
481 // TODO(bmeurer): Use 128-bit constants.
482 // TODO(turbofan): Add AVX version with relaxed register constraints.
483 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
484 __ psrlq(kScratchDoubleReg, 33);
485 __ andps(i.OutputDoubleRegister(), kScratchDoubleReg);
486 break;
487 }
480 case kSSEFloat32Neg: { 488 case kSSEFloat32Neg: {
481 // TODO(bmeurer): Use 128-bit constants. 489 // TODO(bmeurer): Use 128-bit constants.
482 // TODO(turbofan): Add AVX version with relaxed register constraints. 490 // TODO(turbofan): Add AVX version with relaxed register constraints.
483 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 491 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
484 __ psllq(kScratchDoubleReg, 31); 492 __ psllq(kScratchDoubleReg, 31);
485 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg); 493 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg);
486 break; 494 break;
487 } 495 }
488 case kSSEFloat64Cmp: 496 case kSSEFloat64Cmp:
489 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); 497 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 __ fnstsw_ax(); 532 __ fnstsw_ax();
525 __ sahf(); 533 __ sahf();
526 __ j(parity_even, &mod_loop); 534 __ j(parity_even, &mod_loop);
527 // Move output to stack and clean up. 535 // Move output to stack and clean up.
528 __ fstp(1); 536 __ fstp(1);
529 __ fstp_d(Operand(esp, 0)); 537 __ fstp_d(Operand(esp, 0));
530 __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); 538 __ movsd(i.OutputDoubleRegister(), Operand(esp, 0));
531 __ add(esp, Immediate(kDoubleSize)); 539 __ add(esp, Immediate(kDoubleSize));
532 break; 540 break;
533 } 541 }
542 case kSSEFloat64Abs: {
543 // TODO(bmeurer): Use 128-bit constants.
544 // TODO(turbofan): Add AVX version with relaxed register constraints.
545 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
546 __ psrlq(kScratchDoubleReg, 1);
547 __ andpd(i.OutputDoubleRegister(), kScratchDoubleReg);
548 break;
549 }
534 case kSSEFloat64Neg: { 550 case kSSEFloat64Neg: {
535 // TODO(bmeurer): Use 128-bit constants. 551 // TODO(bmeurer): Use 128-bit constants.
536 // TODO(turbofan): Add AVX version with relaxed register constraints. 552 // TODO(turbofan): Add AVX version with relaxed register constraints.
537 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); 553 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
538 __ psllq(kScratchDoubleReg, 63); 554 __ psllq(kScratchDoubleReg, 63);
539 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); 555 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg);
540 break; 556 break;
541 } 557 }
542 case kSSEFloat64Sqrt: 558 case kSSEFloat64Sqrt:
543 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0)); 559 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0));
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1423 }
1408 } 1424 }
1409 MarkLazyDeoptSite(); 1425 MarkLazyDeoptSite();
1410 } 1426 }
1411 1427
1412 #undef __ 1428 #undef __
1413 1429
1414 } // namespace compiler 1430 } // namespace compiler
1415 } // namespace internal 1431 } // namespace internal
1416 } // namespace v8 1432 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator-reducer.cc ('k') | src/compiler/ia32/instruction-codes-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698