Add support for passing and returning vectors in accordance with the x86 calling convention. - Add TargetLowering::lowerArguments() as a new stage in TargetLowering. - Add support for passing arguments/return values in XMM registers in the x86 target. BUG=none R=jvoung@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/372113005
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp index 63e2cd7..a3f0786 100644 --- a/src/IceInstX8632.cpp +++ b/src/IceInstX8632.cpp
@@ -734,6 +734,14 @@ Str << "\n"; } +void InstX8632Movp::dump(const Cfg *Func) const { + Ostream &Str = Func->getContext()->getStrDump(); + Str << "movups." << getDest()->getType() << " "; + dumpDest(Func); + Str << ", "; + dumpSources(Func); +} + void InstX8632Movq::emit(const Cfg *Func) const { Ostream &Str = Func->getContext()->getStrEmit(); assert(getSrcSize() == 1); @@ -746,14 +754,6 @@ Str << "\n"; } -void InstX8632Movp::dump(const Cfg *Func) const { - Ostream &Str = Func->getContext()->getStrDump(); - Str << "movups." << getDest()->getType() << " "; - dumpDest(Func); - Str << ", "; - dumpSources(Func); -} - void InstX8632Movq::dump(const Cfg *Func) const { Ostream &Str = Func->getContext()->getStrDump(); Str << "movq." << getDest()->getType() << " "; @@ -882,14 +882,19 @@ assert(getSrcSize() == 1); Type Ty = getSrc(0)->getType(); Variable *Var = llvm::dyn_cast<Variable>(getSrc(0)); - if ((Ty == IceType_f32 || Ty == IceType_f64) && Var && Var->hasReg()) { + if ((isVectorType(Ty) || Ty == IceType_f32 || Ty == IceType_f64) && Var && + Var->hasReg()) { // The xmm registers can't be directly pushed, so we fake it by // decrementing esp and then storing to [esp]. Str << "\tsub\tesp, " << typeWidthInBytes(Ty) << "\n"; if (!SuppressStackAdjustment) Func->getTarget()->updateStackAdjustment(typeWidthInBytes(Ty)); - Str << "\tmov" << TypeX8632Attributes[Ty].SdSsString << "\t" - << TypeX8632Attributes[Ty].WidthString << " [esp], "; + if (isVectorType(Ty)) { + Str << "\tmovups\txmmword ptr [esp], "; + } else { + Str << "\tmov" << TypeX8632Attributes[Ty].SdSsString << "\t" + << TypeX8632Attributes[Ty].WidthString << " [esp], "; + } getSrc(0)->emit(Func); Str << "\n"; } else if (Ty == IceType_f64 && (!Var || !Var->hasReg())) {