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

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

Issue 2256963003: MIPS: Implement Neg_d and Neg_s instruction macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix a typo Created 4 years, 4 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/mips64/macro-assembler-mips64.h ('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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 void MacroAssembler::Ins(Register rt, 1950 void MacroAssembler::Ins(Register rt,
1951 Register rs, 1951 Register rs,
1952 uint16_t pos, 1952 uint16_t pos,
1953 uint16_t size) { 1953 uint16_t size) {
1954 DCHECK(pos < 32); 1954 DCHECK(pos < 32);
1955 DCHECK(pos + size <= 32); 1955 DCHECK(pos + size <= 32);
1956 DCHECK(size != 0); 1956 DCHECK(size != 0);
1957 ins_(rt, rs, pos, size); 1957 ins_(rt, rs, pos, size);
1958 } 1958 }
1959 1959
1960 void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) {
1961 Register scratch1 = t8;
1962 Register scratch2 = t9;
1963 if (kArchVariant == kMips64r2) {
1964 Label is_nan, done;
1965 BranchF32(nullptr, &is_nan, eq, fs, fs);
1966 Branch(USE_DELAY_SLOT, &done);
1967 // For NaN input, neg_s will return the same NaN value,
1968 // while the sign has to be changed separately.
1969 neg_s(fd, fs); // In delay slot.
1970 bind(&is_nan);
1971 mfc1(scratch1, fs);
1972 And(scratch2, scratch1, Operand(~kBinary32SignMask));
1973 And(scratch1, scratch1, Operand(kBinary32SignMask));
1974 Xor(scratch1, scratch1, Operand(kBinary32SignMask));
1975 Or(scratch2, scratch2, scratch1);
1976 mtc1(scratch2, fd);
1977 bind(&done);
1978 } else {
1979 mfc1(scratch1, fs);
1980 And(scratch2, scratch1, Operand(~kBinary32SignMask));
1981 And(scratch1, scratch1, Operand(kBinary32SignMask));
1982 Xor(scratch1, scratch1, Operand(kBinary32SignMask));
1983 Or(scratch2, scratch2, scratch1);
1984 mtc1(scratch2, fd);
1985 }
1986 }
1987
1988 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) {
1989 Register scratch1 = t8;
1990 Register scratch2 = t9;
1991 if (kArchVariant == kMips64r2) {
1992 Label is_nan, done;
1993 BranchF64(nullptr, &is_nan, eq, fs, fs);
1994 Branch(USE_DELAY_SLOT, &done);
1995 // For NaN input, neg_d will return the same NaN value,
1996 // while the sign has to be changed separately.
1997 neg_d(fd, fs); // In delay slot.
1998 bind(&is_nan);
1999 dmfc1(scratch1, fs);
2000 And(scratch2, scratch1, Operand(~Double::kSignMask));
2001 And(scratch1, scratch1, Operand(Double::kSignMask));
2002 Xor(scratch1, scratch1, Operand(Double::kSignMask));
2003 Or(scratch2, scratch2, scratch1);
2004 dmtc1(scratch2, fd);
2005 bind(&done);
2006 } else {
2007 dmfc1(scratch1, fs);
2008 And(scratch2, scratch1, Operand(~Double::kSignMask));
2009 And(scratch1, scratch1, Operand(Double::kSignMask));
2010 Xor(scratch1, scratch1, Operand(Double::kSignMask));
2011 Or(scratch2, scratch2, scratch1);
2012 dmtc1(scratch2, fd);
2013 }
2014 }
1960 2015
1961 void MacroAssembler::Cvt_d_uw(FPURegister fd, FPURegister fs) { 2016 void MacroAssembler::Cvt_d_uw(FPURegister fd, FPURegister fs) {
1962 // Move the data from fs to t8. 2017 // Move the data from fs to t8.
1963 mfc1(t8, fs); 2018 mfc1(t8, fs);
1964 Cvt_d_uw(fd, t8); 2019 Cvt_d_uw(fd, t8);
1965 } 2020 }
1966 2021
1967 2022
1968 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs) { 2023 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs) {
1969 // Convert rs to a FP value in fd. 2024 // Convert rs to a FP value in fd.
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 mtc1(at, dst); 2583 mtc1(at, dst);
2529 } 2584 }
2530 2585
2531 2586
2532 void MacroAssembler::Move(FPURegister dst, double imm) { 2587 void MacroAssembler::Move(FPURegister dst, double imm) {
2533 int64_t imm_bits = bit_cast<int64_t>(imm); 2588 int64_t imm_bits = bit_cast<int64_t>(imm);
2534 // Handle special values first. 2589 // Handle special values first.
2535 if (imm_bits == bit_cast<int64_t>(0.0) && has_double_zero_reg_set_) { 2590 if (imm_bits == bit_cast<int64_t>(0.0) && has_double_zero_reg_set_) {
2536 mov_d(dst, kDoubleRegZero); 2591 mov_d(dst, kDoubleRegZero);
2537 } else if (imm_bits == bit_cast<int64_t>(-0.0) && has_double_zero_reg_set_) { 2592 } else if (imm_bits == bit_cast<int64_t>(-0.0) && has_double_zero_reg_set_) {
2538 neg_d(dst, kDoubleRegZero); 2593 Neg_d(dst, kDoubleRegZero);
2539 } else { 2594 } else {
2540 uint32_t lo, hi; 2595 uint32_t lo, hi;
2541 DoubleAsTwoUInt32(imm, &lo, &hi); 2596 DoubleAsTwoUInt32(imm, &lo, &hi);
2542 // Move the low part of the double into the lower bits of the corresponding 2597 // Move the low part of the double into the lower bits of the corresponding
2543 // FPU register. 2598 // FPU register.
2544 if (lo != 0) { 2599 if (lo != 0) {
2545 if (!(lo & kImm16Mask)) { 2600 if (!(lo & kImm16Mask)) {
2546 lui(at, (lo >> kLuiShift) & kImm16Mask); 2601 lui(at, (lo >> kLuiShift) & kImm16Mask);
2547 mtc1(at, dst); 2602 mtc1(at, dst);
2548 } else if (!(lo & kHiMask)) { 2603 } else if (!(lo & kHiMask)) {
(...skipping 4809 matching lines...) Expand 10 before | Expand all | Expand 10 after
7358 if (mag.shift > 0) sra(result, result, mag.shift); 7413 if (mag.shift > 0) sra(result, result, mag.shift);
7359 srl(at, dividend, 31); 7414 srl(at, dividend, 31);
7360 Addu(result, result, Operand(at)); 7415 Addu(result, result, Operand(at));
7361 } 7416 }
7362 7417
7363 7418
7364 } // namespace internal 7419 } // namespace internal
7365 } // namespace v8 7420 } // namespace v8
7366 7421
7367 #endif // V8_TARGET_ARCH_MIPS64 7422 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698