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

Unified Diff: test/mjsunit/lea-add.js

Issue 14856015: Bias commutative single-use register inputs and support lea adds (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 7 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/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/lea-add.js
diff --git a/test/mjsunit/compiler/multiply-sub.js b/test/mjsunit/lea-add.js
similarity index 66%
copy from test/mjsunit/compiler/multiply-sub.js
copy to test/mjsunit/lea-add.js
index 4793181d47a2b4a2b2390f5049758e651ef1ec1c..28a14947067b3be683eb19d7d3a39beeda60774f 100644
--- a/test/mjsunit/compiler/multiply-sub.js
+++ b/test/mjsunit/lea-add.js
@@ -26,31 +26,59 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
-// Test expressions that can be computed with a multiply-add instruction.
-function f(a, b, c) {
- return a - b * c;
+function a() {
+ var sum = 0;
+ for (var i = 0; i < 500; ++i) {
+ sum = (i + sum) | 0;
+ }
+ return sum;
}
-function g(a, b, c) {
- return a * b - c;
+function b() {
+ var sum = 0;
+ for (var i = -500; i < 0; ++i) {
+ sum = (i + sum) | 0;
+ }
+ return sum;
}
-function h(a, b, c, d) {
- return a * b - c * d;
+function c() {
+ var sum = 0;
+ for (var i = 0; i < 500; ++i) {
+ sum += (i + -0x7fffffff) | 0;
+ }
+ return sum;
}
-assertEquals(-5.41, f(1.1, 2.1, 3.1));
-assertEquals(-5.41, f(1.1, 2.1, 3.1));
-%OptimizeFunctionOnNextCall(f);
-assertEquals(-5.41, f(1.1, 2.1, 3.1));
+function d() {
+ var sum = 0;
+ for (var i = -501; i < 0; ++i) {
+ sum += (i + 501) | 0;
+ }
+ return sum;
+}
+
+a();
+a();
+%OptimizeFunctionOnNextCall(a);
+assertEquals(124750, a());
+assertEquals(124750, a());
+
+b();
+b();
+%OptimizeFunctionOnNextCall(b);
+assertEquals(-125250, b());
+assertEquals(-125250, b());
-assertEquals(8.36, g(2.2, 3.3, -1.1));
-assertEquals(8.36, g(2.2, 3.3, -1.1));
-%OptimizeFunctionOnNextCall(g);
-assertEquals(8.36, g(2.2, 3.3, -1.1));
+c();
+c();
+%OptimizeFunctionOnNextCall(c);
+assertEquals(-1073741698750, c());
+assertEquals(-1073741698750, c());
-assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
-assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
-%OptimizeFunctionOnNextCall(h);
-assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
+d();
+d();
+%OptimizeFunctionOnNextCall(d);
+assertEquals(125250, d());
+assertEquals(125250, d());
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698