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

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

Issue 1412893006: X87: CTZ instruction implemented as optional operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/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 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 // TODO(intel): Add support for LZCNT (with ABM/BMI1). 2310 // TODO(intel): Add support for LZCNT (with ABM/BMI1).
2311 Label not_zero_src; 2311 Label not_zero_src;
2312 bsr(dst, src); 2312 bsr(dst, src);
2313 j(not_zero, &not_zero_src, Label::kNear); 2313 j(not_zero, &not_zero_src, Label::kNear);
2314 Move(dst, Immediate(63)); // 63^31 == 32 2314 Move(dst, Immediate(63)); // 63^31 == 32
2315 bind(&not_zero_src); 2315 bind(&not_zero_src);
2316 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x. 2316 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x.
2317 } 2317 }
2318 2318
2319 2319
2320 void MacroAssembler::Tzcnt(Register dst, const Operand& src) {
2321 // TODO(intel): Add support for TZCNT (with ABM/BMI1).
2322 Label not_zero_src;
2323 bsf(dst, src);
2324 j(not_zero, &not_zero_src, Label::kNear);
2325 Move(dst, Immediate(32)); // The result of tzcnt is 32 if src = 0.
2326 bind(&not_zero_src);
2327 }
2328
2329
2320 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { 2330 void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
2321 if (FLAG_native_code_counters && counter->Enabled()) { 2331 if (FLAG_native_code_counters && counter->Enabled()) {
2322 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); 2332 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));
2323 } 2333 }
2324 } 2334 }
2325 2335
2326 2336
2327 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { 2337 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
2328 DCHECK(value > 0); 2338 DCHECK(value > 0);
2329 if (FLAG_native_code_counters && counter->Enabled()) { 2339 if (FLAG_native_code_counters && counter->Enabled()) {
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 mov(eax, dividend); 3011 mov(eax, dividend);
3002 shr(eax, 31); 3012 shr(eax, 31);
3003 add(edx, eax); 3013 add(edx, eax);
3004 } 3014 }
3005 3015
3006 3016
3007 } // namespace internal 3017 } // namespace internal
3008 } // namespace v8 3018 } // namespace v8
3009 3019
3010 #endif // V8_TARGET_ARCH_X87 3020 #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