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 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 srl(at, at, 32 - size); | 1905 srl(at, at, 32 - size); |
1906 and_(t8, rs, at); | 1906 and_(t8, rs, at); |
1907 sll(t8, t8, pos); | 1907 sll(t8, t8, pos); |
1908 sll(at, at, pos); | 1908 sll(at, at, pos); |
1909 nor(at, at, zero_reg); | 1909 nor(at, at, zero_reg); |
1910 and_(at, rt, at); | 1910 and_(at, rt, at); |
1911 or_(rt, t8, at); | 1911 or_(rt, t8, at); |
1912 } | 1912 } |
1913 } | 1913 } |
1914 | 1914 |
| 1915 void MacroAssembler::Neg_s(FPURegister fd, FPURegister fs) { |
| 1916 Register scratch1 = t8; |
| 1917 Register scratch2 = t9; |
| 1918 if (IsMipsArchVariant(kMips32r2)) { |
| 1919 Label is_nan, done; |
| 1920 Register scratch1 = t8; |
| 1921 Register scratch2 = t9; |
| 1922 BranchF32(nullptr, &is_nan, eq, fs, fs); |
| 1923 Branch(USE_DELAY_SLOT, &done); |
| 1924 // For NaN input, neg_s will return the same NaN value, |
| 1925 // while the sign has to be changed separately. |
| 1926 neg_s(fd, fs); // In delay slot. |
| 1927 |
| 1928 bind(&is_nan); |
| 1929 mfc1(scratch1, fs); |
| 1930 And(scratch2, scratch1, Operand(~kBinary32SignMask)); |
| 1931 And(scratch1, scratch1, Operand(kBinary32SignMask)); |
| 1932 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); |
| 1933 Or(scratch2, scratch2, scratch1); |
| 1934 mtc1(scratch2, fd); |
| 1935 bind(&done); |
| 1936 } else { |
| 1937 mfc1(scratch1, fs); |
| 1938 And(scratch2, scratch1, Operand(~kBinary32SignMask)); |
| 1939 And(scratch1, scratch1, Operand(kBinary32SignMask)); |
| 1940 Xor(scratch1, scratch1, Operand(kBinary32SignMask)); |
| 1941 Or(scratch2, scratch2, scratch1); |
| 1942 mtc1(scratch2, fd); |
| 1943 } |
| 1944 } |
| 1945 |
| 1946 void MacroAssembler::Neg_d(FPURegister fd, FPURegister fs) { |
| 1947 Register scratch1 = t8; |
| 1948 Register scratch2 = t9; |
| 1949 if (IsMipsArchVariant(kMips32r2)) { |
| 1950 Label is_nan, done; |
| 1951 BranchF64(nullptr, &is_nan, eq, fs, fs); |
| 1952 Branch(USE_DELAY_SLOT, &done); |
| 1953 // For NaN input, neg_d will return the same NaN value, |
| 1954 // while the sign has to be changed separately. |
| 1955 neg_d(fd, fs); // In delay slot. |
| 1956 |
| 1957 bind(&is_nan); |
| 1958 Mfhc1(scratch1, fs); |
| 1959 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); |
| 1960 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
| 1961 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
| 1962 Or(scratch2, scratch2, scratch1); |
| 1963 Mthc1(scratch2, fd); |
| 1964 bind(&done); |
| 1965 } else { |
| 1966 Move_d(fd, fs); |
| 1967 Mfhc1(scratch1, fs); |
| 1968 And(scratch2, scratch1, Operand(~HeapNumber::kSignMask)); |
| 1969 And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
| 1970 Xor(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
| 1971 Or(scratch2, scratch2, scratch1); |
| 1972 Mthc1(scratch2, fd); |
| 1973 } |
| 1974 } |
1915 | 1975 |
1916 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs, | 1976 void MacroAssembler::Cvt_d_uw(FPURegister fd, Register rs, |
1917 FPURegister scratch) { | 1977 FPURegister scratch) { |
1918 // In FP64Mode we do convertion from long. | 1978 // In FP64Mode we do convertion from long. |
1919 if (IsFp64Mode()) { | 1979 if (IsFp64Mode()) { |
1920 mtc1(rs, scratch); | 1980 mtc1(rs, scratch); |
1921 Mthc1(zero_reg, scratch); | 1981 Mthc1(zero_reg, scratch); |
1922 cvt_d_l(fd, scratch); | 1982 cvt_d_l(fd, scratch); |
1923 } else { | 1983 } else { |
1924 // Convert rs to a FP value in fd. | 1984 // Convert rs to a FP value in fd. |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 mtc1(at, dst); | 2370 mtc1(at, dst); |
2311 } | 2371 } |
2312 | 2372 |
2313 | 2373 |
2314 void MacroAssembler::Move(FPURegister dst, double imm) { | 2374 void MacroAssembler::Move(FPURegister dst, double imm) { |
2315 int64_t imm_bits = bit_cast<int64_t>(imm); | 2375 int64_t imm_bits = bit_cast<int64_t>(imm); |
2316 // Handle special values first. | 2376 // Handle special values first. |
2317 if (imm_bits == bit_cast<int64_t>(0.0) && has_double_zero_reg_set_) { | 2377 if (imm_bits == bit_cast<int64_t>(0.0) && has_double_zero_reg_set_) { |
2318 mov_d(dst, kDoubleRegZero); | 2378 mov_d(dst, kDoubleRegZero); |
2319 } else if (imm_bits == bit_cast<int64_t>(-0.0) && has_double_zero_reg_set_) { | 2379 } else if (imm_bits == bit_cast<int64_t>(-0.0) && has_double_zero_reg_set_) { |
2320 neg_d(dst, kDoubleRegZero); | 2380 Neg_d(dst, kDoubleRegZero); |
2321 } else { | 2381 } else { |
2322 uint32_t lo, hi; | 2382 uint32_t lo, hi; |
2323 DoubleAsTwoUInt32(imm, &lo, &hi); | 2383 DoubleAsTwoUInt32(imm, &lo, &hi); |
2324 // Move the low part of the double into the lower of the corresponding FPU | 2384 // Move the low part of the double into the lower of the corresponding FPU |
2325 // register of FPU register pair. | 2385 // register of FPU register pair. |
2326 if (lo != 0) { | 2386 if (lo != 0) { |
2327 li(at, Operand(lo)); | 2387 li(at, Operand(lo)); |
2328 mtc1(at, dst); | 2388 mtc1(at, dst); |
2329 } else { | 2389 } else { |
2330 mtc1(zero_reg, dst); | 2390 mtc1(zero_reg, dst); |
(...skipping 4598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6929 if (mag.shift > 0) sra(result, result, mag.shift); | 6989 if (mag.shift > 0) sra(result, result, mag.shift); |
6930 srl(at, dividend, 31); | 6990 srl(at, dividend, 31); |
6931 Addu(result, result, Operand(at)); | 6991 Addu(result, result, Operand(at)); |
6932 } | 6992 } |
6933 | 6993 |
6934 | 6994 |
6935 } // namespace internal | 6995 } // namespace internal |
6936 } // namespace v8 | 6996 } // namespace v8 |
6937 | 6997 |
6938 #endif // V8_TARGET_ARCH_MIPS | 6998 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |