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

Side by Side Diff: src/IceInstX8632.cpp

Issue 650573002: emitIAS for the couple of blend instructions. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: remove isa Created 6 years, 2 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/IceInstX8632.h ('k') | src/assembler_ia32.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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 emitIASOpTyGPR(Func, Ty, Src, Emitter); 1060 emitIASOpTyGPR(Func, Ty, Src, Emitter);
1061 } 1061 }
1062 1062
1063 namespace { 1063 namespace {
1064 1064
1065 // pblendvb and blendvps take xmm0 as a final implicit argument. 1065 // pblendvb and blendvps take xmm0 as a final implicit argument.
1066 void emitVariableBlendInst(const char *Opcode, const Inst *Inst, 1066 void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
1067 const Cfg *Func) { 1067 const Cfg *Func) {
1068 Ostream &Str = Func->getContext()->getStrEmit(); 1068 Ostream &Str = Func->getContext()->getStrEmit();
1069 assert(Inst->getSrcSize() == 3); 1069 assert(Inst->getSrcSize() == 3);
1070 assert(llvm::isa<Variable>(Inst->getSrc(2)));
1071 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == 1070 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() ==
1072 RegX8632::Reg_xmm0); 1071 RegX8632::Reg_xmm0);
1073 Str << "\t" << Opcode << "\t"; 1072 Str << "\t" << Opcode << "\t";
1074 Inst->getDest()->emit(Func); 1073 Inst->getDest()->emit(Func);
1075 Str << ", "; 1074 Str << ", ";
1076 Inst->getSrc(1)->emit(Func); 1075 Inst->getSrc(1)->emit(Func);
1077 Str << "\n"; 1076 Str << "\n";
1078 } 1077 }
1079 1078
1079 void
1080 emitIASVariableBlendInst(const Inst *Inst, const Cfg *Func,
1081 const x86::AssemblerX86::XmmEmitterRegOp &Emitter) {
1082 assert(Inst->getSrcSize() == 3);
1083 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() ==
1084 RegX8632::Reg_xmm0);
1085 const Variable *Dest = Inst->getDest();
1086 const Operand *Src = Inst->getSrc(1);
1087 emitIASRegOpTyXMM(Func, Dest->getType(), Dest, Src, Emitter);
1088 }
1089
1080 } // end anonymous namespace 1090 } // end anonymous namespace
1081 1091
1082 template <> void InstX8632Blendvps::emit(const Cfg *Func) const { 1092 template <> void InstX8632Blendvps::emit(const Cfg *Func) const {
1083 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= 1093 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
1084 TargetX8632::SSE4_1); 1094 TargetX8632::SSE4_1);
1085 emitVariableBlendInst(Opcode, this, Func); 1095 emitVariableBlendInst(Opcode, this, Func);
1086 } 1096 }
1087 1097
1098 template <> void InstX8632Blendvps::emitIAS(const Cfg *Func) const {
1099 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
1100 TargetX8632::SSE4_1);
1101 static const x86::AssemblerX86::XmmEmitterRegOp Emitter = {
1102 &x86::AssemblerX86::blendvps, &x86::AssemblerX86::blendvps};
1103 emitIASVariableBlendInst(this, Func, Emitter);
1104 }
1105
1088 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const { 1106 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const {
1089 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= 1107 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
1090 TargetX8632::SSE4_1); 1108 TargetX8632::SSE4_1);
1091 emitVariableBlendInst(Opcode, this, Func); 1109 emitVariableBlendInst(Opcode, this, Func);
1092 } 1110 }
1093 1111
1112 template <> void InstX8632Pblendvb::emitIAS(const Cfg *Func) const {
1113 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >=
1114 TargetX8632::SSE4_1);
1115 static const x86::AssemblerX86::XmmEmitterRegOp Emitter = {
1116 &x86::AssemblerX86::pblendvb, &x86::AssemblerX86::pblendvb};
1117 emitIASVariableBlendInst(this, Func, Emitter);
1118 }
1119
1094 template <> void InstX8632Imul::emit(const Cfg *Func) const { 1120 template <> void InstX8632Imul::emit(const Cfg *Func) const {
1095 Ostream &Str = Func->getContext()->getStrEmit(); 1121 Ostream &Str = Func->getContext()->getStrEmit();
1096 assert(getSrcSize() == 2); 1122 assert(getSrcSize() == 2);
1097 if (isByteSizedArithType(getDest()->getType())) { 1123 if (isByteSizedArithType(getDest()->getType())) {
1098 // The 8-bit version of imul only allows the form "imul r/m8". 1124 // The 8-bit version of imul only allows the form "imul r/m8".
1099 Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0)); 1125 Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0));
1100 (void)Src0; 1126 (void)Src0;
1101 assert(Src0 && Src0->getRegNum() == RegX8632::Reg_eax); 1127 assert(Src0 && Src0->getRegNum() == RegX8632::Reg_eax);
1102 Str << "\timul\t"; 1128 Str << "\timul\t";
1103 getSrc(1)->emit(Func); 1129 getSrc(1)->emit(Func);
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 } 2564 }
2539 Str << "("; 2565 Str << "(";
2540 if (Func) 2566 if (Func)
2541 Var->dump(Func); 2567 Var->dump(Func);
2542 else 2568 else
2543 Var->dump(Str); 2569 Var->dump(Str);
2544 Str << ")"; 2570 Str << ")";
2545 } 2571 }
2546 2572
2547 } // end of namespace Ice 2573 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstX8632.h ('k') | src/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698