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

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

Issue 2619763003: PPC: Implement VSX instructions (Closed)
Patch Set: Fixed native assembler code Created 3 years, 11 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/ppc/assembler-ppc.h ('k') | src/ppc/constants-ppc.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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 #endif 73 #endif
74 if (cpu.part() == base::CPU::PPC_POWER6 || 74 if (cpu.part() == base::CPU::PPC_POWER6 ||
75 cpu.part() == base::CPU::PPC_POWER7 || 75 cpu.part() == base::CPU::PPC_POWER7 ||
76 cpu.part() == base::CPU::PPC_POWER8) { 76 cpu.part() == base::CPU::PPC_POWER8) {
77 supported_ |= (1u << LWSYNC); 77 supported_ |= (1u << LWSYNC);
78 } 78 }
79 if (cpu.part() == base::CPU::PPC_POWER7 || 79 if (cpu.part() == base::CPU::PPC_POWER7 ||
80 cpu.part() == base::CPU::PPC_POWER8) { 80 cpu.part() == base::CPU::PPC_POWER8) {
81 supported_ |= (1u << ISELECT); 81 supported_ |= (1u << ISELECT);
82 supported_ |= (1u << VSX);
82 } 83 }
83 #if V8_OS_LINUX 84 #if V8_OS_LINUX
84 if (!(cpu.part() == base::CPU::PPC_G5 || cpu.part() == base::CPU::PPC_G4)) { 85 if (!(cpu.part() == base::CPU::PPC_G5 || cpu.part() == base::CPU::PPC_G4)) {
85 // Assume support 86 // Assume support
86 supported_ |= (1u << FPU); 87 supported_ |= (1u << FPU);
87 } 88 }
88 if (cpu.icache_line_size() != base::CPU::UNKNOWN_CACHE_LINE_SIZE) { 89 if (cpu.icache_line_size() != base::CPU::UNKNOWN_CACHE_LINE_SIZE) {
89 icache_line_size_ = cpu.icache_line_size(); 90 icache_line_size_ = cpu.icache_line_size();
90 } 91 }
91 #elif V8_OS_AIX 92 #elif V8_OS_AIX
92 // Assume support FP support and default cache line size 93 // Assume support FP support and default cache line size
93 supported_ |= (1u << FPU); 94 supported_ |= (1u << FPU);
94 #endif 95 #endif
95 #else // Simulator 96 #else // Simulator
96 supported_ |= (1u << FPU); 97 supported_ |= (1u << FPU);
97 supported_ |= (1u << LWSYNC); 98 supported_ |= (1u << LWSYNC);
98 supported_ |= (1u << ISELECT); 99 supported_ |= (1u << ISELECT);
100 supported_ |= (1u << VSX);
99 #if V8_TARGET_ARCH_PPC64 101 #if V8_TARGET_ARCH_PPC64
100 supported_ |= (1u << FPR_GPR_MOV); 102 supported_ |= (1u << FPR_GPR_MOV);
101 #endif 103 #endif
102 #endif 104 #endif
103 } 105 }
104 106
105 107
106 void CpuFeatures::PrintTarget() { 108 void CpuFeatures::PrintTarget() {
107 const char* ppc_arch = NULL; 109 const char* ppc_arch = NULL;
108 110
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 RCBit r) { 636 RCBit r) {
635 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | r); 637 emit(instr | rs.code() * B21 | ra.code() * B16 | rb.code() * B11 | r);
636 } 638 }
637 639
638 640
639 void Assembler::xo_form(Instr instr, Register rt, Register ra, Register rb, 641 void Assembler::xo_form(Instr instr, Register rt, Register ra, Register rb,
640 OEBit o, RCBit r) { 642 OEBit o, RCBit r) {
641 emit(instr | rt.code() * B21 | ra.code() * B16 | rb.code() * B11 | o | r); 643 emit(instr | rt.code() * B21 | ra.code() * B16 | rb.code() * B11 | o | r);
642 } 644 }
643 645
646 void Assembler::xx3_form(Instr instr, DoubleRegister t, DoubleRegister a,
647 DoubleRegister b) {
648 int AX = ((a.code() & 0x20) >> 5) & 0x1;
649 int BX = ((b.code() & 0x20) >> 5) & 0x1;
650 int TX = ((t.code() & 0x20) >> 5) & 0x1;
651 emit(instr | (t.code() & 0x1F) * B21 | (a.code() & 0x1F) * B16 | (b.code()
652 & 0x1F) * B11 | AX * B2 | BX * B1 | TX);
653 }
644 654
645 void Assembler::md_form(Instr instr, Register ra, Register rs, int shift, 655 void Assembler::md_form(Instr instr, Register ra, Register rs, int shift,
646 int maskbit, RCBit r) { 656 int maskbit, RCBit r) {
647 int sh0_4 = shift & 0x1f; 657 int sh0_4 = shift & 0x1f;
648 int sh5 = (shift >> 5) & 0x1; 658 int sh5 = (shift >> 5) & 0x1;
649 int m0_4 = maskbit & 0x1f; 659 int m0_4 = maskbit & 0x1f;
650 int m5 = (maskbit >> 5) & 0x1; 660 int m5 = (maskbit >> 5) & 0x1;
651 661
652 emit(instr | rs.code() * B21 | ra.code() * B16 | sh0_4 * B11 | m0_4 * B6 | 662 emit(instr | rs.code() * B21 | ra.code() * B16 | sh0_4 * B11 | m0_4 * B6 |
653 m5 * B5 | sh5 * B1 | r); 663 m5 * B5 | sh5 * B1 | r);
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 } 2325 }
2316 2326
2317 2327
2318 void Assembler::fmsub(const DoubleRegister frt, const DoubleRegister fra, 2328 void Assembler::fmsub(const DoubleRegister frt, const DoubleRegister fra,
2319 const DoubleRegister frc, const DoubleRegister frb, 2329 const DoubleRegister frc, const DoubleRegister frb,
2320 RCBit rc) { 2330 RCBit rc) {
2321 emit(EXT4 | FMSUB | frt.code() * B21 | fra.code() * B16 | frb.code() * B11 | 2331 emit(EXT4 | FMSUB | frt.code() * B21 | fra.code() * B16 | frb.code() * B11 |
2322 frc.code() * B6 | rc); 2332 frc.code() * B6 | rc);
2323 } 2333 }
2324 2334
2335 // Support for VSX instructions
2336
2337 void Assembler::xsadddp(const DoubleRegister frt, const DoubleRegister fra,
2338 const DoubleRegister frb) {
2339 xx3_form(EXT6 | XSADDDP, frt, fra, frb);
2340 }
2341 void Assembler::xssubdp(const DoubleRegister frt, const DoubleRegister fra,
2342 const DoubleRegister frb) {
2343 xx3_form(EXT6 | XSSUBDP, frt, fra, frb);
2344 }
2345 void Assembler::xsdivdp(const DoubleRegister frt, const DoubleRegister fra,
2346 const DoubleRegister frb) {
2347 xx3_form(EXT6 | XSDIVDP, frt, fra, frb);
2348 }
2349 void Assembler::xsmuldp(const DoubleRegister frt, const DoubleRegister fra,
2350 const DoubleRegister frb) {
2351 xx3_form(EXT6 | XSMULDP, frt, fra, frb);
2352 }
2325 2353
2326 // Pseudo instructions. 2354 // Pseudo instructions.
2327 void Assembler::nop(int type) { 2355 void Assembler::nop(int type) {
2328 Register reg = r0; 2356 Register reg = r0;
2329 switch (type) { 2357 switch (type) {
2330 case NON_MARKING_NOP: 2358 case NON_MARKING_NOP:
2331 reg = r0; 2359 reg = r0;
2332 break; 2360 break;
2333 case GROUP_ENDING_NOP: 2361 case GROUP_ENDING_NOP:
2334 reg = r2; 2362 reg = r2;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2543
2516 trampoline_ = Trampoline(pc_offset() - size, tracked_branch_count_); 2544 trampoline_ = Trampoline(pc_offset() - size, tracked_branch_count_);
2517 } 2545 }
2518 } 2546 }
2519 2547
2520 2548
2521 } // namespace internal 2549 } // namespace internal
2522 } // namespace v8 2550 } // namespace v8
2523 2551
2524 #endif // V8_TARGET_ARCH_PPC 2552 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/assembler-ppc.h ('k') | src/ppc/constants-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698