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

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

Issue 2235703002: MIPS: [compiler] [wasm] Introduce Word32/64ReverseBytes as TF Optional Opcode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/macro-assembler-mips.h ('k') | src/mips64/macro-assembler-mips64.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 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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 BranchLong(L, PROTECT); 1204 BranchLong(L, PROTECT);
1205 bind(&skip); 1205 bind(&skip);
1206 } else { 1206 } else {
1207 bnvc(rs, rt, L); 1207 bnvc(rs, rt, L);
1208 } 1208 }
1209 } 1209 }
1210 1210
1211 // ------------Pseudo-instructions------------- 1211 // ------------Pseudo-instructions-------------
1212 1212
1213 // Word Swap Byte 1213 // Word Swap Byte
1214 void MacroAssembler::ByteSwapSigned(Register reg, int operand_size) { 1214 void MacroAssembler::ByteSwapSigned(Register dest, Register src,
1215 int operand_size) {
1215 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4); 1216 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4);
1216 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 1217 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
1217 if (operand_size == 2) { 1218 if (operand_size == 2) {
1218 seh(reg, reg); 1219 seh(src, src);
1219 } else if (operand_size == 1) { 1220 } else if (operand_size == 1) {
1220 seb(reg, reg); 1221 seb(src, src);
1221 } 1222 }
1222 // No need to do any preparation if operand_size is 4 1223 // No need to do any preparation if operand_size is 4
1223 1224
1224 wsbh(reg, reg); 1225 wsbh(dest, src);
1225 rotr(reg, reg, 16); 1226 rotr(dest, dest, 16);
1226 } else if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) { 1227 } else if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) {
1227 if (operand_size == 1) { 1228 if (operand_size == 1) {
1228 sll(reg, reg, 24); 1229 sll(src, src, 24);
1229 sra(reg, reg, 24); 1230 sra(src, src, 24);
1230 } else if (operand_size == 2) { 1231 } else if (operand_size == 2) {
1231 sll(reg, reg, 16); 1232 sll(src, src, 16);
1232 sra(reg, reg, 16); 1233 sra(src, src, 16);
1233 } 1234 }
1234 // No need to do any preparation if operand_size is 4 1235 // No need to do any preparation if operand_size is 4
1235 1236
1236 Register tmp = t0; 1237 Register tmp = t0;
1237 Register tmp2 = t1; 1238 Register tmp2 = t1;
1238 1239
1239 andi(tmp2, reg, 0xFF); 1240 andi(tmp2, src, 0xFF);
1240 sll(tmp2, tmp2, 24); 1241 sll(tmp2, tmp2, 24);
1241 or_(tmp, zero_reg, tmp2); 1242 or_(tmp, zero_reg, tmp2);
1242 1243
1243 andi(tmp2, reg, 0xFF00); 1244 andi(tmp2, src, 0xFF00);
1244 sll(tmp2, tmp2, 8); 1245 sll(tmp2, tmp2, 8);
1245 or_(tmp, tmp, tmp2); 1246 or_(tmp, tmp, tmp2);
1246 1247
1247 srl(reg, reg, 8); 1248 srl(src, src, 8);
1248 andi(tmp2, reg, 0xFF00); 1249 andi(tmp2, src, 0xFF00);
1249 or_(tmp, tmp, tmp2); 1250 or_(tmp, tmp, tmp2);
1250 1251
1251 srl(reg, reg, 16); 1252 srl(src, src, 16);
1252 andi(tmp2, reg, 0xFF); 1253 andi(tmp2, src, 0xFF);
1253 or_(tmp, tmp, tmp2); 1254 or_(tmp, tmp, tmp2);
1254 1255
1255 or_(reg, tmp, zero_reg); 1256 or_(dest, tmp, zero_reg);
1256 } 1257 }
1257 } 1258 }
1258 1259
1259 void MacroAssembler::ByteSwapUnsigned(Register reg, int operand_size) { 1260 void MacroAssembler::ByteSwapUnsigned(Register dest, Register src,
1261 int operand_size) {
1260 DCHECK(operand_size == 1 || operand_size == 2); 1262 DCHECK(operand_size == 1 || operand_size == 2);
1261 1263
1262 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { 1264 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
1263 if (operand_size == 1) { 1265 if (operand_size == 1) {
1264 andi(reg, reg, 0xFF); 1266 andi(src, src, 0xFF);
1265 } else { 1267 } else {
1266 andi(reg, reg, 0xFFFF); 1268 andi(src, src, 0xFFFF);
1267 } 1269 }
1268 // No need to do any preparation if operand_size is 4 1270 // No need to do any preparation if operand_size is 4
1269 1271
1270 wsbh(reg, reg); 1272 wsbh(dest, src);
1271 rotr(reg, reg, 16); 1273 rotr(dest, dest, 16);
1272 } else if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) { 1274 } else if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) {
1273 if (operand_size == 1) { 1275 if (operand_size == 1) {
1274 sll(reg, reg, 24); 1276 sll(src, src, 24);
1275 } else { 1277 } else {
1276 Register tmp = t0; 1278 Register tmp = t0;
1277 1279
1278 andi(tmp, reg, 0xFF00); 1280 andi(tmp, src, 0xFF00);
1279 sll(reg, reg, 24); 1281 sll(src, src, 24);
1280 sll(tmp, tmp, 8); 1282 sll(tmp, tmp, 8);
1281 or_(reg, tmp, reg); 1283 or_(dest, tmp, src);
1282 } 1284 }
1283 } 1285 }
1284 } 1286 }
1285 1287
1286 void MacroAssembler::Ulw(Register rd, const MemOperand& rs) { 1288 void MacroAssembler::Ulw(Register rd, const MemOperand& rs) {
1287 DCHECK(!rd.is(at)); 1289 DCHECK(!rd.is(at));
1288 DCHECK(!rs.rm().is(at)); 1290 DCHECK(!rs.rm().is(at));
1289 if (IsMipsArchVariant(kMips32r6)) { 1291 if (IsMipsArchVariant(kMips32r6)) {
1290 lw(rd, rs); 1292 lw(rd, rs);
1291 } else { 1293 } else {
(...skipping 5637 matching lines...) Expand 10 before | Expand all | Expand 10 after
6929 if (mag.shift > 0) sra(result, result, mag.shift); 6931 if (mag.shift > 0) sra(result, result, mag.shift);
6930 srl(at, dividend, 31); 6932 srl(at, dividend, 31);
6931 Addu(result, result, Operand(at)); 6933 Addu(result, result, Operand(at));
6932 } 6934 }
6933 6935
6934 6936
6935 } // namespace internal 6937 } // namespace internal
6936 } // namespace v8 6938 } // namespace v8
6937 6939
6938 #endif // V8_TARGET_ARCH_MIPS 6940 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/macro-assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698