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

Side by Side Diff: src/IceInstX8632.cpp

Issue 372113005: Add support for passing and returning vectors in accordance with the x86 calling convention. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Reset AllowOverlap, add comment on lowerCall() strategies, and use X86_MAX_XMM_ARGS where appropria… Created 6 years, 5 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 | « src/IceDefs.h ('k') | src/IceOperand.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===// 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the InstX8632 and OperandX8632 classes, 10 // This file implements the InstX8632 and OperandX8632 classes,
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 // operands. 722 // operands.
723 Ostream &Str = Func->getContext()->getStrEmit(); 723 Ostream &Str = Func->getContext()->getStrEmit();
724 assert(getSrcSize() == 1); 724 assert(getSrcSize() == 1);
725 Str << "\tmovups\t"; 725 Str << "\tmovups\t";
726 getDest()->emit(Func); 726 getDest()->emit(Func);
727 Str << ", "; 727 Str << ", ";
728 getSrc(0)->emit(Func); 728 getSrc(0)->emit(Func);
729 Str << "\n"; 729 Str << "\n";
730 } 730 }
731 731
732 void InstX8632Movp::dump(const Cfg *Func) const {
733 Ostream &Str = Func->getContext()->getStrDump();
734 Str << "movups." << getDest()->getType() << " ";
735 dumpDest(Func);
736 Str << ", ";
737 dumpSources(Func);
738 }
739
732 void InstX8632Movq::emit(const Cfg *Func) const { 740 void InstX8632Movq::emit(const Cfg *Func) const {
733 Ostream &Str = Func->getContext()->getStrEmit(); 741 Ostream &Str = Func->getContext()->getStrEmit();
734 assert(getSrcSize() == 1); 742 assert(getSrcSize() == 1);
735 assert(getDest()->getType() == IceType_i64 || 743 assert(getDest()->getType() == IceType_i64 ||
736 getDest()->getType() == IceType_f64); 744 getDest()->getType() == IceType_f64);
737 Str << "\tmovq\t"; 745 Str << "\tmovq\t";
738 getDest()->emit(Func); 746 getDest()->emit(Func);
739 Str << ", "; 747 Str << ", ";
740 getSrc(0)->emit(Func); 748 getSrc(0)->emit(Func);
741 Str << "\n"; 749 Str << "\n";
742 } 750 }
743 751
744 void InstX8632Movp::dump(const Cfg *Func) const {
745 Ostream &Str = Func->getContext()->getStrDump();
746 Str << "movups." << getDest()->getType() << " ";
747 dumpDest(Func);
748 Str << ", ";
749 dumpSources(Func);
750 }
751
752 void InstX8632Movq::dump(const Cfg *Func) const { 752 void InstX8632Movq::dump(const Cfg *Func) const {
753 Ostream &Str = Func->getContext()->getStrDump(); 753 Ostream &Str = Func->getContext()->getStrDump();
754 Str << "movq." << getDest()->getType() << " "; 754 Str << "movq." << getDest()->getType() << " ";
755 dumpDest(Func); 755 dumpDest(Func);
756 Str << ", "; 756 Str << ", ";
757 dumpSources(Func); 757 dumpSources(Func);
758 } 758 }
759 759
760 void InstX8632Movsx::emit(const Cfg *Func) const { 760 void InstX8632Movsx::emit(const Cfg *Func) const {
761 Ostream &Str = Func->getContext()->getStrEmit(); 761 Ostream &Str = Func->getContext()->getStrEmit();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 Ostream &Str = Func->getContext()->getStrDump(); 870 Ostream &Str = Func->getContext()->getStrDump();
871 dumpDest(Func); 871 dumpDest(Func);
872 Str << " = pop." << getDest()->getType() << " "; 872 Str << " = pop." << getDest()->getType() << " ";
873 } 873 }
874 874
875 void InstX8632Push::emit(const Cfg *Func) const { 875 void InstX8632Push::emit(const Cfg *Func) const {
876 Ostream &Str = Func->getContext()->getStrEmit(); 876 Ostream &Str = Func->getContext()->getStrEmit();
877 assert(getSrcSize() == 1); 877 assert(getSrcSize() == 1);
878 Type Ty = getSrc(0)->getType(); 878 Type Ty = getSrc(0)->getType();
879 Variable *Var = llvm::dyn_cast<Variable>(getSrc(0)); 879 Variable *Var = llvm::dyn_cast<Variable>(getSrc(0));
880 if ((Ty == IceType_f32 || Ty == IceType_f64) && Var && Var->hasReg()) { 880 if ((isVectorType(Ty) || Ty == IceType_f32 || Ty == IceType_f64) && Var &&
881 Var->hasReg()) {
881 // The xmm registers can't be directly pushed, so we fake it by 882 // The xmm registers can't be directly pushed, so we fake it by
882 // decrementing esp and then storing to [esp]. 883 // decrementing esp and then storing to [esp].
883 Str << "\tsub\tesp, " << typeWidthInBytes(Ty) << "\n"; 884 Str << "\tsub\tesp, " << typeWidthInBytes(Ty) << "\n";
884 if (!SuppressStackAdjustment) 885 if (!SuppressStackAdjustment)
885 Func->getTarget()->updateStackAdjustment(typeWidthInBytes(Ty)); 886 Func->getTarget()->updateStackAdjustment(typeWidthInBytes(Ty));
886 Str << "\tmov" << TypeX8632Attributes[Ty].SdSsString << "\t" 887 if (isVectorType(Ty)) {
887 << TypeX8632Attributes[Ty].WidthString << " [esp], "; 888 Str << "\tmovups\txmmword ptr [esp], ";
889 } else {
890 Str << "\tmov" << TypeX8632Attributes[Ty].SdSsString << "\t"
891 << TypeX8632Attributes[Ty].WidthString << " [esp], ";
892 }
888 getSrc(0)->emit(Func); 893 getSrc(0)->emit(Func);
889 Str << "\n"; 894 Str << "\n";
890 } else if (Ty == IceType_f64 && (!Var || !Var->hasReg())) { 895 } else if (Ty == IceType_f64 && (!Var || !Var->hasReg())) {
891 // A double on the stack has to be pushed as two halves. Push the 896 // A double on the stack has to be pushed as two halves. Push the
892 // upper half followed by the lower half for little-endian. TODO: 897 // upper half followed by the lower half for little-endian. TODO:
893 // implement. 898 // implement.
894 llvm_unreachable("Missing support for pushing doubles from memory"); 899 llvm_unreachable("Missing support for pushing doubles from memory");
895 } else { 900 } else {
896 Str << "\tpush\t"; 901 Str << "\tpush\t";
897 getSrc(0)->emit(Func); 902 getSrc(0)->emit(Func);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 default: 1073 default:
1069 Str << "???"; 1074 Str << "???";
1070 break; 1075 break;
1071 } 1076 }
1072 Str << "("; 1077 Str << "(";
1073 Var->dump(Func); 1078 Var->dump(Func);
1074 Str << ")"; 1079 Str << ")";
1075 } 1080 }
1076 1081
1077 } // end of namespace Ice 1082 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceDefs.h ('k') | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698