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

Side by Side Diff: src/x87/macro-assembler-x87.cc

Issue 1420233002: X87: Added Popcnt as an optional operator and implement it on x64 and ia32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 void MacroAssembler::Tzcnt(Register dst, const Operand& src) { 2320 void MacroAssembler::Tzcnt(Register dst, const Operand& src) {
2321 // TODO(intel): Add support for TZCNT (with ABM/BMI1). 2321 // TODO(intel): Add support for TZCNT (with ABM/BMI1).
2322 Label not_zero_src; 2322 Label not_zero_src;
2323 bsf(dst, src); 2323 bsf(dst, src);
2324 j(not_zero, &not_zero_src, Label::kNear); 2324 j(not_zero, &not_zero_src, Label::kNear);
2325 Move(dst, Immediate(32)); // The result of tzcnt is 32 if src = 0. 2325 Move(dst, Immediate(32)); // The result of tzcnt is 32 if src = 0.
2326 bind(&not_zero_src); 2326 bind(&not_zero_src);
2327 } 2327 }
2328 2328
2329 2329
2330 void MacroAssembler::Popcnt(Register dst, const Operand& src) {
2331 // TODO(intel): Add support for POPCNT (with POPCNT)
2332 // if (CpuFeatures::IsSupported(POPCNT)) {
2333 // CpuFeatureScope scope(this, POPCNT);
2334 // popcnt(dst, src);
2335 // return;
2336 // }
2337 UNREACHABLE();
2338 }
2339
2340
2330 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { 2341 void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
2331 if (FLAG_native_code_counters && counter->Enabled()) { 2342 if (FLAG_native_code_counters && counter->Enabled()) {
2332 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); 2343 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));
2333 } 2344 }
2334 } 2345 }
2335 2346
2336 2347
2337 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { 2348 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
2338 DCHECK(value > 0); 2349 DCHECK(value > 0);
2339 if (FLAG_native_code_counters && counter->Enabled()) { 2350 if (FLAG_native_code_counters && counter->Enabled()) {
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 mov(eax, dividend); 3022 mov(eax, dividend);
3012 shr(eax, 31); 3023 shr(eax, 31);
3013 add(edx, eax); 3024 add(edx, eax);
3014 } 3025 }
3015 3026
3016 3027
3017 } // namespace internal 3028 } // namespace internal
3018 } // namespace v8 3029 } // namespace v8
3019 3030
3020 #endif // V8_TARGET_ARCH_X87 3031 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698