Refactor kScrachDoubleReg usages to temp double registers
Bug: v8:9528 Change-Id: I7df27c3ee949a4c44fa0f78cfded6d8c34575e6b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1754445 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Zhi An Ng <zhin@chromium.org> Cr-Commit-Position: refs/heads/master@{#63292}
This commit is contained in:
parent
14cb014726
commit
6cc107e935
@ -1339,16 +1339,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
break;
|
break;
|
||||||
case kSSEFloat32Abs: {
|
case kSSEFloat32Abs: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
__ Pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ Psrlq(kScratchDoubleReg, 33);
|
__ Pcmpeqd(tmp, tmp);
|
||||||
__ Andps(i.OutputDoubleRegister(), kScratchDoubleReg);
|
__ Psrlq(tmp, 33);
|
||||||
|
__ Andps(i.OutputDoubleRegister(), tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kSSEFloat32Neg: {
|
case kSSEFloat32Neg: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
__ Pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ Psllq(kScratchDoubleReg, 31);
|
__ Pcmpeqd(tmp, tmp);
|
||||||
__ Xorps(i.OutputDoubleRegister(), kScratchDoubleReg);
|
__ Psllq(tmp, 31);
|
||||||
|
__ Xorps(i.OutputDoubleRegister(), tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kSSEFloat32Sqrt:
|
case kSSEFloat32Sqrt:
|
||||||
@ -1550,17 +1552,19 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
case kX64F64x2Abs:
|
case kX64F64x2Abs:
|
||||||
case kSSEFloat64Abs: {
|
case kSSEFloat64Abs: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
__ Pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ Psrlq(kScratchDoubleReg, 1);
|
__ Pcmpeqd(tmp, tmp);
|
||||||
__ Andpd(i.OutputDoubleRegister(), kScratchDoubleReg);
|
__ Psrlq(tmp, 1);
|
||||||
|
__ Andpd(i.OutputDoubleRegister(), tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kX64F64x2Neg:
|
case kX64F64x2Neg:
|
||||||
case kSSEFloat64Neg: {
|
case kSSEFloat64Neg: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
__ Pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ Psllq(kScratchDoubleReg, 63);
|
__ Pcmpeqd(tmp, tmp);
|
||||||
__ Xorpd(i.OutputDoubleRegister(), kScratchDoubleReg);
|
__ Psllq(tmp, 63);
|
||||||
|
__ Xorpd(i.OutputDoubleRegister(), tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kSSEFloat64Sqrt:
|
case kSSEFloat64Sqrt:
|
||||||
@ -1818,56 +1822,52 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
|||||||
case kAVXFloat32Abs: {
|
case kAVXFloat32Abs: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
CpuFeatureScope avx_scope(tasm(), AVX);
|
CpuFeatureScope avx_scope(tasm(), AVX);
|
||||||
__ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ vpsrlq(kScratchDoubleReg, kScratchDoubleReg, 33);
|
__ vpcmpeqd(tmp, tmp, tmp);
|
||||||
|
__ vpsrlq(tmp, tmp, 33);
|
||||||
if (instr->InputAt(0)->IsFPRegister()) {
|
if (instr->InputAt(0)->IsFPRegister()) {
|
||||||
__ vandps(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vandps(i.OutputDoubleRegister(), tmp, i.InputDoubleRegister(0));
|
||||||
i.InputDoubleRegister(0));
|
|
||||||
} else {
|
} else {
|
||||||
__ vandps(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vandps(i.OutputDoubleRegister(), tmp, i.InputOperand(0));
|
||||||
i.InputOperand(0));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kAVXFloat32Neg: {
|
case kAVXFloat32Neg: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
CpuFeatureScope avx_scope(tasm(), AVX);
|
CpuFeatureScope avx_scope(tasm(), AVX);
|
||||||
__ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ vpsllq(kScratchDoubleReg, kScratchDoubleReg, 31);
|
__ vpcmpeqd(tmp, tmp, tmp);
|
||||||
|
__ vpsllq(tmp, tmp, 31);
|
||||||
if (instr->InputAt(0)->IsFPRegister()) {
|
if (instr->InputAt(0)->IsFPRegister()) {
|
||||||
__ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vxorps(i.OutputDoubleRegister(), tmp, i.InputDoubleRegister(0));
|
||||||
i.InputDoubleRegister(0));
|
|
||||||
} else {
|
} else {
|
||||||
__ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vxorps(i.OutputDoubleRegister(), tmp, i.InputOperand(0));
|
||||||
i.InputOperand(0));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kAVXFloat64Abs: {
|
case kAVXFloat64Abs: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
CpuFeatureScope avx_scope(tasm(), AVX);
|
CpuFeatureScope avx_scope(tasm(), AVX);
|
||||||
__ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ vpsrlq(kScratchDoubleReg, kScratchDoubleReg, 1);
|
__ vpcmpeqd(tmp, tmp, tmp);
|
||||||
|
__ vpsrlq(tmp, tmp, 1);
|
||||||
if (instr->InputAt(0)->IsFPRegister()) {
|
if (instr->InputAt(0)->IsFPRegister()) {
|
||||||
__ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vandpd(i.OutputDoubleRegister(), tmp, i.InputDoubleRegister(0));
|
||||||
i.InputDoubleRegister(0));
|
|
||||||
} else {
|
} else {
|
||||||
__ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vandpd(i.OutputDoubleRegister(), tmp, i.InputOperand(0));
|
||||||
i.InputOperand(0));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kAVXFloat64Neg: {
|
case kAVXFloat64Neg: {
|
||||||
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
// TODO(bmeurer): Use RIP relative 128-bit constants.
|
||||||
CpuFeatureScope avx_scope(tasm(), AVX);
|
CpuFeatureScope avx_scope(tasm(), AVX);
|
||||||
__ vpcmpeqd(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg);
|
XMMRegister tmp = i.ToDoubleRegister(instr->TempAt(0));
|
||||||
__ vpsllq(kScratchDoubleReg, kScratchDoubleReg, 63);
|
__ vpcmpeqd(tmp, tmp, tmp);
|
||||||
|
__ vpsllq(tmp, tmp, 63);
|
||||||
if (instr->InputAt(0)->IsFPRegister()) {
|
if (instr->InputAt(0)->IsFPRegister()) {
|
||||||
__ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vxorpd(i.OutputDoubleRegister(), tmp, i.InputDoubleRegister(0));
|
||||||
i.InputDoubleRegister(0));
|
|
||||||
} else {
|
} else {
|
||||||
__ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg,
|
__ vxorpd(i.OutputDoubleRegister(), tmp, i.InputOperand(0));
|
||||||
i.InputOperand(0));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1369,10 +1369,13 @@ void VisitFloatBinop(InstructionSelector* selector, Node* node,
|
|||||||
void VisitFloatUnop(InstructionSelector* selector, Node* node, Node* input,
|
void VisitFloatUnop(InstructionSelector* selector, Node* node, Node* input,
|
||||||
ArchOpcode avx_opcode, ArchOpcode sse_opcode) {
|
ArchOpcode avx_opcode, ArchOpcode sse_opcode) {
|
||||||
X64OperandGenerator g(selector);
|
X64OperandGenerator g(selector);
|
||||||
|
InstructionOperand temps[] = {g.TempDoubleRegister()};
|
||||||
if (selector->IsSupported(AVX)) {
|
if (selector->IsSupported(AVX)) {
|
||||||
selector->Emit(avx_opcode, g.DefineAsRegister(node), g.Use(input));
|
selector->Emit(avx_opcode, g.DefineAsRegister(node), g.UseUnique(input),
|
||||||
|
arraysize(temps), temps);
|
||||||
} else {
|
} else {
|
||||||
selector->Emit(sse_opcode, g.DefineSameAsFirst(node), g.UseRegister(input));
|
selector->Emit(sse_opcode, g.DefineSameAsFirst(node), g.UseRegister(input),
|
||||||
|
arraysize(temps), temps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2850,14 +2853,16 @@ void InstructionSelector::VisitS128Select(Node* node) {
|
|||||||
|
|
||||||
void InstructionSelector::VisitF64x2Abs(Node* node) {
|
void InstructionSelector::VisitF64x2Abs(Node* node) {
|
||||||
X64OperandGenerator g(this);
|
X64OperandGenerator g(this);
|
||||||
Emit(kX64F64x2Abs, g.DefineSameAsFirst(node),
|
InstructionOperand temps[] = {g.TempDoubleRegister()};
|
||||||
g.UseRegister(node->InputAt(0)));
|
Emit(kX64F64x2Abs, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)),
|
||||||
|
arraysize(temps), temps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstructionSelector::VisitF64x2Neg(Node* node) {
|
void InstructionSelector::VisitF64x2Neg(Node* node) {
|
||||||
X64OperandGenerator g(this);
|
X64OperandGenerator g(this);
|
||||||
Emit(kX64F64x2Neg, g.DefineSameAsFirst(node),
|
InstructionOperand temps[] = {g.TempDoubleRegister()};
|
||||||
g.UseRegister(node->InputAt(0)));
|
Emit(kX64F64x2Neg, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)),
|
||||||
|
arraysize(temps), temps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstructionSelector::VisitF32x4UConvertI32x4(Node* node) {
|
void InstructionSelector::VisitF32x4UConvertI32x4(Node* node) {
|
||||||
|
Loading…
Reference in New Issue
Block a user