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

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

Issue 2130763002: MIPS: [wasm] Detect unrepresentability in the float32-to-int32 conversion correctly on arm (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/compiler/mips/code-generator-mips.cc ('k') | no next file » | 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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 #include "src/compiler/code-generator.h" 6 #include "src/compiler/code-generator.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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 case kMips64RoundWS: { 1487 case kMips64RoundWS: {
1488 FPURegister scratch = kScratchDoubleReg; 1488 FPURegister scratch = kScratchDoubleReg;
1489 __ round_w_s(scratch, i.InputDoubleRegister(0)); 1489 __ round_w_s(scratch, i.InputDoubleRegister(0));
1490 __ mfc1(i.OutputRegister(), scratch); 1490 __ mfc1(i.OutputRegister(), scratch);
1491 break; 1491 break;
1492 } 1492 }
1493 case kMips64TruncWS: { 1493 case kMips64TruncWS: {
1494 FPURegister scratch = kScratchDoubleReg; 1494 FPURegister scratch = kScratchDoubleReg;
1495 __ trunc_w_s(scratch, i.InputDoubleRegister(0)); 1495 __ trunc_w_s(scratch, i.InputDoubleRegister(0));
1496 __ mfc1(i.OutputRegister(), scratch); 1496 __ mfc1(i.OutputRegister(), scratch);
1497 // Avoid INT32_MAX as an overflow indicator and use INT32_MIN instead,
1498 // because INT32_MIN allows easier out-of-bounds detection.
1499 __ addiu(kScratchReg, i.OutputRegister(), 1);
1500 __ slt(kScratchReg2, kScratchReg, i.OutputRegister());
1501 __ Movn(i.OutputRegister(), kScratchReg, kScratchReg2);
1497 break; 1502 break;
1498 } 1503 }
1499 case kMips64TruncLS: { 1504 case kMips64TruncLS: {
1500 FPURegister scratch = kScratchDoubleReg; 1505 FPURegister scratch = kScratchDoubleReg;
1501 Register tmp_fcsr = kScratchReg; 1506 Register tmp_fcsr = kScratchReg;
1502 Register result = kScratchReg2; 1507 Register result = kScratchReg2;
1503 1508
1504 bool load_status = instr->OutputCount() > 1; 1509 bool load_status = instr->OutputCount() > 1;
1505 if (load_status) { 1510 if (load_status) {
1506 // Save FCSR. 1511 // Save FCSR.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 case kMips64TruncUwD: { 1560 case kMips64TruncUwD: {
1556 FPURegister scratch = kScratchDoubleReg; 1561 FPURegister scratch = kScratchDoubleReg;
1557 // TODO(plind): Fix wrong param order of Trunc_uw_d() macro-asm function. 1562 // TODO(plind): Fix wrong param order of Trunc_uw_d() macro-asm function.
1558 __ Trunc_uw_d(i.InputDoubleRegister(0), i.OutputRegister(), scratch); 1563 __ Trunc_uw_d(i.InputDoubleRegister(0), i.OutputRegister(), scratch);
1559 break; 1564 break;
1560 } 1565 }
1561 case kMips64TruncUwS: { 1566 case kMips64TruncUwS: {
1562 FPURegister scratch = kScratchDoubleReg; 1567 FPURegister scratch = kScratchDoubleReg;
1563 // TODO(plind): Fix wrong param order of Trunc_uw_d() macro-asm function. 1568 // TODO(plind): Fix wrong param order of Trunc_uw_d() macro-asm function.
1564 __ Trunc_uw_s(i.InputDoubleRegister(0), i.OutputRegister(), scratch); 1569 __ Trunc_uw_s(i.InputDoubleRegister(0), i.OutputRegister(), scratch);
1570 // Avoid UINT32_MAX as an overflow indicator and use 0 instead,
1571 // because 0 allows easier out-of-bounds detection.
1572 __ addiu(kScratchReg, i.OutputRegister(), 1);
1573 __ Movz(i.OutputRegister(), zero_reg, kScratchReg);
1565 break; 1574 break;
1566 } 1575 }
1567 case kMips64TruncUlS: { 1576 case kMips64TruncUlS: {
1568 FPURegister scratch = kScratchDoubleReg; 1577 FPURegister scratch = kScratchDoubleReg;
1569 Register result = instr->OutputCount() > 1 ? i.OutputRegister(1) : no_reg; 1578 Register result = instr->OutputCount() > 1 ? i.OutputRegister(1) : no_reg;
1570 // TODO(plind): Fix wrong param order of Trunc_ul_s() macro-asm function. 1579 // TODO(plind): Fix wrong param order of Trunc_ul_s() macro-asm function.
1571 __ Trunc_ul_s(i.InputDoubleRegister(0), i.OutputRegister(), scratch, 1580 __ Trunc_ul_s(i.InputDoubleRegister(0), i.OutputRegister(), scratch,
1572 result); 1581 result);
1573 break; 1582 break;
1574 } 1583 }
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 padding_size -= v8::internal::Assembler::kInstrSize; 2392 padding_size -= v8::internal::Assembler::kInstrSize;
2384 } 2393 }
2385 } 2394 }
2386 } 2395 }
2387 2396
2388 #undef __ 2397 #undef __
2389 2398
2390 } // namespace compiler 2399 } // namespace compiler
2391 } // namespace internal 2400 } // namespace internal
2392 } // namespace v8 2401 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698