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

Unified Diff: src/ia32/code-stubs-ia32.cc

Issue 10916311: Improve the assembly code for power function with integer exponential. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/code-stubs-ia32.cc
===================================================================
--- src/ia32/code-stubs-ia32.cc (revision 12493)
+++ src/ia32/code-stubs-ia32.cc (working copy)
@@ -3213,21 +3213,28 @@
__ movsd(double_scratch2, double_result); // Load double_exponent with 1.
// Get absolute value of exponent.
- Label no_neg, while_true, no_multiply;
+ Label no_neg, while_true, no_multiply, while_false;
Vyacheslav Egorov (Google) 2012/09/17 22:12:02 I have an impression that no_multiply is not used
__ test(scratch, scratch);
__ j(positive, &no_neg, Label::kNear);
__ neg(scratch);
__ bind(&no_neg);
+ __ j(zero, &while_false, Label::kNear);
+ __ shr(scratch, 1);
+ // Above condition means CF=0 && ZF =0.
+ // So the last shifted bit is 0 and the rest is not 0.
+ __ j(above, &while_true, Label::kNear);
+ __ movsd(double_result, double_scratch);
+ __ j(zero, &while_false, Label::kNear);
+
__ bind(&while_true);
__ shr(scratch, 1);
- __ j(not_carry, &no_multiply, Label::kNear);
+ __ mulsd(double_scratch, double_scratch);
+ __ j(above, &while_true, Label::kNear);
__ mulsd(double_result, double_scratch);
- __ bind(&no_multiply);
-
- __ mulsd(double_scratch, double_scratch);
__ j(not_zero, &while_true);
+ __ bind(&while_false);
// scratch has the original value of the exponent - if the exponent is
// negative, return 1/result.
__ test(exponent, exponent);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698