OLD | NEW |
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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 and_(t8, rs, at); | 1908 and_(t8, rs, at); |
1909 sll(t8, t8, pos); | 1909 sll(t8, t8, pos); |
1910 sll(at, at, pos); | 1910 sll(at, at, pos); |
1911 nor(at, at, zero_reg); | 1911 nor(at, at, zero_reg); |
1912 and_(at, rt, at); | 1912 and_(at, rt, at); |
1913 or_(rt, t8, at); | 1913 or_(rt, t8, at); |
1914 } | 1914 } |
1915 } | 1915 } |
1916 | 1916 |
1917 void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { | 1917 void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { |
1918 Register scratch1 = t8; | |
1919 Register scratch2 = t9; | |
1920 if (IsMipsArchVariant(kMips32r2)) { | 1918 if (IsMipsArchVariant(kMips32r2)) { |
1921 Label is_nan, done; | 1919 Label is_nan, done; |
1922 Register scratch1 = t8; | 1920 Register scratch1 = t8; |
1923 Register scratch2 = t9; | 1921 Register scratch2 = t9; |
1924 BranchF32(nullptr, &is_nan, eq, fs, fs); | 1922 BranchF32(nullptr, &is_nan, eq, fs, fs); |
1925 Branch(USE_DELAY_SLOT, &done); | 1923 Branch(USE_DELAY_SLOT, &done); |
1926 // For NaN input, neg_s will return the same NaN value, | 1924 // For NaN input, neg_s will return the same NaN value, |
1927 // while the sign has to be changed separately. | 1925 // while the sign has to be changed separately. |
1928 neg_s(fd, fs); // In delay slot. | 1926 neg_s(fd, fs); // In delay slot. |
1929 | |
1930 bind(&is_nan); | 1927 bind(&is_nan); |
1931 mfc1(scratch1, fs); | 1928 mfc1(scratch1, fs); |
1932 And(scratch2, scratch1, Operand(~kBinary32SignMask)); | 1929 And(scratch2, scratch1, Operand(~kBinary32SignMask)); |
1933 And(scratch1, scratch1, Operand(kBinary32SignMask)); | 1930 And(scratch1, scratch1, Operand(kBinary32SignMask)); |
1934 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); | 1931 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); |
1935 Or(scratch2, scratch2, scratch1); | 1932 Or(scratch2, scratch2, scratch1); |
1936 mtc1(scratch2, fd); | 1933 mtc1(scratch2, fd); |
1937 bind(&done); | 1934 bind(&done); |
1938 } else { | 1935 } else { |
1939 mfc1(scratch1, fs); | 1936 // r6 neg_s changes the sign for NaN-like operands as well. |
1940 And(scratch2, scratch1, Operand(~kBinary32SignMask)); | 1937 neg_s(fd, fs); |
1941 And(scratch1, scratch1, Operand(kBinary32SignMask)); | |
1942 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); | |
1943 Or(scratch2, scratch2, scratch1); | |
1944 mtc1(scratch2, fd); | |
1945 } | 1938 } |
1946 } | 1939 } |
1947 | 1940 |
1948 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { | 1941 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { |
1949 Register scratch1 = t8; | |
1950 Register scratch2 = t9; | |
1951 if (IsMipsArchVariant(kMips32r2)) { | 1942 if (IsMipsArchVariant(kMips32r2)) { |
1952 Label is_nan, done; | 1943 Label is_nan, done; |
| 1944 Register scratch1 = t8; |
| 1945 Register scratch2 = t9; |
1953 BranchF64(nullptr, &is_nan, eq, fs, fs); | 1946 BranchF64(nullptr, &is_nan, eq, fs, fs); |
1954 Branch(USE_DELAY_SLOT, &done); | 1947 Branch(USE_DELAY_SLOT, &done); |
1955 // For NaN input, neg_d will return the same NaN value, | 1948 // For NaN input, neg_d will return the same NaN value, |
1956 // while the sign has to be changed separately. | 1949 // while the sign has to be changed separately. |
1957 neg_d(fd, fs); // In delay slot. | 1950 neg_d(fd, fs); // In delay slot. |
1958 | |
1959 bind(&is_nan); | 1951 bind(&is_nan); |
1960 Mfhc1(scratch1, fs); | 1952 Mfhc1(scratch1, fs); |
1961 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); | 1953 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); |
1962 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 1954 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
1963 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 1955 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
1964 Or(scratch2, scratch2, scratch1); | 1956 Or(scratch2, scratch2, scratch1); |
1965 Mthc1(scratch2, fd); | 1957 Mthc1(scratch2, fd); |
1966 bind(&done); | 1958 bind(&done); |
1967 } else { | 1959 } else { |
1968 Move_d(fd, fs); | 1960 // r6 neg_d changes the sign for NaN-like operands as well. |
1969 Mfhc1(scratch1, fs); | 1961 neg_d(fd, fs); |
1970 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); | |
1971 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | |
1972 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | |
1973 Or(scratch2, scratch2, scratch1); | |
1974 Mthc1(scratch2, fd); | |
1975 } | 1962 } |
1976 } | 1963 } |
1977 | 1964 |
1978 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs, | 1965 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs, |
1979 FPURegister scratch) { | 1966 FPURegister scratch) { |
1980 // In FP64Mode we do convertion from long. | 1967 // In FP64Mode we do convertion from long. |
1981 if (IsFp64Mode()) { | 1968 if (IsFp64Mode()) { |
1982 mtc1(rs, scratch); | 1969 mtc1(rs, scratch); |
1983 Mthc1(zero_reg, scratch); | 1970 Mthc1(zero_reg, scratch); |
1984 cvt_d_l(fd, scratch); | 1971 cvt_d_l(fd, scratch); |
(...skipping 5006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6991 if (mag.shift > 0) sra(result, result, mag.shift); | 6978 if (mag.shift > 0) sra(result, result, mag.shift); |
6992 srl(at, dividend, 31); | 6979 srl(at, dividend, 31); |
6993 Addu(result, result, Operand(at)); | 6980 Addu(result, result, Operand(at)); |
6994 } | 6981 } |
6995 | 6982 |
6996 | 6983 |
6997 } // namespace internal | 6984 } // namespace internal |
6998 } // namespace v8 | 6985 } // namespace v8 |
6999 | 6986 |
7000 #endif // V8_TARGET_ARCH_MIPS | 6987 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |