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

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

Issue 1420543003: [x64] Implement vsqrtsd 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/assembler-x64.cc ('k') | src/x64/codegen-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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 // Set result to Infinity in the special case. 357 // Set result to Infinity in the special case.
358 __ Xorpd(double_result, double_result); 358 __ Xorpd(double_result, double_result);
359 __ subsd(double_result, double_scratch); 359 __ subsd(double_result, double_scratch);
360 __ jmp(&done); 360 __ jmp(&done);
361 361
362 __ bind(&continue_sqrt); 362 __ bind(&continue_sqrt);
363 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. 363 // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
364 __ Xorpd(double_scratch, double_scratch); 364 __ Xorpd(double_scratch, double_scratch);
365 __ addsd(double_scratch, double_base); // Convert -0 to 0. 365 __ addsd(double_scratch, double_base); // Convert -0 to 0.
366 __ sqrtsd(double_result, double_scratch); 366 __ Sqrtsd(double_result, double_scratch);
367 __ jmp(&done); 367 __ jmp(&done);
368 368
369 // Test for -0.5. 369 // Test for -0.5.
370 __ bind(&not_plus_half); 370 __ bind(&not_plus_half);
371 // Load double_scratch with -0.5 by substracting 1. 371 // Load double_scratch with -0.5 by substracting 1.
372 __ subsd(double_scratch, double_result); 372 __ subsd(double_scratch, double_result);
373 // Already ruled out NaNs for exponent. 373 // Already ruled out NaNs for exponent.
374 __ Ucomisd(double_scratch, double_exponent); 374 __ Ucomisd(double_scratch, double_exponent);
375 __ j(not_equal, &fast_power, Label::kNear); 375 __ j(not_equal, &fast_power, Label::kNear);
376 376
(...skipping 10 matching lines...) Expand all
387 __ j(carry, &continue_rsqrt, Label::kNear); 387 __ j(carry, &continue_rsqrt, Label::kNear);
388 388
389 // Set result to 0 in the special case. 389 // Set result to 0 in the special case.
390 __ Xorpd(double_result, double_result); 390 __ Xorpd(double_result, double_result);
391 __ jmp(&done); 391 __ jmp(&done);
392 392
393 __ bind(&continue_rsqrt); 393 __ bind(&continue_rsqrt);
394 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. 394 // sqrtsd returns -0 when input is -0. ECMA spec requires +0.
395 __ Xorpd(double_exponent, double_exponent); 395 __ Xorpd(double_exponent, double_exponent);
396 __ addsd(double_exponent, double_base); // Convert -0 to +0. 396 __ addsd(double_exponent, double_base); // Convert -0 to +0.
397 __ sqrtsd(double_exponent, double_exponent); 397 __ Sqrtsd(double_exponent, double_exponent);
398 __ divsd(double_result, double_exponent); 398 __ divsd(double_result, double_exponent);
399 __ jmp(&done); 399 __ jmp(&done);
400 } 400 }
401 401
402 // Using FPU instructions to calculate power. 402 // Using FPU instructions to calculate power.
403 Label fast_power_failed; 403 Label fast_power_failed;
404 __ bind(&fast_power); 404 __ bind(&fast_power);
405 __ fnclex(); // Clear flags to catch exceptions later. 405 __ fnclex(); // Clear flags to catch exceptions later.
406 // Transfer (B)ase and (E)xponent onto the FPU register stack. 406 // Transfer (B)ase and (E)xponent onto the FPU register stack.
407 __ subp(rsp, Immediate(kDoubleSize)); 407 __ subp(rsp, Immediate(kDoubleSize));
(...skipping 5187 matching lines...) Expand 10 before | Expand all | Expand 10 after
5595 kStackSpace, nullptr, return_value_operand, NULL); 5595 kStackSpace, nullptr, return_value_operand, NULL);
5596 } 5596 }
5597 5597
5598 5598
5599 #undef __ 5599 #undef __
5600 5600
5601 } // namespace internal 5601 } // namespace internal
5602 } // namespace v8 5602 } // namespace v8
5603 5603
5604 #endif // V8_TARGET_ARCH_X64 5604 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698