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

Side by Side Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 685993003: [turbofan] Lower NumberModulus to Uint32Mod if both inputs are Unsigned32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include <limits> 5 #include <limits>
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/change-lowering.h" 8 #include "src/compiler/change-lowering.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/generic-node-inl.h" 10 #include "src/compiler/generic-node-inl.h"
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 t.simplified()->NumberSubtract()); 1003 t.simplified()->NumberSubtract());
1004 } 1004 }
1005 } 1005 }
1006 1006
1007 1007
1008 TEST(LowerNumberDivMod_to_float64) { 1008 TEST(LowerNumberDivMod_to_float64) {
1009 for (size_t i = 0; i < arraysize(test_types); i++) { 1009 for (size_t i = 0; i < arraysize(test_types); i++) {
1010 TestingGraph t(test_types[i], test_types[i]); 1010 TestingGraph t(test_types[i], test_types[i]);
1011 1011
1012 t.CheckLoweringBinop(IrOpcode::kFloat64Div, t.simplified()->NumberDivide()); 1012 t.CheckLoweringBinop(IrOpcode::kFloat64Div, t.simplified()->NumberDivide());
1013 t.CheckLoweringBinop(IrOpcode::kFloat64Mod, 1013 if (!test_types[i]->Is(Type::Unsigned32())) {
1014 t.simplified()->NumberModulus()); 1014 t.CheckLoweringBinop(IrOpcode::kFloat64Mod,
1015 t.simplified()->NumberModulus());
1016 }
1015 } 1017 }
1016 } 1018 }
1017 1019
1018 1020
1019 static void CheckChangeOf(IrOpcode::Value change, Node* of, Node* node) { 1021 static void CheckChangeOf(IrOpcode::Value change, Node* of, Node* node) {
1020 CHECK_EQ(change, node->opcode()); 1022 CHECK_EQ(change, node->opcode());
1021 CHECK_EQ(of, node->InputAt(0)); 1023 CHECK_EQ(of, node->InputAt(0));
1022 } 1024 }
1023 1025
1024 1026
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 for (size_t i = 0; i < arraysize(constants); i++) { 1931 for (size_t i = 0; i < arraysize(constants); i++) {
1930 TestingGraph t(Type::Signed32()); 1932 TestingGraph t(Type::Signed32());
1931 Node* k = t.jsgraph.Constant(constants[i]); 1933 Node* k = t.jsgraph.Constant(constants[i]);
1932 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); 1934 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k);
1933 t.Return(mod); 1935 t.Return(mod);
1934 t.Lower(); 1936 t.Lower();
1935 1937
1936 CHECK_EQ(IrOpcode::kFloat64Mod, mod->opcode()); // Pesky -0 behavior. 1938 CHECK_EQ(IrOpcode::kFloat64Mod, mod->opcode()); // Pesky -0 behavior.
1937 } 1939 }
1938 } 1940 }
1941
1942
1943 TEST(NumberModulus_Uint32) {
1944 const double kConstants[] = {2, 100, 1000, 1024, 2048};
1945 const MachineType kTypes[] = {kMachInt32, kMachUint32};
1946
1947 for (auto const type : kTypes) {
1948 for (auto const c : kConstants) {
1949 TestingGraph t(Type::Unsigned32());
1950 Node* k = t.jsgraph.Constant(c);
1951 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k);
1952 Node* use = t.Use(mod, type);
1953 t.Return(use);
1954 t.Lower();
1955
1956 CHECK_EQ(IrOpcode::kUint32Mod, use->InputAt(0)->opcode());
1957 }
1958 }
1959 }
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698