| OLD | NEW |
| 1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// | 1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// |
| 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 /// \file | 10 /// \file |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 Type Ty = this->getSrc(0)->getType(); | 998 Type Ty = this->getSrc(0)->getType(); |
| 999 assert(isScalarFloatingType(Ty)); | 999 assert(isScalarFloatingType(Ty)); |
| 1000 Str << "\tsqrt" << InstX86Base<Machine>::Traits::TypeAttributes[Ty].SdSsString | 1000 Str << "\tsqrt" << InstX86Base<Machine>::Traits::TypeAttributes[Ty].SdSsString |
| 1001 << "\t"; | 1001 << "\t"; |
| 1002 this->getSrc(0)->emit(Func); | 1002 this->getSrc(0)->emit(Func); |
| 1003 Str << ", "; | 1003 Str << ", "; |
| 1004 this->getDest()->emit(Func); | 1004 this->getDest()->emit(Func); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 template <class Machine> | 1007 template <class Machine> |
| 1008 void InstX86Addss<Machine>::emit(const Cfg *Func) const { | |
| 1009 if (!BuildDefs::dump()) | |
| 1010 return; | |
| 1011 char buf[30]; | |
| 1012 snprintf( | |
| 1013 buf, llvm::array_lengthof(buf), "add%s", | |
| 1014 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1015 .SdSsString); | |
| 1016 this->emitTwoAddress(buf, this, Func); | |
| 1017 } | |
| 1018 | |
| 1019 template <class Machine> | |
| 1020 void InstX86Padd<Machine>::emit(const Cfg *Func) const { | 1008 void InstX86Padd<Machine>::emit(const Cfg *Func) const { |
| 1021 if (!BuildDefs::dump()) | 1009 if (!BuildDefs::dump()) |
| 1022 return; | 1010 return; |
| 1023 char buf[30]; | 1011 char buf[30]; |
| 1024 snprintf( | 1012 snprintf( |
| 1025 buf, llvm::array_lengthof(buf), "padd%s", | 1013 buf, llvm::array_lengthof(buf), "padd%s", |
| 1026 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | 1014 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] |
| 1027 .PackString); | 1015 .PackString); |
| 1028 this->emitTwoAddress(buf, this, Func); | 1016 this->emitTwoAddress(buf, this, Func); |
| 1029 } | 1017 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 (void)InstructionSetIsValid; | 1050 (void)InstructionSetIsValid; |
| 1063 assert(TypesAreValid); | 1051 assert(TypesAreValid); |
| 1064 assert(InstructionSetIsValid); | 1052 assert(InstructionSetIsValid); |
| 1065 assert(this->getSrcSize() == 2); | 1053 assert(this->getSrcSize() == 2); |
| 1066 Type ElementTy = typeElementType(Ty); | 1054 Type ElementTy = typeElementType(Ty); |
| 1067 emitIASRegOpTyXMM<Machine>(Func, ElementTy, this->getDest(), this->getSrc(1), | 1055 emitIASRegOpTyXMM<Machine>(Func, ElementTy, this->getDest(), this->getSrc(1), |
| 1068 this->Emitter); | 1056 this->Emitter); |
| 1069 } | 1057 } |
| 1070 | 1058 |
| 1071 template <class Machine> | 1059 template <class Machine> |
| 1072 void InstX86Subss<Machine>::emit(const Cfg *Func) const { | |
| 1073 if (!BuildDefs::dump()) | |
| 1074 return; | |
| 1075 char buf[30]; | |
| 1076 snprintf( | |
| 1077 buf, llvm::array_lengthof(buf), "sub%s", | |
| 1078 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1079 .SdSsString); | |
| 1080 this->emitTwoAddress(buf, this, Func); | |
| 1081 } | |
| 1082 | |
| 1083 template <class Machine> | |
| 1084 void InstX86Psub<Machine>::emit(const Cfg *Func) const { | 1060 void InstX86Psub<Machine>::emit(const Cfg *Func) const { |
| 1085 if (!BuildDefs::dump()) | 1061 if (!BuildDefs::dump()) |
| 1086 return; | 1062 return; |
| 1087 char buf[30]; | 1063 char buf[30]; |
| 1088 snprintf( | 1064 snprintf( |
| 1089 buf, llvm::array_lengthof(buf), "psub%s", | 1065 buf, llvm::array_lengthof(buf), "psub%s", |
| 1090 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | 1066 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] |
| 1091 .PackString); | 1067 .PackString); |
| 1092 this->emitTwoAddress(buf, this, Func); | 1068 this->emitTwoAddress(buf, this, Func); |
| 1093 } | 1069 } |
| 1094 | 1070 |
| 1095 template <class Machine> | 1071 template <class Machine> |
| 1096 void InstX86Mulss<Machine>::emit(const Cfg *Func) const { | |
| 1097 if (!BuildDefs::dump()) | |
| 1098 return; | |
| 1099 char buf[30]; | |
| 1100 snprintf( | |
| 1101 buf, llvm::array_lengthof(buf), "mul%s", | |
| 1102 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1103 .SdSsString); | |
| 1104 this->emitTwoAddress(buf, this, Func); | |
| 1105 } | |
| 1106 | |
| 1107 template <class Machine> | |
| 1108 void InstX86Andnps<Machine>::emit(const Cfg *Func) const { | |
| 1109 if (!BuildDefs::dump()) | |
| 1110 return; | |
| 1111 | |
| 1112 char buf[30]; | |
| 1113 snprintf( | |
| 1114 buf, llvm::array_lengthof(buf), "%s%s", this->Opcode, | |
| 1115 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1116 .PdPsString); | |
| 1117 this->emitTwoAddress(buf, this, Func); | |
| 1118 } | |
| 1119 | |
| 1120 template <class Machine> | |
| 1121 void InstX86Andps<Machine>::emit(const Cfg *Func) const { | |
| 1122 if (!BuildDefs::dump()) | |
| 1123 return; | |
| 1124 | |
| 1125 char buf[30]; | |
| 1126 snprintf( | |
| 1127 buf, llvm::array_lengthof(buf), "%s%s", this->Opcode, | |
| 1128 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1129 .PdPsString); | |
| 1130 this->emitTwoAddress(buf, this, Func); | |
| 1131 } | |
| 1132 | |
| 1133 template <class Machine> | |
| 1134 void InstX86Maxss<Machine>::emit(const Cfg *Func) const { | |
| 1135 if (!BuildDefs::dump()) | |
| 1136 return; | |
| 1137 | |
| 1138 char buf[30]; | |
| 1139 snprintf( | |
| 1140 buf, llvm::array_lengthof(buf), "%s%s", this->Opcode, | |
| 1141 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1142 .SdSsString); | |
| 1143 this->emitTwoAddress(buf, this, Func); | |
| 1144 } | |
| 1145 | |
| 1146 template <class Machine> | |
| 1147 void InstX86Minss<Machine>::emit(const Cfg *Func) const { | |
| 1148 if (!BuildDefs::dump()) | |
| 1149 return; | |
| 1150 | |
| 1151 char buf[30]; | |
| 1152 snprintf( | |
| 1153 buf, llvm::array_lengthof(buf), "%s%s", this->Opcode, | |
| 1154 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1155 .SdSsString); | |
| 1156 this->emitTwoAddress(buf, this, Func); | |
| 1157 } | |
| 1158 | |
| 1159 template <class Machine> | |
| 1160 void InstX86Orps<Machine>::emit(const Cfg *Func) const { | |
| 1161 if (!BuildDefs::dump()) | |
| 1162 return; | |
| 1163 | |
| 1164 char buf[30]; | |
| 1165 snprintf( | |
| 1166 buf, llvm::array_lengthof(buf), "%s%s", this->Opcode, | |
| 1167 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1168 .PdPsString); | |
| 1169 this->emitTwoAddress(buf, this, Func); | |
| 1170 } | |
| 1171 | |
| 1172 template <class Machine> | |
| 1173 void InstX86Xorps<Machine>::emit(const Cfg *Func) const { | |
| 1174 if (!BuildDefs::dump()) | |
| 1175 return; | |
| 1176 | |
| 1177 char buf[30]; | |
| 1178 snprintf( | |
| 1179 buf, llvm::array_lengthof(buf), "%s%s", this->Opcode, | |
| 1180 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1181 .PdPsString); | |
| 1182 this->emitTwoAddress(buf, this, Func); | |
| 1183 } | |
| 1184 | |
| 1185 template <class Machine> | |
| 1186 void InstX86Pmuludq<Machine>::emit(const Cfg *Func) const { | 1072 void InstX86Pmuludq<Machine>::emit(const Cfg *Func) const { |
| 1187 if (!BuildDefs::dump()) | 1073 if (!BuildDefs::dump()) |
| 1188 return; | 1074 return; |
| 1189 assert(this->getSrc(0)->getType() == IceType_v4i32 && | 1075 assert(this->getSrc(0)->getType() == IceType_v4i32 && |
| 1190 this->getSrc(1)->getType() == IceType_v4i32); | 1076 this->getSrc(1)->getType() == IceType_v4i32); |
| 1191 this->emitTwoAddress(this->Opcode, this, Func); | 1077 this->emitTwoAddress(this->Opcode, this, Func); |
| 1192 } | 1078 } |
| 1193 | 1079 |
| 1194 template <class Machine> | |
| 1195 void InstX86Divss<Machine>::emit(const Cfg *Func) const { | |
| 1196 if (!BuildDefs::dump()) | |
| 1197 return; | |
| 1198 char buf[30]; | |
| 1199 snprintf( | |
| 1200 buf, llvm::array_lengthof(buf), "div%s", | |
| 1201 InstX86Base<Machine>::Traits::TypeAttributes[this->getDest()->getType()] | |
| 1202 .SdSsString); | |
| 1203 this->emitTwoAddress(buf, this, Func); | |
| 1204 } | |
| 1205 | |
| 1206 template <class Machine> void InstX86Div<Machine>::emit(const Cfg *Func) const { | 1080 template <class Machine> void InstX86Div<Machine>::emit(const Cfg *Func) const { |
| 1207 if (!BuildDefs::dump()) | 1081 if (!BuildDefs::dump()) |
| 1208 return; | 1082 return; |
| 1209 Ostream &Str = Func->getContext()->getStrEmit(); | 1083 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1210 assert(this->getSrcSize() == 3); | 1084 assert(this->getSrcSize() == 3); |
| 1211 Operand *Src1 = this->getSrc(1); | 1085 Operand *Src1 = this->getSrc(1); |
| 1212 Str << "\t" << this->Opcode << this->getWidthString(Src1->getType()) << "\t"; | 1086 Str << "\t" << this->Opcode << this->getWidthString(Src1->getType()) << "\t"; |
| 1213 Src1->emit(Func); | 1087 Src1->emit(Func); |
| 1214 } | 1088 } |
| 1215 | 1089 |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 return; | 3141 return; |
| 3268 Ostream &Str = Func->getContext()->getStrDump(); | 3142 Ostream &Str = Func->getContext()->getStrDump(); |
| 3269 Str << "IACA_END"; | 3143 Str << "IACA_END"; |
| 3270 } | 3144 } |
| 3271 | 3145 |
| 3272 } // end of namespace X86Internal | 3146 } // end of namespace X86Internal |
| 3273 | 3147 |
| 3274 } // end of namespace Ice | 3148 } // end of namespace Ice |
| 3275 | 3149 |
| 3276 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H | 3150 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H |
| OLD | NEW |