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

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

Issue 1021183002: [turbofan] Turn Math.clz32 into an inlinable builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/ia32/macro-assembler-ia32.h ('k') | src/math.js » ('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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 punpckldq(dst, xmm0); 2459 punpckldq(dst, xmm0);
2460 } else { 2460 } else {
2461 DCHECK_EQ(0, imm8); 2461 DCHECK_EQ(0, imm8);
2462 psrlq(dst, 32); 2462 psrlq(dst, 32);
2463 punpckldq(xmm0, dst); 2463 punpckldq(xmm0, dst);
2464 movaps(dst, xmm0); 2464 movaps(dst, xmm0);
2465 } 2465 }
2466 } 2466 }
2467 2467
2468 2468
2469 void MacroAssembler::Lzcnt(Register dst, const Operand& src) {
2470 // TODO(intel): Add support for LZCNT (with ABM/BMI1).
2471 Label not_zero_src;
2472 bsr(dst, src);
2473 j(not_zero, &not_zero_src, Label::kNear);
2474 Move(dst, Immediate(63)); // 63^31 == 32
2475 bind(&not_zero_src);
2476 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x.
2477 }
2478
2479
2469 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { 2480 void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
2470 if (FLAG_native_code_counters && counter->Enabled()) { 2481 if (FLAG_native_code_counters && counter->Enabled()) {
2471 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); 2482 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));
2472 } 2483 }
2473 } 2484 }
2474 2485
2475 2486
2476 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { 2487 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
2477 DCHECK(value > 0); 2488 DCHECK(value > 0);
2478 if (FLAG_native_code_counters && counter->Enabled()) { 2489 if (FLAG_native_code_counters && counter->Enabled()) {
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 if (mag.shift > 0) sar(edx, mag.shift); 3236 if (mag.shift > 0) sar(edx, mag.shift);
3226 mov(eax, dividend); 3237 mov(eax, dividend);
3227 shr(eax, 31); 3238 shr(eax, 31);
3228 add(edx, eax); 3239 add(edx, eax);
3229 } 3240 }
3230 3241
3231 3242
3232 } } // namespace v8::internal 3243 } } // namespace v8::internal
3233 3244
3234 #endif // V8_TARGET_ARCH_IA32 3245 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698