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

Side by Side Diff: src/crankshaft/s390/lithium-codegen-s390.cc

Issue 2615683003: s390: optimize MathSqrt (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | src/crankshaft/s390/lithium-s390.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" 6 #include "src/crankshaft/s390/lithium-codegen-s390.h"
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 DoubleRegister input_reg = ToDoubleRegister(instr->value()); 3514 DoubleRegister input_reg = ToDoubleRegister(instr->value());
3515 DoubleRegister output_reg = ToDoubleRegister(instr->result()); 3515 DoubleRegister output_reg = ToDoubleRegister(instr->result());
3516 3516
3517 // Round double to float 3517 // Round double to float
3518 __ ledbr(output_reg, input_reg); 3518 __ ledbr(output_reg, input_reg);
3519 // Extend from float to double 3519 // Extend from float to double
3520 __ ldebr(output_reg, output_reg); 3520 __ ldebr(output_reg, output_reg);
3521 } 3521 }
3522 3522
3523 void LCodeGen::DoMathSqrt(LMathSqrt* instr) { 3523 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
3524 DoubleRegister input = ToDoubleRegister(instr->value());
3525 DoubleRegister result = ToDoubleRegister(instr->result()); 3524 DoubleRegister result = ToDoubleRegister(instr->result());
3526 __ sqdbr(result, input); 3525 LOperand* input = instr->value();
3526 if (input->IsDoubleRegister()) {
3527 __ Sqrt(result, ToDoubleRegister(instr->value()));
3528 } else {
3529 __ Sqrt(result, ToMemOperand(input));
3530 }
3527 } 3531 }
3528 3532
3529 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { 3533 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
3530 DoubleRegister input = ToDoubleRegister(instr->value()); 3534 DoubleRegister input = ToDoubleRegister(instr->value());
3531 DoubleRegister result = ToDoubleRegister(instr->result()); 3535 DoubleRegister result = ToDoubleRegister(instr->result());
3532 DoubleRegister temp = double_scratch0(); 3536 DoubleRegister temp = double_scratch0();
3533 3537
3534 // Note that according to ECMA-262 15.8.2.13: 3538 // Note that according to ECMA-262 15.8.2.13:
3535 // Math.pow(-Infinity, 0.5) == Infinity 3539 // Math.pow(-Infinity, 0.5) == Infinity
3536 // Math.sqrt(-Infinity) == NaN 3540 // Math.sqrt(-Infinity) == NaN
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
5573 __ LoadP(result, 5577 __ LoadP(result,
5574 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); 5578 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize));
5575 __ bind(deferred->exit()); 5579 __ bind(deferred->exit());
5576 __ bind(&done); 5580 __ bind(&done);
5577 } 5581 }
5578 5582
5579 #undef __ 5583 #undef __
5580 5584
5581 } // namespace internal 5585 } // namespace internal
5582 } // namespace v8 5586 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/s390/lithium-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698