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

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

Issue 1413903003: [x64] Implement vcvtsd2si AVX instruction. (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/x64/macro-assembler-x64.h ('k') | test/cctest/test-assembler-x64.cc » ('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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 CpuFeatureScope scope(this, AVX); 856 CpuFeatureScope scope(this, AVX);
857 vxorpd(dst, dst, dst); 857 vxorpd(dst, dst, dst);
858 vcvtqsi2sd(dst, dst, src); 858 vcvtqsi2sd(dst, dst, src);
859 } else { 859 } else {
860 xorpd(dst, dst); 860 xorpd(dst, dst);
861 cvtqsi2sd(dst, src); 861 cvtqsi2sd(dst, src);
862 } 862 }
863 } 863 }
864 864
865 865
866 void MacroAssembler::Cvtsd2si(Register dst, XMMRegister src) {
867 if (CpuFeatures::IsSupported(AVX)) {
868 CpuFeatureScope scope(this, AVX);
869 vcvtsd2si(dst, src);
870 } else {
871 cvtsd2si(dst, src);
872 }
873 }
874
875
866 void MacroAssembler::Cvttsd2si(Register dst, XMMRegister src) { 876 void MacroAssembler::Cvttsd2si(Register dst, XMMRegister src) {
867 if (CpuFeatures::IsSupported(AVX)) { 877 if (CpuFeatures::IsSupported(AVX)) {
868 CpuFeatureScope scope(this, AVX); 878 CpuFeatureScope scope(this, AVX);
869 vcvttsd2si(dst, src); 879 vcvttsd2si(dst, src);
870 } else { 880 } else {
871 cvttsd2si(dst, src); 881 cvttsd2si(dst, src);
872 } 882 }
873 } 883 }
874 884
875 885
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
3437 bind(&done); 3447 bind(&done);
3438 } 3448 }
3439 3449
3440 3450
3441 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, 3451 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg,
3442 XMMRegister temp_xmm_reg, 3452 XMMRegister temp_xmm_reg,
3443 Register result_reg) { 3453 Register result_reg) {
3444 Label done; 3454 Label done;
3445 Label conv_failure; 3455 Label conv_failure;
3446 Xorpd(temp_xmm_reg, temp_xmm_reg); 3456 Xorpd(temp_xmm_reg, temp_xmm_reg);
3447 cvtsd2si(result_reg, input_reg); 3457 Cvtsd2si(result_reg, input_reg);
3448 testl(result_reg, Immediate(0xFFFFFF00)); 3458 testl(result_reg, Immediate(0xFFFFFF00));
3449 j(zero, &done, Label::kNear); 3459 j(zero, &done, Label::kNear);
3450 cmpl(result_reg, Immediate(1)); 3460 cmpl(result_reg, Immediate(1));
3451 j(overflow, &conv_failure, Label::kNear); 3461 j(overflow, &conv_failure, Label::kNear);
3452 movl(result_reg, Immediate(0)); 3462 movl(result_reg, Immediate(0));
3453 setcc(sign, result_reg); 3463 setcc(sign, result_reg);
3454 subl(result_reg, Immediate(1)); 3464 subl(result_reg, Immediate(1));
3455 andl(result_reg, Immediate(255)); 3465 andl(result_reg, Immediate(255));
3456 jmp(&done, Label::kNear); 3466 jmp(&done, Label::kNear);
3457 bind(&conv_failure); 3467 bind(&conv_failure);
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
5362 movl(rax, dividend); 5372 movl(rax, dividend);
5363 shrl(rax, Immediate(31)); 5373 shrl(rax, Immediate(31));
5364 addl(rdx, rax); 5374 addl(rdx, rax);
5365 } 5375 }
5366 5376
5367 5377
5368 } // namespace internal 5378 } // namespace internal
5369 } // namespace v8 5379 } // namespace v8
5370 5380
5371 #endif // V8_TARGET_ARCH_X64 5381 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/test-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698