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

Side by Side Diff: src/compiler/mips/code-generator-mips.cc

Issue 2534413002: MIPS: Improve Float(32|64)(Max|Min). (Closed)
Patch Set: MIPS: Improve Float(32|64)(Max|Min). Created 4 years 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/builtins/mips64/builtins-mips64.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compilation-info.h" 6 #include "src/compilation-info.h"
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 private: 263 private:
264 Register const object_; 264 Register const object_;
265 Register const index_; 265 Register const index_;
266 Register const value_; 266 Register const value_;
267 Register const scratch0_; 267 Register const scratch0_;
268 Register const scratch1_; 268 Register const scratch1_;
269 RecordWriteMode const mode_; 269 RecordWriteMode const mode_;
270 bool must_save_lr_; 270 bool must_save_lr_;
271 }; 271 };
272 272
273 #define CREATE_OOL_CLASS(ool_name, masm_ool_name, T) \
274 class ool_name final : public OutOfLineCode { \
275 public: \
276 ool_name(CodeGenerator* gen, T dst, T src1, T src2) \
277 : OutOfLineCode(gen), dst_(dst), src1_(src1), src2_(src2) {} \
278 \
279 void Generate() final { __ masm_ool_name(dst_, src1_, src2_); } \
280 \
281 private: \
282 T const dst_; \
283 T const src1_; \
284 T const src2_; \
285 }
286
287 CREATE_OOL_CLASS(OutOfLineFloat32Max, Float32MaxOutOfLine, FPURegister);
288 CREATE_OOL_CLASS(OutOfLineFloat32Min, Float32MinOutOfLine, FPURegister);
289 CREATE_OOL_CLASS(OutOfLineFloat64Max, Float64MaxOutOfLine, DoubleRegister);
290 CREATE_OOL_CLASS(OutOfLineFloat64Min, Float64MinOutOfLine, DoubleRegister);
291
292 #undef CREATE_OOL_CLASS
273 293
274 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { 294 Condition FlagsConditionToConditionCmp(FlagsCondition condition) {
275 switch (condition) { 295 switch (condition) {
276 case kEqual: 296 case kEqual:
277 return eq; 297 return eq;
278 case kNotEqual: 298 case kNotEqual:
279 return ne; 299 return ne;
280 case kSignedLessThan: 300 case kSignedLessThan:
281 return lt; 301 return lt;
282 case kSignedGreaterThanOrEqual: 302 case kSignedGreaterThanOrEqual:
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1252 }
1233 case kMipsFloat64RoundTiesEven: { 1253 case kMipsFloat64RoundTiesEven: {
1234 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round); 1254 ASSEMBLE_ROUND_DOUBLE_TO_DOUBLE(round);
1235 break; 1255 break;
1236 } 1256 }
1237 case kMipsFloat32RoundTiesEven: { 1257 case kMipsFloat32RoundTiesEven: {
1238 ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round); 1258 ASSEMBLE_ROUND_FLOAT_TO_FLOAT(round);
1239 break; 1259 break;
1240 } 1260 }
1241 case kMipsFloat32Max: { 1261 case kMipsFloat32Max: {
1242 Label compare_nan, done_compare; 1262 FPURegister dst = i.OutputSingleRegister();
1243 __ MaxNaNCheck_s(i.OutputSingleRegister(), i.InputSingleRegister(0), 1263 FPURegister src1 = i.InputSingleRegister(0);
1244 i.InputSingleRegister(1), &compare_nan); 1264 FPURegister src2 = i.InputSingleRegister(1);
1245 __ Branch(&done_compare); 1265 if (src1.is(src2)) {
1246 __ bind(&compare_nan); 1266 __ Move_s(dst, src1);
1247 __ Move(i.OutputSingleRegister(), 1267 } else {
1248 std::numeric_limits<float>::quiet_NaN()); 1268 auto ool = new (zone()) OutOfLineFloat32Max(this, dst, src1, src2);
1249 __ bind(&done_compare); 1269 __ Float32Max(dst, src1, src2, ool->entry());
1270 __ bind(ool->exit());
1271 }
1250 break; 1272 break;
1251 } 1273 }
1252 case kMipsFloat64Max: { 1274 case kMipsFloat64Max: {
1253 Label compare_nan, done_compare; 1275 DoubleRegister dst = i.OutputDoubleRegister();
1254 __ MaxNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1276 DoubleRegister src1 = i.InputDoubleRegister(0);
1255 i.InputDoubleRegister(1), &compare_nan); 1277 DoubleRegister src2 = i.InputDoubleRegister(1);
1256 __ Branch(&done_compare); 1278 if (src1.is(src2)) {
1257 __ bind(&compare_nan); 1279 __ Move_d(dst, src1);
1258 __ Move(i.OutputDoubleRegister(), 1280 } else {
1259 std::numeric_limits<double>::quiet_NaN()); 1281 auto ool = new (zone()) OutOfLineFloat64Max(this, dst, src1, src2);
1260 __ bind(&done_compare); 1282 __ Float64Max(dst, src1, src2, ool->entry());
1283 __ bind(ool->exit());
1284 }
1261 break; 1285 break;
1262 } 1286 }
1263 case kMipsFloat32Min: { 1287 case kMipsFloat32Min: {
1264 Label compare_nan, done_compare; 1288 FPURegister dst = i.OutputSingleRegister();
1265 __ MinNaNCheck_s(i.OutputSingleRegister(), i.InputSingleRegister(0), 1289 FPURegister src1 = i.InputSingleRegister(0);
1266 i.InputSingleRegister(1), &compare_nan); 1290 FPURegister src2 = i.InputSingleRegister(1);
1267 __ Branch(&done_compare); 1291 if (src1.is(src2)) {
1268 __ bind(&compare_nan); 1292 __ Move_s(dst, src1);
1269 __ Move(i.OutputSingleRegister(), 1293 } else {
1270 std::numeric_limits<float>::quiet_NaN()); 1294 auto ool = new (zone()) OutOfLineFloat32Min(this, dst, src1, src2);
1271 __ bind(&done_compare); 1295 __ Float32Min(dst, src1, src2, ool->entry());
1296 __ bind(ool->exit());
1297 }
1272 break; 1298 break;
1273 } 1299 }
1274 case kMipsFloat64Min: { 1300 case kMipsFloat64Min: {
1275 Label compare_nan, done_compare; 1301 DoubleRegister dst = i.OutputDoubleRegister();
1276 __ MinNaNCheck_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), 1302 DoubleRegister src1 = i.InputDoubleRegister(0);
1277 i.InputDoubleRegister(1), &compare_nan); 1303 DoubleRegister src2 = i.InputDoubleRegister(1);
1278 __ Branch(&done_compare); 1304 if (src1.is(src2)) {
1279 __ bind(&compare_nan); 1305 __ Move_d(dst, src1);
1280 __ Move(i.OutputDoubleRegister(), 1306 } else {
1281 std::numeric_limits<double>::quiet_NaN()); 1307 auto ool = new (zone()) OutOfLineFloat64Min(this, dst, src1, src2);
1282 __ bind(&done_compare); 1308 __ Float64Min(dst, src1, src2, ool->entry());
1309 __ bind(ool->exit());
1310 }
1283 break; 1311 break;
1284 } 1312 }
1285 case kMipsCvtSD: { 1313 case kMipsCvtSD: {
1286 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0)); 1314 __ cvt_s_d(i.OutputSingleRegister(), i.InputDoubleRegister(0));
1287 break; 1315 break;
1288 } 1316 }
1289 case kMipsCvtDS: { 1317 case kMipsCvtDS: {
1290 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0)); 1318 __ cvt_d_s(i.OutputDoubleRegister(), i.InputSingleRegister(0));
1291 break; 1319 break;
1292 } 1320 }
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 padding_size -= v8::internal::Assembler::kInstrSize; 2332 padding_size -= v8::internal::Assembler::kInstrSize;
2305 } 2333 }
2306 } 2334 }
2307 } 2335 }
2308 2336
2309 #undef __ 2337 #undef __
2310 2338
2311 } // namespace compiler 2339 } // namespace compiler
2312 } // namespace internal 2340 } // namespace internal
2313 } // namespace v8 2341 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698