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

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

Issue 1040603002: [x64] Introduce BMI instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: clear TODOs of MacroAssembler::Lzcntl Created 5 years, 8 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
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_X64 7 #if V8_TARGET_ARCH_X64
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 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 punpckldq(dst, xmm0); 2878 punpckldq(dst, xmm0);
2879 } else { 2879 } else {
2880 DCHECK_EQ(0, imm8); 2880 DCHECK_EQ(0, imm8);
2881 psrlq(dst, 32); 2881 psrlq(dst, 32);
2882 punpckldq(xmm0, dst); 2882 punpckldq(xmm0, dst);
2883 movaps(dst, xmm0); 2883 movaps(dst, xmm0);
2884 } 2884 }
2885 } 2885 }
2886 2886
2887 2887
2888 void MacroAssembler::Lzcntl(Register dst, Register src) {
2889 // TODO(intel): Add support for LZCNT (BMI1/ABM).
Benedikt Meurer 2015/04/08 05:45:41 Keep these functions, because not all machines wil
2890 Label not_zero_src;
2891 bsrl(dst, src);
2892 j(not_zero, &not_zero_src, Label::kNear);
2893 Set(dst, 63); // 63^31 == 32
2894 bind(&not_zero_src);
2895 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
2896 }
2897
2898
2899 void MacroAssembler::Lzcntl(Register dst, const Operand& src) {
2900 // TODO(intel): Add support for LZCNT (BMI1/ABM).
2901 Label not_zero_src;
2902 bsrl(dst, src);
2903 j(not_zero, &not_zero_src, Label::kNear);
2904 Set(dst, 63); // 63^31 == 32
2905 bind(&not_zero_src);
2906 xorl(dst, Immediate(31)); // for x in [0..31], 31^x == 31 - x
2907 }
2908
2909
2910 void MacroAssembler::Pushad() { 2888 void MacroAssembler::Pushad() {
2911 Push(rax); 2889 Push(rax);
2912 Push(rcx); 2890 Push(rcx);
2913 Push(rdx); 2891 Push(rdx);
2914 Push(rbx); 2892 Push(rbx);
2915 // Not pushing rsp or rbp. 2893 // Not pushing rsp or rbp.
2916 Push(rsi); 2894 Push(rsi);
2917 Push(rdi); 2895 Push(rdi);
2918 Push(r8); 2896 Push(r8);
2919 Push(r9); 2897 Push(r9);
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after
5084 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); 5062 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift));
5085 movl(rax, dividend); 5063 movl(rax, dividend);
5086 shrl(rax, Immediate(31)); 5064 shrl(rax, Immediate(31));
5087 addl(rdx, rax); 5065 addl(rdx, rax);
5088 } 5066 }
5089 5067
5090 5068
5091 } } // namespace v8::internal 5069 } } // namespace v8::internal
5092 5070
5093 #endif // V8_TARGET_ARCH_X64 5071 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698