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 if (IsMipsArchVariant(kMips32r2)) { | 1918 if (IsMipsArchVariant(kMips32r6)) { |
| 1919 // r6 neg_s changes the sign for NaN-like operands as well. |
| 1920 neg_s(fd, fs); |
| 1921 } else { |
| 1922 DCHECK(IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r1) || |
| 1923 IsMipsArchVariant(kLoongson)); |
1919 Label is_nan, done; | 1924 Label is_nan, done; |
1920 Register scratch1 = t8; | 1925 Register scratch1 = t8; |
1921 Register scratch2 = t9; | 1926 Register scratch2 = t9; |
1922 BranchF32(nullptr, &is_nan, eq, fs, fs); | 1927 BranchF32(nullptr, &is_nan, eq, fs, fs); |
1923 Branch(USE_DELAY_SLOT, &done); | 1928 Branch(USE_DELAY_SLOT, &done); |
1924 // For NaN input, neg_s will return the same NaN value, | 1929 // For NaN input, neg_s will return the same NaN value, |
1925 // while the sign has to be changed separately. | 1930 // while the sign has to be changed separately. |
1926 neg_s(fd, fs); // In delay slot. | 1931 neg_s(fd, fs); // In delay slot. |
1927 bind(&is_nan); | 1932 bind(&is_nan); |
1928 mfc1(scratch1, fs); | 1933 mfc1(scratch1, fs); |
1929 And(scratch2, scratch1, Operand(~kBinary32SignMask)); | 1934 And(scratch2, scratch1, Operand(~kBinary32SignMask)); |
1930 And(scratch1, scratch1, Operand(kBinary32SignMask)); | 1935 And(scratch1, scratch1, Operand(kBinary32SignMask)); |
1931 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); | 1936 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); |
1932 Or(scratch2, scratch2, scratch1); | 1937 Or(scratch2, scratch2, scratch1); |
1933 mtc1(scratch2, fd); | 1938 mtc1(scratch2, fd); |
1934 bind(&done); | 1939 bind(&done); |
1935 } else { | |
1936 // r6 neg_s changes the sign for NaN-like operands as well. | |
1937 neg_s(fd, fs); | |
1938 } | 1940 } |
1939 } | 1941 } |
1940 | 1942 |
1941 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { | 1943 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { |
1942 if (IsMipsArchVariant(kMips32r2)) { | 1944 if (IsMipsArchVariant(kMips32r6)) { |
| 1945 // r6 neg_d changes the sign for NaN-like operands as well. |
| 1946 neg_d(fd, fs); |
| 1947 } else { |
| 1948 DCHECK(IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r1) || |
| 1949 IsMipsArchVariant(kLoongson)); |
1943 Label is_nan, done; | 1950 Label is_nan, done; |
1944 Register scratch1 = t8; | 1951 Register scratch1 = t8; |
1945 Register scratch2 = t9; | 1952 Register scratch2 = t9; |
1946 BranchF64(nullptr, &is_nan, eq, fs, fs); | 1953 BranchF64(nullptr, &is_nan, eq, fs, fs); |
1947 Branch(USE_DELAY_SLOT, &done); | 1954 Branch(USE_DELAY_SLOT, &done); |
1948 // For NaN input, neg_d will return the same NaN value, | 1955 // For NaN input, neg_d will return the same NaN value, |
1949 // while the sign has to be changed separately. | 1956 // while the sign has to be changed separately. |
1950 neg_d(fd, fs); // In delay slot. | 1957 neg_d(fd, fs); // In delay slot. |
1951 bind(&is_nan); | 1958 bind(&is_nan); |
1952 Mfhc1(scratch1, fs); | 1959 Mfhc1(scratch1, fs); |
1953 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); | 1960 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); |
1954 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 1961 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
1955 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 1962 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
1956 Or(scratch2, scratch2, scratch1); | 1963 Or(scratch2, scratch2, scratch1); |
1957 Mthc1(scratch2, fd); | 1964 Mthc1(scratch2, fd); |
1958 bind(&done); | 1965 bind(&done); |
1959 } else { | |
1960 // r6 neg_d changes the sign for NaN-like operands as well. | |
1961 neg_d(fd, fs); | |
1962 } | 1966 } |
1963 } | 1967 } |
1964 | 1968 |
1965 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs, | 1969 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs, |
1966 FPURegister scratch) { | 1970 FPURegister scratch) { |
1967 // In FP64Mode we do convertion from long. | 1971 // In FP64Mode we do convertion from long. |
1968 if (IsFp64Mode()) { | 1972 if (IsFp64Mode()) { |
1969 mtc1(rs, scratch); | 1973 mtc1(rs, scratch); |
1970 Mthc1(zero_reg, scratch); | 1974 Mthc1(zero_reg, scratch); |
1971 cvt_d_l(fd, scratch); | 1975 cvt_d_l(fd, scratch); |
(...skipping 5006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6978 if (mag.shift > 0) sra(result, result, mag.shift); | 6982 if (mag.shift > 0) sra(result, result, mag.shift); |
6979 srl(at, dividend, 31); | 6983 srl(at, dividend, 31); |
6980 Addu(result, result, Operand(at)); | 6984 Addu(result, result, Operand(at)); |
6981 } | 6985 } |
6982 | 6986 |
6983 | 6987 |
6984 } // namespace internal | 6988 } // namespace internal |
6985 } // namespace v8 | 6989 } // namespace v8 |
6986 | 6990 |
6987 #endif // V8_TARGET_ARCH_MIPS | 6991 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |