OLD | NEW |
---|---|
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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1070 assert(llvm::isa<Variable>(Inst->getSrc(2))); | 1070 assert(llvm::isa<Variable>(Inst->getSrc(2))); |
1071 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == | 1071 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == |
1072 RegX8632::Reg_xmm0); | 1072 RegX8632::Reg_xmm0); |
1073 Str << "\t" << Opcode << "\t"; | 1073 Str << "\t" << Opcode << "\t"; |
1074 Inst->getDest()->emit(Func); | 1074 Inst->getDest()->emit(Func); |
1075 Str << ", "; | 1075 Str << ", "; |
1076 Inst->getSrc(1)->emit(Func); | 1076 Inst->getSrc(1)->emit(Func); |
1077 Str << "\n"; | 1077 Str << "\n"; |
1078 } | 1078 } |
1079 | 1079 |
1080 void | |
1081 emitIASVariableBlendInst(const Inst *Inst, const Cfg *Func, | |
1082 const x86::AssemblerX86::XmmEmitterRegOp &Emitter) { | |
1083 assert(Inst->getSrcSize() == 3); | |
1084 assert(llvm::isa<Variable>(Inst->getSrc(2))); | |
Jim Stichnoth
2014/10/13 16:07:32
Won't the cast include the isa test?
jvoung (off chromium)
2014/10/13 21:04:00
Done -- yep, removed
| |
1085 assert(llvm::cast<Variable>(Inst->getSrc(2))->getRegNum() == | |
1086 RegX8632::Reg_xmm0); | |
1087 const Variable *Dest = Inst->getDest(); | |
1088 const Operand *Src = Inst->getSrc(1); | |
1089 emitIASRegOpTyXMM(Func, Dest->getType(), Dest, Src, Emitter); | |
1090 } | |
1091 | |
1080 } // end anonymous namespace | 1092 } // end anonymous namespace |
1081 | 1093 |
1082 template <> void InstX8632Blendvps::emit(const Cfg *Func) const { | 1094 template <> void InstX8632Blendvps::emit(const Cfg *Func) const { |
1083 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= | 1095 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= |
1084 TargetX8632::SSE4_1); | 1096 TargetX8632::SSE4_1); |
1085 emitVariableBlendInst(Opcode, this, Func); | 1097 emitVariableBlendInst(Opcode, this, Func); |
1086 } | 1098 } |
1087 | 1099 |
1100 template <> void InstX8632Blendvps::emitIAS(const Cfg *Func) const { | |
1101 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= | |
1102 TargetX8632::SSE4_1); | |
1103 static const x86::AssemblerX86::XmmEmitterRegOp Emitter = { | |
1104 &x86::AssemblerX86::blendvps, &x86::AssemblerX86::blendvps}; | |
1105 emitIASVariableBlendInst(this, Func, Emitter); | |
1106 } | |
1107 | |
1088 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const { | 1108 template <> void InstX8632Pblendvb::emit(const Cfg *Func) const { |
1089 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= | 1109 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= |
1090 TargetX8632::SSE4_1); | 1110 TargetX8632::SSE4_1); |
1091 emitVariableBlendInst(Opcode, this, Func); | 1111 emitVariableBlendInst(Opcode, this, Func); |
1092 } | 1112 } |
1093 | 1113 |
1114 template <> void InstX8632Pblendvb::emitIAS(const Cfg *Func) const { | |
1115 assert(static_cast<TargetX8632 *>(Func->getTarget())->getInstructionSet() >= | |
1116 TargetX8632::SSE4_1); | |
1117 static const x86::AssemblerX86::XmmEmitterRegOp Emitter = { | |
1118 &x86::AssemblerX86::pblendvb, &x86::AssemblerX86::pblendvb}; | |
1119 emitIASVariableBlendInst(this, Func, Emitter); | |
1120 } | |
1121 | |
1094 template <> void InstX8632Imul::emit(const Cfg *Func) const { | 1122 template <> void InstX8632Imul::emit(const Cfg *Func) const { |
1095 Ostream &Str = Func->getContext()->getStrEmit(); | 1123 Ostream &Str = Func->getContext()->getStrEmit(); |
1096 assert(getSrcSize() == 2); | 1124 assert(getSrcSize() == 2); |
1097 if (isByteSizedArithType(getDest()->getType())) { | 1125 if (isByteSizedArithType(getDest()->getType())) { |
1098 // The 8-bit version of imul only allows the form "imul r/m8". | 1126 // The 8-bit version of imul only allows the form "imul r/m8". |
1099 Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0)); | 1127 Variable *Src0 = llvm::dyn_cast<Variable>(getSrc(0)); |
1100 (void)Src0; | 1128 (void)Src0; |
1101 assert(Src0 && Src0->getRegNum() == RegX8632::Reg_eax); | 1129 assert(Src0 && Src0->getRegNum() == RegX8632::Reg_eax); |
1102 Str << "\timul\t"; | 1130 Str << "\timul\t"; |
1103 getSrc(1)->emit(Func); | 1131 getSrc(1)->emit(Func); |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2538 } | 2566 } |
2539 Str << "("; | 2567 Str << "("; |
2540 if (Func) | 2568 if (Func) |
2541 Var->dump(Func); | 2569 Var->dump(Func); |
2542 else | 2570 else |
2543 Var->dump(Str); | 2571 Var->dump(Str); |
2544 Str << ")"; | 2572 Str << ")"; |
2545 } | 2573 } |
2546 | 2574 |
2547 } // end of namespace Ice | 2575 } // end of namespace Ice |
OLD | NEW |