OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 emit(instr); | 1933 emit(instr); |
1934 } | 1934 } |
1935 | 1935 |
1936 | 1936 |
1937 // ------------Memory-instructions------------- | 1937 // ------------Memory-instructions------------- |
1938 | 1938 |
1939 // Helper for base-reg + offset, when offset is larger than int16. | 1939 // Helper for base-reg + offset, when offset is larger than int16. |
1940 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) { | 1940 void Assembler::LoadRegPlusOffsetToAt(const MemOperand& src) { |
1941 DCHECK(!src.rm().is(at)); | 1941 DCHECK(!src.rm().is(at)); |
1942 DCHECK(is_int32(src.offset_)); | 1942 DCHECK(is_int32(src.offset_)); |
1943 lui(at, (src.offset_ >> kLuiShift) & kImm16Mask); | 1943 |
1944 ori(at, at, src.offset_ & kImm16Mask); // Load 32-bit offset. | 1944 if (kArchVariant == kMips64r6) { |
1945 daddu(at, at, src.rm()); // Add base register. | 1945 int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask; |
| 1946 if (src.offset_ & kNegOffset) { |
| 1947 if ((hi & kNegOffset) != ((hi + 1) & kNegOffset)) { |
| 1948 lui(at, (src.offset_ >> kLuiShift) & kImm16Mask); |
| 1949 ori(at, at, src.offset_ & kImm16Mask); // Load 32-bit offset. |
| 1950 daddu(at, at, src.rm()); // Add base register. |
| 1951 return; |
| 1952 } |
| 1953 |
| 1954 hi += 1; |
| 1955 } |
| 1956 |
| 1957 daui(at, src.rm(), hi); |
| 1958 daddiu(at, at, src.offset_ & kImm16Mask); |
| 1959 } else { |
| 1960 lui(at, (src.offset_ >> kLuiShift) & kImm16Mask); |
| 1961 ori(at, at, src.offset_ & kImm16Mask); // Load 32-bit offset. |
| 1962 daddu(at, at, src.rm()); // Add base register. |
| 1963 } |
1946 } | 1964 } |
1947 | 1965 |
1948 // Helper for base-reg + upper part of offset, when offset is larger than int16. | 1966 // Helper for base-reg + upper part of offset, when offset is larger than int16. |
1949 // Loads higher part of the offset to AT register. | 1967 // Loads higher part of the offset to AT register. |
1950 // Returns lower part of the offset to be used as offset | 1968 // Returns lower part of the offset to be used as offset |
1951 // in Load/Store instructions | 1969 // in Load/Store instructions |
1952 int32_t Assembler::LoadRegPlusUpperOffsetPartToAt(const MemOperand& src) { | 1970 int32_t Assembler::LoadRegPlusUpperOffsetPartToAt(const MemOperand& src) { |
1953 DCHECK(!src.rm().is(at)); | 1971 DCHECK(!src.rm().is(at)); |
1954 DCHECK(is_int32(src.offset_)); | 1972 DCHECK(is_int32(src.offset_)); |
1955 int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask; | 1973 int32_t hi = (src.offset_ >> kLuiShift) & kImm16Mask; |
1956 // If the highest bit of the lower part of the offset is 1, this would make | 1974 // If the highest bit of the lower part of the offset is 1, this would make |
1957 // the offset in the load/store instruction negative. We need to compensate | 1975 // the offset in the load/store instruction negative. We need to compensate |
1958 // for this by adding 1 to the upper part of the offset. | 1976 // for this by adding 1 to the upper part of the offset. |
1959 if (src.offset_ & kNegOffset) { | 1977 if (src.offset_ & kNegOffset) { |
1960 if ((hi & kNegOffset) != ((hi + 1) & kNegOffset)) { | 1978 if ((hi & kNegOffset) != ((hi + 1) & kNegOffset)) { |
1961 LoadRegPlusOffsetToAt(src); | 1979 LoadRegPlusOffsetToAt(src); |
1962 return 0; | 1980 return 0; |
1963 } | 1981 } |
1964 | 1982 |
1965 hi += 1; | 1983 hi += 1; |
1966 } | 1984 } |
1967 | 1985 |
1968 lui(at, hi); | 1986 if (kArchVariant == kMips64r6) { |
1969 daddu(at, at, src.rm()); | 1987 daui(at, src.rm(), hi); |
| 1988 } else { |
| 1989 lui(at, hi); |
| 1990 daddu(at, at, src.rm()); |
| 1991 } |
1970 return (src.offset_ & kImm16Mask); | 1992 return (src.offset_ & kImm16Mask); |
1971 } | 1993 } |
1972 | 1994 |
1973 void Assembler::lb(Register rd, const MemOperand& rs) { | 1995 void Assembler::lb(Register rd, const MemOperand& rs) { |
1974 if (is_int16(rs.offset_)) { | 1996 if (is_int16(rs.offset_)) { |
1975 GenInstrImmediate(LB, rs.rm(), rd, rs.offset_); | 1997 GenInstrImmediate(LB, rs.rm(), rd, rs.offset_); |
1976 } else { // Offset > 16 bits, use multiple instructions to load. | 1998 } else { // Offset > 16 bits, use multiple instructions to load. |
1977 int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); | 1999 int32_t off16 = LoadRegPlusUpperOffsetPartToAt(rs); |
1978 GenInstrImmediate(LB, at, rd, off16); | 2000 GenInstrImmediate(LB, at, rd, off16); |
1979 } | 2001 } |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3505 | 3527 |
3506 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3528 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
3507 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); | 3529 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); |
3508 } | 3530 } |
3509 } | 3531 } |
3510 | 3532 |
3511 } // namespace internal | 3533 } // namespace internal |
3512 } // namespace v8 | 3534 } // namespace v8 |
3513 | 3535 |
3514 #endif // V8_TARGET_ARCH_MIPS64 | 3536 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |