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

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

Issue 2710153002: PPC: Add OPCODE_LIST macro (Closed)
Patch Set: Move modification of assembler function declaration and definition to another commit Created 3 years, 10 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 | « no previous file | src/ppc/assembler-ppc-inl.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 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 // Check the instruction is indeed a two part load (into r12) 348 // Check the instruction is indeed a two part load (into r12)
349 // 3d802553 lis r12, 9555 349 // 3d802553 lis r12, 9555
350 // 618c5000 ori r12, r12, 20480 350 // 618c5000 ori r12, r12, 20480
351 return (((instr1 >> 16) == 0x3d80) && ((instr2 >> 16) == 0x618c)); 351 return (((instr1 >> 16) == 0x3d80) && ((instr2 >> 16) == 0x618c));
352 } 352 }
353 #endif 353 #endif
354 354
355 355
356 bool Assembler::IsCmpRegister(Instr instr) { 356 bool Assembler::IsCmpRegister(Instr instr) {
357 return (((instr & kOpcodeMask) == EXT2) && 357 return (((instr & kOpcodeMask) == EXT2) &&
358 ((instr & kExt2OpcodeMask) == CMP)); 358 ((EXT2 | (instr & kExt2OpcodeMask)) == CMP));
359 } 359 }
360 360
361 361
362 bool Assembler::IsRlwinm(Instr instr) { 362 bool Assembler::IsRlwinm(Instr instr) {
363 return ((instr & kOpcodeMask) == RLWINMX); 363 return ((instr & kOpcodeMask) == RLWINMX);
364 } 364 }
365 365
366 366
367 bool Assembler::IsAndi(Instr instr) { return ((instr & kOpcodeMask) == ANDIx); } 367 bool Assembler::IsAndi(Instr instr) { return ((instr & kOpcodeMask) == ANDIx); }
368 368
369 369
370 #if V8_TARGET_ARCH_PPC64 370 #if V8_TARGET_ARCH_PPC64
371 bool Assembler::IsRldicl(Instr instr) { 371 bool Assembler::IsRldicl(Instr instr) {
372 return (((instr & kOpcodeMask) == EXT5) && 372 return (((instr & kOpcodeMask) == EXT5) &&
373 ((instr & kExt5OpcodeMask) == RLDICL)); 373 ((EXT5 | (instr & kExt5OpcodeMask)) == RLDICL));
374 } 374 }
375 #endif 375 #endif
376 376
377 377
378 bool Assembler::IsCmpImmediate(Instr instr) { 378 bool Assembler::IsCmpImmediate(Instr instr) {
379 return ((instr & kOpcodeMask) == CMPI); 379 return ((instr & kOpcodeMask) == CMPI);
380 } 380 }
381 381
382 382
383 bool Assembler::IsCrSet(Instr instr) { 383 bool Assembler::IsCrSet(Instr instr) {
384 return (((instr & kOpcodeMask) == EXT1) && 384 return (((instr & kOpcodeMask) == EXT1) &&
385 ((instr & kExt1OpcodeMask) == CREQV)); 385 ((EXT1 | (instr & kExt1OpcodeMask)) == CREQV));
386 } 386 }
387 387
388 388
389 Register Assembler::GetCmpImmediateRegister(Instr instr) { 389 Register Assembler::GetCmpImmediateRegister(Instr instr) {
390 DCHECK(IsCmpImmediate(instr)); 390 DCHECK(IsCmpImmediate(instr));
391 return GetRA(instr); 391 return GetRA(instr);
392 } 392 }
393 393
394 394
395 int Assembler::GetCmpImmediateRawImmediate(Instr instr) { 395 int Assembler::GetCmpImmediateRawImmediate(Instr instr) {
(...skipping 22 matching lines...) Expand all
418 kUnboundMovLabelOffsetOpcode = 0 << 26, 418 kUnboundMovLabelOffsetOpcode = 0 << 26,
419 kUnboundAddLabelOffsetOpcode = 1 << 26, 419 kUnboundAddLabelOffsetOpcode = 1 << 26,
420 kUnboundMovLabelAddrOpcode = 2 << 26, 420 kUnboundMovLabelAddrOpcode = 2 << 26,
421 kUnboundJumpTableEntryOpcode = 3 << 26 421 kUnboundJumpTableEntryOpcode = 3 << 26
422 }; 422 };
423 423
424 424
425 int Assembler::target_at(int pos) { 425 int Assembler::target_at(int pos) {
426 Instr instr = instr_at(pos); 426 Instr instr = instr_at(pos);
427 // check which type of branch this is 16 or 26 bit offset 427 // check which type of branch this is 16 or 26 bit offset
428 int opcode = instr & kOpcodeMask; 428 uint32_t opcode = instr & kOpcodeMask;
429 int link; 429 int link;
430 switch (opcode) { 430 switch (opcode) {
431 case BX: 431 case BX:
432 link = SIGN_EXT_IMM26(instr & kImm26Mask); 432 link = SIGN_EXT_IMM26(instr & kImm26Mask);
433 link &= ~(kAAMask | kLKMask); // discard AA|LK bits if present 433 link &= ~(kAAMask | kLKMask); // discard AA|LK bits if present
434 break; 434 break;
435 case BCX: 435 case BCX:
436 link = SIGN_EXT_IMM16((instr & kImm16Mask)); 436 link = SIGN_EXT_IMM16((instr & kImm16Mask));
437 link &= ~(kAAMask | kLKMask); // discard AA|LK bits if present 437 link &= ~(kAAMask | kLKMask); // discard AA|LK bits if present
438 break; 438 break;
439 case kUnboundMovLabelOffsetOpcode: 439 case kUnboundMovLabelOffsetOpcode:
440 case kUnboundAddLabelOffsetOpcode: 440 case kUnboundAddLabelOffsetOpcode:
441 case kUnboundMovLabelAddrOpcode: 441 case kUnboundMovLabelAddrOpcode:
442 case kUnboundJumpTableEntryOpcode: 442 case kUnboundJumpTableEntryOpcode:
443 link = SIGN_EXT_IMM26(instr & kImm26Mask); 443 link = SIGN_EXT_IMM26(instr & kImm26Mask);
444 link <<= 2; 444 link <<= 2;
445 break; 445 break;
446 default: 446 default:
447 DCHECK(false); 447 DCHECK(false);
448 return -1; 448 return -1;
449 } 449 }
450 450
451 if (link == 0) return kEndOfChain; 451 if (link == 0) return kEndOfChain;
452 return pos + link; 452 return pos + link;
453 } 453 }
454 454
455 455
456 void Assembler::target_at_put(int pos, int target_pos, bool* is_branch) { 456 void Assembler::target_at_put(int pos, int target_pos, bool* is_branch) {
457 Instr instr = instr_at(pos); 457 Instr instr = instr_at(pos);
458 int opcode = instr & kOpcodeMask; 458 uint32_t opcode = instr & kOpcodeMask;
459 459
460 if (is_branch != nullptr) { 460 if (is_branch != nullptr) {
461 *is_branch = (opcode == BX || opcode == BCX); 461 *is_branch = (opcode == BX || opcode == BCX);
462 } 462 }
463 463
464 switch (opcode) { 464 switch (opcode) {
465 case BX: { 465 case BX: {
466 int imm26 = target_pos - pos; 466 int imm26 = target_pos - pos;
467 CHECK(is_int26(imm26) && (imm26 & (kAAMask | kLKMask)) == 0); 467 CHECK(is_int26(imm26) && (imm26 & (kAAMask | kLKMask)) == 0);
468 if (imm26 == kInstrSize && !(instr & kLKMask)) { 468 if (imm26 == kInstrSize && !(instr & kLKMask)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 528 }
529 default: 529 default:
530 DCHECK(false); 530 DCHECK(false);
531 break; 531 break;
532 } 532 }
533 } 533 }
534 534
535 535
536 int Assembler::max_reach_from(int pos) { 536 int Assembler::max_reach_from(int pos) {
537 Instr instr = instr_at(pos); 537 Instr instr = instr_at(pos);
538 int opcode = instr & kOpcodeMask; 538 uint32_t opcode = instr & kOpcodeMask;
539 539
540 // check which type of branch this is 16 or 26 bit offset 540 // check which type of branch this is 16 or 26 bit offset
541 switch (opcode) { 541 switch (opcode) {
542 case BX: 542 case BX:
543 return 26; 543 return 26;
544 case BCX: 544 case BCX:
545 return 16; 545 return 16;
546 case kUnboundMovLabelOffsetOpcode: 546 case kUnboundMovLabelOffsetOpcode:
547 case kUnboundAddLabelOffsetOpcode: 547 case kUnboundAddLabelOffsetOpcode:
548 case kUnboundMovLabelAddrOpcode: 548 case kUnboundMovLabelAddrOpcode:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 639 }
640 emit(instr | rt.code() * B21 | ra.code() * B16 | (kImm16Mask & val)); 640 emit(instr | rt.code() * B21 | ra.code() * B16 | (kImm16Mask & val));
641 } 641 }
642 642
643 643
644 void Assembler::x_form(Instr instr, Register ra, Register rs, Register rb, 644 void Assembler::x_form(Instr instr, Register ra, Register rs, Register rb,
645 RCBit r) { 645 RCBit r) {
646 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | r); 646 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | r);
647 } 647 }
648 648
649
650 void Assembler::xo_form(Instr instr, Register rt, Register ra, Register rb, 649 void Assembler::xo_form(Instr instr, Register rt, Register ra, Register rb,
651 OEBit o, RCBit r) { 650 OEBit o, RCBit r) {
652 emit(instr | rt.code() * B21 | ra.code() * B16 | rb.code() * B11 | o | r); 651 emit(instr | rt.code() * B21 | ra.code() * B16 | rb.code() * B11 | o | r);
653 } 652 }
654 653
655 void Assembler::xx3_form(Instr instr, DoubleRegister t, DoubleRegister a, 654 void Assembler::xx3_form(Instr instr, DoubleRegister t, DoubleRegister a,
656 DoubleRegister b) { 655 DoubleRegister b) {
657 int AX = ((a.code() & 0x20) >> 5) & 0x1; 656 int AX = ((a.code() & 0x20) >> 5) & 0x1;
658 int BX = ((b.code() & 0x20) >> 5) & 0x1; 657 int BX = ((b.code() & 0x20) >> 5) & 0x1;
659 int TX = ((t.code() & 0x20) >> 5) & 0x1; 658 int TX = ((t.code() & 0x20) >> 5) & 0x1;
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 2243
2245 2244
2246 void Assembler::fcfidu(const DoubleRegister frt, const DoubleRegister frb, 2245 void Assembler::fcfidu(const DoubleRegister frt, const DoubleRegister frb,
2247 RCBit rc) { 2246 RCBit rc) {
2248 emit(EXT4 | FCFIDU | frt.code() * B21 | frb.code() * B11 | rc); 2247 emit(EXT4 | FCFIDU | frt.code() * B21 | frb.code() * B11 | rc);
2249 } 2248 }
2250 2249
2251 2250
2252 void Assembler::fcfidus(const DoubleRegister frt, const DoubleRegister frb, 2251 void Assembler::fcfidus(const DoubleRegister frt, const DoubleRegister frb,
2253 RCBit rc) { 2252 RCBit rc) {
2254 emit(EXT3 | FCFIDU | frt.code() * B21 | frb.code() * B11 | rc); 2253 emit(EXT3 | FCFIDUS | frt.code() * B21 | frb.code() * B11 | rc);
2255 } 2254 }
2256 2255
2257 2256
2258 void Assembler::fcfids(const DoubleRegister frt, const DoubleRegister frb, 2257 void Assembler::fcfids(const DoubleRegister frt, const DoubleRegister frb,
2259 RCBit rc) { 2258 RCBit rc) {
2260 emit(EXT3 | FCFID | frt.code() * B21 | frb.code() * B11 | rc); 2259 emit(EXT3 | FCFIDS | frt.code() * B21 | frb.code() * B11 | rc);
2261 } 2260 }
2262 2261
2263 2262
2264 void Assembler::fctid(const DoubleRegister frt, const DoubleRegister frb, 2263 void Assembler::fctid(const DoubleRegister frt, const DoubleRegister frb,
2265 RCBit rc) { 2264 RCBit rc) {
2266 emit(EXT4 | FCTID | frt.code() * B21 | frb.code() * B11 | rc); 2265 emit(EXT4 | FCTID | frt.code() * B21 | frb.code() * B11 | rc);
2267 } 2266 }
2268 2267
2269 2268
2270 void Assembler::fctidz(const DoubleRegister frt, const DoubleRegister frb, 2269 void Assembler::fctidz(const DoubleRegister frt, const DoubleRegister frb,
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 2566
2568 trampoline_ = Trampoline(pc_offset() - size, tracked_branch_count_); 2567 trampoline_ = Trampoline(pc_offset() - size, tracked_branch_count_);
2569 } 2568 }
2570 } 2569 }
2571 2570
2572 2571
2573 } // namespace internal 2572 } // namespace internal
2574 } // namespace v8 2573 } // namespace v8
2575 2574
2576 #endif // V8_TARGET_ARCH_PPC 2575 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/ppc/assembler-ppc-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698