Commit 731af7a4 authored by jyan's avatar jyan Committed by Commit bot

s390: optimize MathSqrt

R=joransiu@ca.ibm.com, bjaideep@ca.ibm.com
BUG=

Review-Url: https://codereview.chromium.org/2615683003
Cr-Commit-Position: refs/heads/master@{#42077}
parent e968595b
......@@ -3521,9 +3521,13 @@ void LCodeGen::DoMathFround(LMathFround* instr) {
}
void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
DoubleRegister input = ToDoubleRegister(instr->value());
DoubleRegister result = ToDoubleRegister(instr->result());
__ sqdbr(result, input);
LOperand* input = instr->value();
if (input->IsDoubleRegister()) {
__ Sqrt(result, ToDoubleRegister(instr->value()));
} else {
__ Sqrt(result, ToMemOperand(input));
}
}
void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
......
......@@ -1058,7 +1058,7 @@ LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
}
LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
LOperand* input = UseRegisterAtStart(instr->value());
LOperand* input = UseAtStart(instr->value());
LMathSqrt* result = new (zone()) LMathSqrt(input);
return DefineAsRegister(result);
}
......
......@@ -3342,6 +3342,17 @@ void MacroAssembler::MulP(Register dst, const MemOperand& opnd) {
#endif
}
void MacroAssembler::Sqrt(DoubleRegister result, DoubleRegister input) {
sqdbr(result, input);
}
void MacroAssembler::Sqrt(DoubleRegister result, const MemOperand& input) {
if (is_uint12(input.offset())) {
sqdb(result, input);
} else {
ldy(result, input);
sqdbr(result, result);
}
}
//----------------------------------------------------------------------------
// Add Instructions
//----------------------------------------------------------------------------
......
......@@ -323,6 +323,10 @@ class MacroAssembler : public Assembler {
// Divide
void DivP(Register dividend, Register divider);
// Square root
void Sqrt(DoubleRegister result, DoubleRegister input);
void Sqrt(DoubleRegister result, const MemOperand& input);
// Compare
void Cmp32(Register src1, Register src2);
void CmpP(Register src1, Register src2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment