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

Side by Side Diff: src/mips64/macro-assembler-mips64.cc

Issue 637273002: MIPS64: Fix TruncatingDiv. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips64/simulator-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 6049 matching lines...) Expand 10 before | Expand all | Expand 10 after
6060 masm_.emit(instr); 6060 masm_.emit(instr);
6061 } 6061 }
6062 6062
6063 6063
6064 void MacroAssembler::TruncatingDiv(Register result, 6064 void MacroAssembler::TruncatingDiv(Register result,
6065 Register dividend, 6065 Register dividend,
6066 int32_t divisor) { 6066 int32_t divisor) {
6067 DCHECK(!dividend.is(result)); 6067 DCHECK(!dividend.is(result));
6068 DCHECK(!dividend.is(at)); 6068 DCHECK(!dividend.is(at));
6069 DCHECK(!result.is(at)); 6069 DCHECK(!result.is(at));
6070 base::MagicNumbersForDivision<uint32_t> mag = 6070 base::MagicNumbersForDivision<uint32_t> mag =
dusmil.imgtec 2014/10/08 09:56:40 Can we instantiate template class with int32_t par
Sven Panne 2014/10/08 10:44:13 Nope, the template parameter *must* be unsigned, o
6071 base::SignedDivisionByConstant(static_cast<uint32_t>(divisor)); 6071 base::SignedDivisionByConstant(static_cast<uint32_t>(divisor));
6072 li(at, Operand(mag.multiplier)); 6072 li(at, Operand(static_cast<int32_t>(mag.multiplier)));
6073 Mulh(result, dividend, Operand(at)); 6073 Mulh(result, dividend, Operand(at));
6074 bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0; 6074 bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0;
6075 if (divisor > 0 && neg) { 6075 if (divisor > 0 && neg) {
6076 Addu(result, result, Operand(dividend)); 6076 Addu(result, result, Operand(dividend));
6077 } 6077 }
6078 if (divisor < 0 && !neg && mag.multiplier > 0) { 6078 if (divisor < 0 && !neg && mag.multiplier > 0) {
6079 Subu(result, result, Operand(dividend)); 6079 Subu(result, result, Operand(dividend));
6080 } 6080 }
6081 if (mag.shift > 0) sra(result, result, mag.shift); 6081 if (mag.shift > 0) sra(result, result, mag.shift);
6082 srl(at, dividend, 31); 6082 srl(at, dividend, 31);
6083 Addu(result, result, Operand(at)); 6083 Addu(result, result, Operand(at));
6084 } 6084 }
6085 6085
6086 6086
6087 } } // namespace v8::internal 6087 } } // namespace v8::internal
6088 6088
6089 #endif // V8_TARGET_ARCH_MIPS64 6089 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « no previous file | src/mips64/simulator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698