OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 } | 1353 } |
1354 | 1354 |
1355 case TEQ: { | 1355 case TEQ: { |
1356 if (instr->HasS()) { | 1356 if (instr->HasS()) { |
1357 // Format(instr, "teq'cond 'rn, 'shift_rm"); | 1357 // Format(instr, "teq'cond 'rn, 'shift_rm"); |
1358 // Format(instr, "teq'cond 'rn, 'imm"); | 1358 // Format(instr, "teq'cond 'rn, 'imm"); |
1359 alu_out = rn_val ^ shifter_operand; | 1359 alu_out = rn_val ^ shifter_operand; |
1360 SetNZFlags(alu_out); | 1360 SetNZFlags(alu_out); |
1361 SetCFlag(shifter_carry_out); | 1361 SetCFlag(shifter_carry_out); |
1362 } else { | 1362 } else { |
1363 UNIMPLEMENTED(); | 1363 ASSERT(type == 0); |
| 1364 int rm = instr->RmField(); |
| 1365 switch (instr->Bits(7, 4)) { |
| 1366 case BX: |
| 1367 set_pc(get_register(rm)); |
| 1368 break; |
| 1369 case BLX: { |
| 1370 uint32_t old_pc = get_pc(); |
| 1371 set_pc(get_register(rm)); |
| 1372 set_register(lr, old_pc + Instr::kInstrSize); |
| 1373 break; |
| 1374 } |
| 1375 default: |
| 1376 UNIMPLEMENTED(); |
| 1377 } |
1364 } | 1378 } |
1365 break; | 1379 break; |
1366 } | 1380 } |
1367 | 1381 |
1368 case CMP: { | 1382 case CMP: { |
1369 if (instr->HasS()) { | 1383 if (instr->HasS()) { |
1370 // Format(instr, "cmp'cond 'rn, 'shift_rm"); | 1384 // Format(instr, "cmp'cond 'rn, 'shift_rm"); |
1371 // Format(instr, "cmp'cond 'rn, 'imm"); | 1385 // Format(instr, "cmp'cond 'rn, 'imm"); |
1372 alu_out = rn_val - shifter_operand; | 1386 alu_out = rn_val - shifter_operand; |
1373 SetNZFlags(alu_out); | 1387 SetNZFlags(alu_out); |
1374 SetCFlag(!BorrowFrom(rn_val, shifter_operand)); | 1388 SetCFlag(!BorrowFrom(rn_val, shifter_operand)); |
1375 SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, false)); | 1389 SetVFlag(OverflowFrom(alu_out, rn_val, shifter_operand, false)); |
1376 } else { | 1390 } else { |
1377 UNIMPLEMENTED(); | 1391 UNIMPLEMENTED(); |
1378 } | 1392 } |
1379 break; | 1393 break; |
1380 } | 1394 } |
1381 | 1395 |
1382 case CMN: { | 1396 case CMN: { |
1383 if (instr->HasS()) { | 1397 if (instr->HasS()) { |
1384 Format(instr, "cmn'cond 'rn, 'shift_rm"); | 1398 Format(instr, "cmn'cond 'rn, 'shift_rm"); |
1385 Format(instr, "cmn'cond 'rn, 'imm"); | 1399 Format(instr, "cmn'cond 'rn, 'imm"); |
1386 } else { | 1400 } else { |
1387 UNIMPLEMENTED(); | 1401 ASSERT(type == 0); |
| 1402 int rm = instr->RmField(); |
| 1403 int rd = instr->RdField(); |
| 1404 switch (instr->Bits(7, 4)) { |
| 1405 case CLZ: { |
| 1406 uint32_t bits = get_register(rm); |
| 1407 int leading_zeros = 0; |
| 1408 if (bits == 0) { |
| 1409 leading_zeros = 32; |
| 1410 } else { |
| 1411 while ((bits & 0x80000000u) == 0) { |
| 1412 bits <<= 1; |
| 1413 leading_zeros++; |
| 1414 } |
| 1415 } |
| 1416 set_register(rd, leading_zeros); |
| 1417 break; |
| 1418 } |
| 1419 default: |
| 1420 UNIMPLEMENTED(); |
| 1421 } |
1388 } | 1422 } |
1389 break; | 1423 break; |
1390 } | 1424 } |
1391 | 1425 |
1392 case ORR: { | 1426 case ORR: { |
1393 // Format(instr, "orr'cond's 'rd, 'rn, 'shift_rm"); | 1427 // Format(instr, "orr'cond's 'rd, 'rn, 'shift_rm"); |
1394 // Format(instr, "orr'cond's 'rd, 'rn, 'imm"); | 1428 // Format(instr, "orr'cond's 'rd, 'rn, 'imm"); |
1395 alu_out = rn_val | shifter_operand; | 1429 alu_out = rn_val | shifter_operand; |
1396 set_register(rd, alu_out); | 1430 set_register(rd, alu_out); |
1397 if (instr->HasS()) { | 1431 if (instr->HasS()) { |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 set_register(r10, r10_val); | 1791 set_register(r10, r10_val); |
1758 set_register(r11, r11_val); | 1792 set_register(r11, r11_val); |
1759 | 1793 |
1760 int result = get_register(r0); | 1794 int result = get_register(r0); |
1761 return reinterpret_cast<Object*>(result); | 1795 return reinterpret_cast<Object*>(result); |
1762 } | 1796 } |
1763 | 1797 |
1764 } } // namespace assembler::arm | 1798 } } // namespace assembler::arm |
1765 | 1799 |
1766 #endif // !defined(__arm__) | 1800 #endif // !defined(__arm__) |
OLD | NEW |