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

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

Issue 2285703002: MIPS: Use neg instruction in r6 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 3 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/mips/macro-assembler-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 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 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/base/division-by-constant.h" 9 #include "src/base/division-by-constant.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 Register rs, 1953 Register rs,
1954 uint16_t pos, 1954 uint16_t pos,
1955 uint16_t size) { 1955 uint16_t size) {
1956 DCHECK(pos < 32); 1956 DCHECK(pos < 32);
1957 DCHECK(pos + size <= 32); 1957 DCHECK(pos + size <= 32);
1958 DCHECK(size != 0); 1958 DCHECK(size != 0);
1959 ins_(rt, rs, pos, size); 1959 ins_(rt, rs, pos, size);
1960 } 1960 }
1961 1961
1962 void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { 1962 void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) {
1963 Register scratch1 = t8;
1964 Register scratch2 = t9;
1965 if (kArchVariant == kMips64r2) { 1963 if (kArchVariant == kMips64r2) {
1966 Label is_nan, done; 1964 Label is_nan, done;
1965 Register scratch1 = t8;
1966 Register scratch2 = t9;
1967 BranchF32(nullptr, &is_nan, eq, fs, fs); 1967 BranchF32(nullptr, &is_nan, eq, fs, fs);
1968 Branch(USE_DELAY_SLOT, &done); 1968 Branch(USE_DELAY_SLOT, &done);
1969 // For NaN input, neg_s will return the same NaN value, 1969 // For NaN input, neg_s will return the same NaN value,
1970 // while the sign has to be changed separately. 1970 // while the sign has to be changed separately.
1971 neg_s(fd, fs); // In delay slot. 1971 neg_s(fd, fs); // In delay slot.
1972 bind(&is_nan); 1972 bind(&is_nan);
1973 mfc1(scratch1, fs); 1973 mfc1(scratch1, fs);
1974 And(scratch2, scratch1, Operand(~kBinary32SignMask)); 1974 And(scratch2, scratch1, Operand(~kBinary32SignMask));
1975 And(scratch1, scratch1, Operand(kBinary32SignMask)); 1975 And(scratch1, scratch1, Operand(kBinary32SignMask));
1976 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); 1976 Xor(scratch1, scratch1, Operand(kBinary32SignMask));
1977 Or(scratch2, scratch2, scratch1); 1977 Or(scratch2, scratch2, scratch1);
1978 mtc1(scratch2, fd); 1978 mtc1(scratch2, fd);
1979 bind(&done); 1979 bind(&done);
1980 } else { 1980 } else {
1981 mfc1(scratch1, fs); 1981 // r6 neg_s changes the sign for NaN-like operands as well.
1982 And(scratch2, scratch1, Operand(~kBinary32SignMask)); 1982 neg_s(fd, fs);
1983 And(scratch1, scratch1, Operand(kBinary32SignMask));
1984 Xor(scratch1, scratch1, Operand(kBinary32SignMask));
1985 Or(scratch2, scratch2, scratch1);
1986 mtc1(scratch2, fd);
1987 } 1983 }
1988 } 1984 }
1989 1985
1990 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { 1986 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) {
1991 Register scratch1 = t8;
1992 Register scratch2 = t9;
1993 if (kArchVariant == kMips64r2) { 1987 if (kArchVariant == kMips64r2) {
1994 Label is_nan, done; 1988 Label is_nan, done;
1989 Register scratch1 = t8;
1990 Register scratch2 = t9;
1995 BranchF64(nullptr, &is_nan, eq, fs, fs); 1991 BranchF64(nullptr, &is_nan, eq, fs, fs);
1996 Branch(USE_DELAY_SLOT, &done); 1992 Branch(USE_DELAY_SLOT, &done);
1997 // For NaN input, neg_d will return the same NaN value, 1993 // For NaN input, neg_d will return the same NaN value,
1998 // while the sign has to be changed separately. 1994 // while the sign has to be changed separately.
1999 neg_d(fd, fs); // In delay slot. 1995 neg_d(fd, fs); // In delay slot.
2000 bind(&is_nan); 1996 bind(&is_nan);
2001 dmfc1(scratch1, fs); 1997 dmfc1(scratch1, fs);
2002 And(scratch2, scratch1, Operand(~Double::kSignMask)); 1998 And(scratch2, scratch1, Operand(~Double::kSignMask));
2003 And(scratch1, scratch1, Operand(Double::kSignMask)); 1999 And(scratch1, scratch1, Operand(Double::kSignMask));
2004 Xor(scratch1, scratch1, Operand(Double::kSignMask)); 2000 Xor(scratch1, scratch1, Operand(Double::kSignMask));
2005 Or(scratch2, scratch2, scratch1); 2001 Or(scratch2, scratch2, scratch1);
2006 dmtc1(scratch2, fd); 2002 dmtc1(scratch2, fd);
2007 bind(&done); 2003 bind(&done);
2008 } else { 2004 } else {
2009 dmfc1(scratch1, fs); 2005 // r6 neg_d changes the sign for NaN-like operands as well.
2010 And(scratch2, scratch1, Operand(~Double::kSignMask)); 2006 neg_d(fd, fs);
2011 And(scratch1, scratch1, Operand(Double::kSignMask));
2012 Xor(scratch1, scratch1, Operand(Double::kSignMask));
2013 Or(scratch2, scratch2, scratch1);
2014 dmtc1(scratch2, fd);
2015 } 2007 }
2016 } 2008 }
2017 2009
2018 void MacroAssembler::Cvt_d_uw(FPURegister fd, FPURegister fs) { 2010 void MacroAssembler::Cvt_d_uw(FPURegister fd, FPURegister fs) {
2019 // Move the data from fs to t8. 2011 // Move the data from fs to t8.
2020 mfc1(t8, fs); 2012 mfc1(t8, fs);
2021 Cvt_d_uw(fd, t8); 2013 Cvt_d_uw(fd, t8);
2022 } 2014 }
2023 2015
2024 2016
(...skipping 5390 matching lines...) Expand 10 before | Expand all | Expand 10 after
7415 if (mag.shift > 0) sra(result, result, mag.shift); 7407 if (mag.shift > 0) sra(result, result, mag.shift);
7416 srl(at, dividend, 31); 7408 srl(at, dividend, 31);
7417 Addu(result, result, Operand(at)); 7409 Addu(result, result, Operand(at));
7418 } 7410 }
7419 7411
7420 7412
7421 } // namespace internal 7413 } // namespace internal
7422 } // namespace v8 7414 } // namespace v8
7423 7415
7424 #endif // V8_TARGET_ARCH_MIPS64 7416 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698