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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 1406353003: [x64] Emit vcvttsd2si[q] when AVX is enabled. (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/assembler-x64.cc ('k') | src/x64/disasm-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Result is entirely in lower 32-bits of mantissa 193 // Result is entirely in lower 32-bits of mantissa
194 int delta = HeapNumber::kExponentBias + Double::kPhysicalSignificandSize; 194 int delta = HeapNumber::kExponentBias + Double::kPhysicalSignificandSize;
195 __ subl(rcx, Immediate(delta)); 195 __ subl(rcx, Immediate(delta));
196 __ xorl(result_reg, result_reg); 196 __ xorl(result_reg, result_reg);
197 __ cmpl(rcx, Immediate(31)); 197 __ cmpl(rcx, Immediate(31));
198 __ j(above, &done); 198 __ j(above, &done);
199 __ shll_cl(scratch1); 199 __ shll_cl(scratch1);
200 __ jmp(&check_negative); 200 __ jmp(&check_negative);
201 201
202 __ bind(&process_64_bits); 202 __ bind(&process_64_bits);
203 __ cvttsd2siq(result_reg, xmm0); 203 __ Cvttsd2siq(result_reg, xmm0);
204 __ jmp(&done, Label::kNear); 204 __ jmp(&done, Label::kNear);
205 205
206 // If the double was negative, negate the integer result. 206 // If the double was negative, negate the integer result.
207 __ bind(&check_negative); 207 __ bind(&check_negative);
208 __ movl(result_reg, scratch1); 208 __ movl(result_reg, scratch1);
209 __ negl(result_reg); 209 __ negl(result_reg);
210 if (stash_exponent_copy) { 210 if (stash_exponent_copy) {
211 __ cmpl(MemOperand(rsp, 0), Immediate(0)); 211 __ cmpl(MemOperand(rsp, 0), Immediate(0));
212 } else { 212 } else {
213 __ cmpl(exponent_operand, Immediate(0)); 213 __ cmpl(exponent_operand, Immediate(0));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 if (exponent_type() != INTEGER) { 317 if (exponent_type() != INTEGER) {
318 Label fast_power, try_arithmetic_simplification; 318 Label fast_power, try_arithmetic_simplification;
319 // Detect integer exponents stored as double. 319 // Detect integer exponents stored as double.
320 __ DoubleToI(exponent, double_exponent, double_scratch, 320 __ DoubleToI(exponent, double_exponent, double_scratch,
321 TREAT_MINUS_ZERO_AS_ZERO, &try_arithmetic_simplification, 321 TREAT_MINUS_ZERO_AS_ZERO, &try_arithmetic_simplification,
322 &try_arithmetic_simplification, 322 &try_arithmetic_simplification,
323 &try_arithmetic_simplification); 323 &try_arithmetic_simplification);
324 __ jmp(&int_exponent); 324 __ jmp(&int_exponent);
325 325
326 __ bind(&try_arithmetic_simplification); 326 __ bind(&try_arithmetic_simplification);
327 __ cvttsd2si(exponent, double_exponent); 327 __ Cvttsd2si(exponent, double_exponent);
328 // Skip to runtime if possibly NaN (indicated by the indefinite integer). 328 // Skip to runtime if possibly NaN (indicated by the indefinite integer).
329 __ cmpl(exponent, Immediate(0x1)); 329 __ cmpl(exponent, Immediate(0x1));
330 __ j(overflow, &call_runtime); 330 __ j(overflow, &call_runtime);
331 331
332 if (exponent_type() == ON_STACK) { 332 if (exponent_type() == ON_STACK) {
333 // Detect square root case. Crankshaft detects constant +/-0.5 at 333 // Detect square root case. Crankshaft detects constant +/-0.5 at
334 // compile time and uses DoMathPowHalf instead. We then skip this check 334 // compile time and uses DoMathPowHalf instead. We then skip this check
335 // for non-constant cases of +/-0.5 as these hardly occur. 335 // for non-constant cases of +/-0.5 as these hardly occur.
336 Label continue_sqrt, continue_rsqrt, not_plus_half; 336 Label continue_sqrt, continue_rsqrt, not_plus_half;
337 // Test for 0.5. 337 // Test for 0.5.
(...skipping 5238 matching lines...) Expand 10 before | Expand all | Expand 10 after
5576 kStackSpace, nullptr, return_value_operand, NULL); 5576 kStackSpace, nullptr, return_value_operand, NULL);
5577 } 5577 }
5578 5578
5579 5579
5580 #undef __ 5580 #undef __
5581 5581
5582 } // namespace internal 5582 } // namespace internal
5583 } // namespace v8 5583 } // namespace v8
5584 5584
5585 #endif // V8_TARGET_ARCH_X64 5585 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698