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

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

Issue 1222133004: PPC: perf enhancement: omit redundant compare with 0 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 no_trampoline_pool_before_ = 0; 212 no_trampoline_pool_before_ = 0;
213 trampoline_pool_blocked_nesting_ = 0; 213 trampoline_pool_blocked_nesting_ = 0;
214 constant_pool_entry_sharing_blocked_nesting_ = 0; 214 constant_pool_entry_sharing_blocked_nesting_ = 0;
215 // We leave space (kMaxBlockTrampolineSectionSize) 215 // We leave space (kMaxBlockTrampolineSectionSize)
216 // for BlockTrampolinePoolScope buffer. 216 // for BlockTrampolinePoolScope buffer.
217 next_buffer_check_ = 217 next_buffer_check_ =
218 FLAG_force_long_branches ? kMaxInt : kMaxCondBranchReach - 218 FLAG_force_long_branches ? kMaxInt : kMaxCondBranchReach -
219 kMaxBlockTrampolineSectionSize; 219 kMaxBlockTrampolineSectionSize;
220 internal_trampoline_exception_ = false; 220 internal_trampoline_exception_ = false;
221 last_bound_pos_ = 0; 221 last_bound_pos_ = 0;
222 optimizable_cmpi_pos_ = -1;
222 trampoline_emitted_ = FLAG_force_long_branches; 223 trampoline_emitted_ = FLAG_force_long_branches;
223 unbound_labels_count_ = 0; 224 unbound_labels_count_ = 0;
224 ClearRecordedAstId(); 225 ClearRecordedAstId();
225 relocations_.reserve(128); 226 relocations_.reserve(128);
226 } 227 }
227 228
228 229
229 void Assembler::GetCode(CodeDesc* desc) { 230 void Assembler::GetCode(CodeDesc* desc) {
230 // Emit constant pool if necessary. 231 // Emit constant pool if necessary.
231 int constant_pool_offset = EmitConstantPool(); 232 int constant_pool_offset = EmitConstantPool();
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 #endif 1024 #endif
1024 DCHECK(cr.code() >= 0 && cr.code() <= 7); 1025 DCHECK(cr.code() >= 0 && cr.code() <= 7);
1025 emit(EXT2 | CMPL | cr.code() * B23 | L * B21 | src1.code() * B16 | 1026 emit(EXT2 | CMPL | cr.code() * B23 | L * B21 | src1.code() * B16 |
1026 src2.code() * B11); 1027 src2.code() * B11);
1027 } 1028 }
1028 1029
1029 1030
1030 void Assembler::cmpwi(Register src1, const Operand& src2, CRegister cr) { 1031 void Assembler::cmpwi(Register src1, const Operand& src2, CRegister cr) {
1031 intptr_t imm16 = src2.imm_; 1032 intptr_t imm16 = src2.imm_;
1032 int L = 0; 1033 int L = 0;
1034 int pos = pc_offset();
1033 DCHECK(is_int16(imm16)); 1035 DCHECK(is_int16(imm16));
1034 DCHECK(cr.code() >= 0 && cr.code() <= 7); 1036 DCHECK(cr.code() >= 0 && cr.code() <= 7);
1035 imm16 &= kImm16Mask; 1037 imm16 &= kImm16Mask;
1038
1039 // For cmpwi against 0, save postition and cr for later examination
1040 // of potential optimization.
1041 if (imm16 == 0 && pos > 0 && last_bound_pos_ != pos) {
1042 optimizable_cmpi_pos_ = pos;
1043 cmpi_cr_ = cr;
1044 }
1036 emit(CMPI | cr.code() * B23 | L * B21 | src1.code() * B16 | imm16); 1045 emit(CMPI | cr.code() * B23 | L * B21 | src1.code() * B16 | imm16);
1037 } 1046 }
1038 1047
1039 1048
1040 void Assembler::cmplwi(Register src1, const Operand& src2, CRegister cr) { 1049 void Assembler::cmplwi(Register src1, const Operand& src2, CRegister cr) {
1041 uintptr_t uimm16 = src2.imm_; 1050 uintptr_t uimm16 = src2.imm_;
1042 int L = 0; 1051 int L = 0;
1043 DCHECK(is_uint16(uimm16)); 1052 DCHECK(is_uint16(uimm16));
1044 DCHECK(cr.code() >= 0 && cr.code() <= 7); 1053 DCHECK(cr.code() >= 0 && cr.code() <= 7);
1045 uimm16 &= kImm16Mask; 1054 uimm16 &= kImm16Mask;
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 pc_offset() + kMaxCondBranchReach - kMaxBlockTrampolineSectionSize; 2447 pc_offset() + kMaxCondBranchReach - kMaxBlockTrampolineSectionSize;
2439 } 2448 }
2440 return; 2449 return;
2441 } 2450 }
2442 2451
2443 2452
2444 } // namespace internal 2453 } // namespace internal
2445 } // namespace v8 2454 } // namespace v8
2446 2455
2447 #endif // V8_TARGET_ARCH_PPC 2456 #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