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

Unified Diff: src/x64/lithium-codegen-x64.cc

Issue 860003002: [x86] Use AVX in Crankshaft when available. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index 8e1f65c771800d5e501d0e8989dc9af8b9741ca2..ffe1a5291000382daced4ccefc326de2dbe9a8a8 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -2015,23 +2015,45 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
XMMRegister left = ToDoubleRegister(instr->left());
XMMRegister right = ToDoubleRegister(instr->right());
XMMRegister result = ToDoubleRegister(instr->result());
- // All operations except MOD are computed in-place.
- DCHECK(instr->op() == Token::MOD || left.is(result));
switch (instr->op()) {
case Token::ADD:
- __ addsd(left, right);
+ if (CpuFeatures::IsSupported(AVX)) {
+ CpuFeatureScope scope(masm(), AVX);
+ __ vaddsd(result, left, right);
+ } else {
+ DCHECK(result.is(left));
+ __ addsd(left, right);
+ }
break;
case Token::SUB:
- __ subsd(left, right);
+ if (CpuFeatures::IsSupported(AVX)) {
+ CpuFeatureScope scope(masm(), AVX);
+ __ vsubsd(result, left, right);
+ } else {
+ DCHECK(result.is(left));
+ __ subsd(left, right);
+ }
break;
case Token::MUL:
- __ mulsd(left, right);
+ if (CpuFeatures::IsSupported(AVX)) {
+ CpuFeatureScope scope(masm(), AVX);
+ __ vmulsd(result, left, right);
+ } else {
+ DCHECK(result.is(left));
+ __ mulsd(left, right);
+ }
break;
case Token::DIV:
- __ divsd(left, right);
- // Don't delete this mov. It may improve performance on some CPUs,
- // when there is a mulsd depending on the result
- __ movaps(left, left);
+ if (CpuFeatures::IsSupported(AVX)) {
+ CpuFeatureScope scope(masm(), AVX);
+ __ vdivsd(result, left, right);
+ } else {
+ DCHECK(result.is(left));
+ __ divsd(left, right);
+ // Don't delete this mov. It may improve performance on some CPUs,
+ // when there is a mulsd depending on the result
+ __ movaps(left, left);
+ }
break;
case Token::MOD: {
XMMRegister xmm_scratch = double_scratch0();
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698