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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 BranchLong(L, PROTECT); | 1350 BranchLong(L, PROTECT); |
1351 bind(&skip); | 1351 bind(&skip); |
1352 } else { | 1352 } else { |
1353 bnvc(rs, rt, L); | 1353 bnvc(rs, rt, L); |
1354 } | 1354 } |
1355 } | 1355 } |
1356 | 1356 |
1357 // ------------Pseudo-instructions------------- | 1357 // ------------Pseudo-instructions------------- |
1358 | 1358 |
1359 // Change endianness | 1359 // Change endianness |
1360 void MacroAssembler::ByteSwapSigned(Register reg, int operand_size) { | 1360 void MacroAssembler::ByteSwapSigned(Register dest, Register src, |
| 1361 int operand_size) { |
1361 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4 || | 1362 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4 || |
1362 operand_size == 8); | 1363 operand_size == 8); |
1363 DCHECK(kArchVariant == kMips64r6 || kArchVariant == kMips64r2); | 1364 DCHECK(kArchVariant == kMips64r6 || kArchVariant == kMips64r2); |
1364 if (operand_size == 1) { | 1365 if (operand_size == 1) { |
1365 seb(reg, reg); | 1366 seb(src, src); |
1366 sll(reg, reg, 0); | 1367 sll(src, src, 0); |
1367 dsbh(reg, reg); | 1368 dsbh(dest, src); |
1368 dshd(reg, reg); | 1369 dshd(dest, dest); |
1369 } else if (operand_size == 2) { | 1370 } else if (operand_size == 2) { |
1370 seh(reg, reg); | 1371 seh(src, src); |
1371 sll(reg, reg, 0); | 1372 sll(src, src, 0); |
1372 dsbh(reg, reg); | 1373 dsbh(dest, src); |
1373 dshd(reg, reg); | 1374 dshd(dest, dest); |
1374 } else if (operand_size == 4) { | 1375 } else if (operand_size == 4) { |
1375 sll(reg, reg, 0); | 1376 sll(src, src, 0); |
1376 dsbh(reg, reg); | 1377 dsbh(dest, src); |
1377 dshd(reg, reg); | 1378 dshd(dest, dest); |
1378 } else { | 1379 } else { |
1379 dsbh(reg, reg); | 1380 dsbh(dest, src); |
1380 dshd(reg, reg); | 1381 dshd(dest, dest); |
1381 } | 1382 } |
1382 } | 1383 } |
1383 | 1384 |
1384 void MacroAssembler::ByteSwapUnsigned(Register reg, int operand_size) { | 1385 void MacroAssembler::ByteSwapUnsigned(Register dest, Register src, |
| 1386 int operand_size) { |
1385 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4); | 1387 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4); |
1386 if (operand_size == 1) { | 1388 if (operand_size == 1) { |
1387 andi(reg, reg, 0xFF); | 1389 andi(src, src, 0xFF); |
1388 dsbh(reg, reg); | 1390 dsbh(dest, src); |
1389 dshd(reg, reg); | 1391 dshd(dest, dest); |
1390 } else if (operand_size == 2) { | 1392 } else if (operand_size == 2) { |
1391 andi(reg, reg, 0xFFFF); | 1393 andi(src, src, 0xFFFF); |
1392 dsbh(reg, reg); | 1394 dsbh(dest, src); |
1393 dshd(reg, reg); | 1395 dshd(dest, dest); |
1394 } else { | 1396 } else { |
1395 dsll32(reg, reg, 0); | 1397 dsll32(src, src, 0); |
1396 dsrl32(reg, reg, 0); | 1398 dsrl32(src, src, 0); |
1397 dsbh(reg, reg); | 1399 dsbh(dest, src); |
1398 dshd(reg, reg); | 1400 dshd(dest, dest); |
1399 } | 1401 } |
1400 } | 1402 } |
1401 | 1403 |
1402 void MacroAssembler::Ulw(Register rd, const MemOperand& rs) { | 1404 void MacroAssembler::Ulw(Register rd, const MemOperand& rs) { |
1403 DCHECK(!rd.is(at)); | 1405 DCHECK(!rd.is(at)); |
1404 DCHECK(!rs.rm().is(at)); | 1406 DCHECK(!rs.rm().is(at)); |
1405 if (kArchVariant == kMips64r6) { | 1407 if (kArchVariant == kMips64r6) { |
1406 lw(rd, rs); | 1408 lw(rd, rs); |
1407 } else { | 1409 } else { |
1408 DCHECK(kArchVariant == kMips64r2); | 1410 DCHECK(kArchVariant == kMips64r2); |
(...skipping 5949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7358 if (mag.shift > 0) sra(result, result, mag.shift); | 7360 if (mag.shift > 0) sra(result, result, mag.shift); |
7359 srl(at, dividend, 31); | 7361 srl(at, dividend, 31); |
7360 Addu(result, result, Operand(at)); | 7362 Addu(result, result, Operand(at)); |
7361 } | 7363 } |
7362 | 7364 |
7363 | 7365 |
7364 } // namespace internal | 7366 } // namespace internal |
7365 } // namespace v8 | 7367 } // namespace v8 |
7366 | 7368 |
7367 #endif // V8_TARGET_ARCH_MIPS64 | 7369 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |