OLD | NEW |
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 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 } else { | 2443 } else { |
2444 DCHECK_EQ(0, imm8); | 2444 DCHECK_EQ(0, imm8); |
2445 psrlq(dst, 32); | 2445 psrlq(dst, 32); |
2446 punpckldq(xmm0, dst); | 2446 punpckldq(xmm0, dst); |
2447 movaps(dst, xmm0); | 2447 movaps(dst, xmm0); |
2448 } | 2448 } |
2449 } | 2449 } |
2450 | 2450 |
2451 | 2451 |
2452 void MacroAssembler::Lzcnt(Register dst, const Operand& src) { | 2452 void MacroAssembler::Lzcnt(Register dst, const Operand& src) { |
2453 // TODO(intel): Add support for LZCNT (with ABM/BMI1). | 2453 if (CpuFeatures::IsSupported(LZCNT)) { |
| 2454 CpuFeatureScope scope(this, LZCNT); |
| 2455 lzcnt(dst, src); |
| 2456 return; |
| 2457 } |
2454 Label not_zero_src; | 2458 Label not_zero_src; |
2455 bsr(dst, src); | 2459 bsr(dst, src); |
2456 j(not_zero, ¬_zero_src, Label::kNear); | 2460 j(not_zero, ¬_zero_src, Label::kNear); |
2457 Move(dst, Immediate(63)); // 63^31 == 32 | 2461 Move(dst, Immediate(63)); // 63^31 == 32 |
2458 bind(¬_zero_src); | 2462 bind(¬_zero_src); |
2459 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x. | 2463 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x. |
2460 } | 2464 } |
2461 | 2465 |
2462 | 2466 |
2463 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 2467 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3219 if (mag.shift > 0) sar(edx, mag.shift); | 3223 if (mag.shift > 0) sar(edx, mag.shift); |
3220 mov(eax, dividend); | 3224 mov(eax, dividend); |
3221 shr(eax, 31); | 3225 shr(eax, 31); |
3222 add(edx, eax); | 3226 add(edx, eax); |
3223 } | 3227 } |
3224 | 3228 |
3225 | 3229 |
3226 } } // namespace v8::internal | 3230 } } // namespace v8::internal |
3227 | 3231 |
3228 #endif // V8_TARGET_ARCH_IA32 | 3232 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |