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 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 push(eax); | 2370 push(eax); |
2371 mov(eax, Immediate(src)); | 2371 mov(eax, Immediate(src)); |
2372 movd(dst, Operand(eax)); | 2372 movd(dst, Operand(eax)); |
2373 pop(eax); | 2373 pop(eax); |
2374 } | 2374 } |
2375 } | 2375 } |
2376 } | 2376 } |
2377 | 2377 |
2378 | 2378 |
2379 void MacroAssembler::Move(XMMRegister dst, uint64_t src) { | 2379 void MacroAssembler::Move(XMMRegister dst, uint64_t src) { |
2380 uint32_t lower = static_cast<uint32_t>(src); | 2380 if (src == 0) { |
2381 uint32_t upper = static_cast<uint32_t>(src >> 32); | 2381 pxor(dst, dst); |
2382 if (upper == 0) { | |
2383 Move(dst, lower); | |
2384 } else { | 2382 } else { |
| 2383 uint32_t lower = static_cast<uint32_t>(src); |
| 2384 uint32_t upper = static_cast<uint32_t>(src >> 32); |
2385 unsigned cnt = base::bits::CountPopulation64(src); | 2385 unsigned cnt = base::bits::CountPopulation64(src); |
2386 unsigned nlz = base::bits::CountLeadingZeros64(src); | 2386 unsigned nlz = base::bits::CountLeadingZeros64(src); |
2387 unsigned ntz = base::bits::CountTrailingZeros64(src); | 2387 unsigned ntz = base::bits::CountTrailingZeros64(src); |
2388 if (nlz + cnt + ntz == 64) { | 2388 if (nlz + cnt + ntz == 64) { |
2389 pcmpeqd(dst, dst); | 2389 pcmpeqd(dst, dst); |
2390 if (ntz == 0) { | 2390 if (ntz == 0) { |
2391 psrlq(dst, 64 - cnt); | 2391 psrlq(dst, 64 - cnt); |
2392 } else { | 2392 } else { |
2393 psllq(dst, 64 - cnt); | 2393 psllq(dst, 64 - cnt); |
2394 if (nlz != 0) psrlq(dst, nlz); | 2394 if (nlz != 0) psrlq(dst, nlz); |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3219 if (mag.shift > 0) sar(edx, mag.shift); | 3219 if (mag.shift > 0) sar(edx, mag.shift); |
3220 mov(eax, dividend); | 3220 mov(eax, dividend); |
3221 shr(eax, 31); | 3221 shr(eax, 31); |
3222 add(edx, eax); | 3222 add(edx, eax); |
3223 } | 3223 } |
3224 | 3224 |
3225 | 3225 |
3226 } } // namespace v8::internal | 3226 } } // namespace v8::internal |
3227 | 3227 |
3228 #endif // V8_TARGET_ARCH_IA32 | 3228 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |