Commit 5a13f456 by Jan Voung

Add ss/sd suffix to InstX8632Store and legalize FP constants.

InstX8632Store is essentially a "mov" and it would emit a mov, but it did not add the ss/sd suffix based on the operand type. Also, there are some cases where legalization would leave two memory operands in the case that one of them is a floating point immediate: storeDoubleConst: .LstoreDoubleConst$entry: mov eax, dword ptr [esp+4] mov qword ptr [eax], qword ptr [L$double$1] ret BUG=none R=stichnot@chromium.org, wala@chromium.org Review URL: https://codereview.chromium.org/341683002
parent 43ff7ebe
...@@ -544,7 +544,8 @@ void InstX8632Test::dump(const Cfg *Func) const { ...@@ -544,7 +544,8 @@ void InstX8632Test::dump(const Cfg *Func) const {
void InstX8632Store::emit(const Cfg *Func) const { void InstX8632Store::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2); assert(getSrcSize() == 2);
Str << "\tmov\t"; Str << "\tmov" << TypeX8632Attributes[getSrc(0)->getType()].SdSsString
<< "\t";
getSrc(1)->emit(Func); getSrc(1)->emit(Func);
Str << ", "; Str << ", ";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
......
...@@ -2174,7 +2174,11 @@ Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed, ...@@ -2174,7 +2174,11 @@ Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed,
// need to go in uninitialized registers. // need to go in uninitialized registers.
From = Ctx->getConstantZero(From->getType()); From = Ctx->getConstantZero(From->getType());
} }
if (!(Allowed & Legal_Imm)) { bool NeedsReg = !(Allowed & Legal_Imm) ||
// ConstantFloat and ConstantDouble are actually memory operands.
(!(Allowed & Legal_Mem) && (From->getType() == IceType_f32 ||
From->getType() == IceType_f64));
if (NeedsReg) {
Variable *Reg = makeReg(From->getType(), RegNum); Variable *Reg = makeReg(From->getType(), RegNum);
_mov(Reg, From); _mov(Reg, From);
From = Reg; From = Reg;
......
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