Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index c4e0a9df406396918285493e150328c2ea725962..5d3d11be17d27668355507b42f4321575c9ba31a 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -1983,19 +1983,43 @@ void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
XMMRegister result = ToDoubleRegister(instr->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: { |
// Pass two doubles as arguments on the stack. |