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

Side by Side Diff: src/mips/assembler-mips.cc

Issue 2069933003: Implement byte swapping instructions on MIPS32 and MIPS64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests Created 4 years, 5 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/mips/assembler-mips.h ('k') | src/mips/constants-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 1949
1950 1950
1951 void Assembler::aui(Register rt, Register rs, int32_t j) { 1951 void Assembler::aui(Register rt, Register rs, int32_t j) {
1952 // This instruction uses same opcode as 'lui'. The difference in encoding is 1952 // This instruction uses same opcode as 'lui'. The difference in encoding is
1953 // 'lui' has zero reg. for rs field. 1953 // 'lui' has zero reg. for rs field.
1954 DCHECK(!(rs.is(zero_reg))); 1954 DCHECK(!(rs.is(zero_reg)));
1955 DCHECK(is_uint16(j)); 1955 DCHECK(is_uint16(j));
1956 GenInstrImmediate(LUI, rs, rt, j); 1956 GenInstrImmediate(LUI, rs, rt, j);
1957 } 1957 }
1958 1958
1959
1960 // ---------PC-Relative instructions----------- 1959 // ---------PC-Relative instructions-----------
1961 1960
1962 void Assembler::addiupc(Register rs, int32_t imm19) { 1961 void Assembler::addiupc(Register rs, int32_t imm19) {
1963 DCHECK(IsMipsArchVariant(kMips32r6)); 1962 DCHECK(IsMipsArchVariant(kMips32r6));
1964 DCHECK(rs.is_valid() && is_int19(imm19)); 1963 DCHECK(rs.is_valid() && is_int19(imm19));
1965 uint32_t imm21 = ADDIUPC << kImm19Bits | (imm19 & kImm19Mask); 1964 uint32_t imm21 = ADDIUPC << kImm19Bits | (imm19 & kImm19Mask);
1966 GenInstrImmediate(PCREL, rs, imm21); 1965 GenInstrImmediate(PCREL, rs, imm21);
1967 } 1966 }
1968 1967
1969 1968
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 } 2183 }
2185 2184
2186 2185
2187 void Assembler::align(Register rd, Register rs, Register rt, uint8_t bp) { 2186 void Assembler::align(Register rd, Register rs, Register rt, uint8_t bp) {
2188 DCHECK(IsMipsArchVariant(kMips32r6)); 2187 DCHECK(IsMipsArchVariant(kMips32r6));
2189 DCHECK(is_uint3(bp)); 2188 DCHECK(is_uint3(bp));
2190 uint16_t sa = (ALIGN << kBp2Bits) | bp; 2189 uint16_t sa = (ALIGN << kBp2Bits) | bp;
2191 GenInstrRegister(SPECIAL3, rs, rt, rd, sa, BSHFL); 2190 GenInstrRegister(SPECIAL3, rs, rt, rd, sa, BSHFL);
2192 } 2191 }
2193 2192
2193 // Byte swap.
2194 void Assembler::wsbh(Register rd, Register rt) {
2195 DCHECK(IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6));
2196 GenInstrRegister(SPECIAL3, zero_reg, rt, rd, WSBH, BSHFL);
2197 }
2198
2199 void Assembler::seh(Register rd, Register rt) {
2200 DCHECK(IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6));
2201 GenInstrRegister(SPECIAL3, zero_reg, rt, rd, SEH, BSHFL);
2202 }
2203
2204 void Assembler::seb(Register rd, Register rt) {
2205 DCHECK(IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6));
2206 GenInstrRegister(SPECIAL3, zero_reg, rt, rd, SEB, BSHFL);
2207 }
2194 2208
2195 // --------Coprocessor-instructions---------------- 2209 // --------Coprocessor-instructions----------------
2196 2210
2197 // Load, store, move. 2211 // Load, store, move.
2198 void Assembler::lwc1(FPURegister fd, const MemOperand& src) { 2212 void Assembler::lwc1(FPURegister fd, const MemOperand& src) {
2199 if (is_int16(src.offset_)) { 2213 if (is_int16(src.offset_)) {
2200 GenInstrImmediate(LWC1, src.rm(), fd, src.offset_); 2214 GenInstrImmediate(LWC1, src.rm(), fd, src.offset_);
2201 } else { // Offset > 16 bits, use multiple instructions to load. 2215 } else { // Offset > 16 bits, use multiple instructions to load.
2202 LoadRegPlusOffsetToAt(src); 2216 LoadRegPlusOffsetToAt(src);
2203 GenInstrImmediate(LWC1, at, fd, 0); 2217 GenInstrImmediate(LWC1, at, fd, 0);
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
3221 3235
3222 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3236 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3223 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3237 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3224 } 3238 }
3225 } 3239 }
3226 3240
3227 } // namespace internal 3241 } // namespace internal
3228 } // namespace v8 3242 } // namespace v8
3229 3243
3230 #endif // V8_TARGET_ARCH_MIPS 3244 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips/constants-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698