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

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 1413463009: Implemented the Word64Clz TurboFan operator for x64, arm64, and mips64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a typing problem, and added mips64. Created 5 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <functional> 9 #include <functional>
10 #include <limits> 10 #include <limits>
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 TestWord32Clz(0x00000022, 26); 120 TestWord32Clz(0x00000022, 26);
121 TestWord32Clz(0x00000013, 27); 121 TestWord32Clz(0x00000013, 27);
122 TestWord32Clz(0x00000008, 28); 122 TestWord32Clz(0x00000008, 28);
123 TestWord32Clz(0x00000004, 29); 123 TestWord32Clz(0x00000004, 29);
124 TestWord32Clz(0x00000002, 30); 124 TestWord32Clz(0x00000002, 30);
125 TestWord32Clz(0x00000001, 31); 125 TestWord32Clz(0x00000001, 31);
126 TestWord32Clz(0x00000000, 32); 126 TestWord32Clz(0x00000000, 32);
127 } 127 }
128 128
129 129
130 #if V8_TARGET_ARCH_64_BIT
131 TEST(RunWord64Clz) {
132 BufferedRawMachineAssemblerTester<int32_t> m(kMachUint64);
133 m.Return(m.Word64Clz(m.Parameter(0)));
134
135 CHECK_EQ(0, m.Call(uint64_t(0x8000100000000000)));
136 CHECK_EQ(1, m.Call(uint64_t(0x4000050000000000)));
137 CHECK_EQ(2, m.Call(uint64_t(0x2000030000000000)));
138 CHECK_EQ(3, m.Call(uint64_t(0x1000000300000000)));
139 CHECK_EQ(4, m.Call(uint64_t(0x0805000000000000)));
140 CHECK_EQ(5, m.Call(uint64_t(0x0400600000000000)));
141 CHECK_EQ(6, m.Call(uint64_t(0x0200000000000000)));
142 CHECK_EQ(7, m.Call(uint64_t(0x010000a000000000)));
143 CHECK_EQ(8, m.Call(uint64_t(0x00800c0000000000)));
144 CHECK_EQ(9, m.Call(uint64_t(0x0040000000000000)));
145 CHECK_EQ(10, m.Call(uint64_t(0x0020000d00000000)));
146 CHECK_EQ(11, m.Call(uint64_t(0x00100f0000000000)));
147 CHECK_EQ(12, m.Call(uint64_t(0x0008000000000000)));
148 CHECK_EQ(13, m.Call(uint64_t(0x0004100000000000)));
149 CHECK_EQ(14, m.Call(uint64_t(0x0002002000000000)));
150 CHECK_EQ(15, m.Call(uint64_t(0x0001030000000000)));
151 CHECK_EQ(16, m.Call(uint64_t(0x0000804000000000)));
152 CHECK_EQ(17, m.Call(uint64_t(0x0000400500000000)));
153 CHECK_EQ(18, m.Call(uint64_t(0x0000205000000000)));
154 CHECK_EQ(19, m.Call(uint64_t(0x0000170000000000)));
155 CHECK_EQ(20, m.Call(uint64_t(0x0000087000000000)));
156 CHECK_EQ(21, m.Call(uint64_t(0x0000040500000000)));
157 CHECK_EQ(22, m.Call(uint64_t(0x0000020300000000)));
158 CHECK_EQ(23, m.Call(uint64_t(0x0000010100000000)));
159 CHECK_EQ(24, m.Call(uint64_t(0x0000008900000000)));
160 CHECK_EQ(25, m.Call(uint64_t(0x0000004100000000)));
161 CHECK_EQ(26, m.Call(uint64_t(0x0000002200000000)));
162 CHECK_EQ(27, m.Call(uint64_t(0x0000001300000000)));
163 CHECK_EQ(28, m.Call(uint64_t(0x0000000800000000)));
164 CHECK_EQ(29, m.Call(uint64_t(0x0000000400000000)));
165 CHECK_EQ(30, m.Call(uint64_t(0x0000000200000000)));
166 CHECK_EQ(31, m.Call(uint64_t(0x0000000100000000)));
167 CHECK_EQ(32, m.Call(uint64_t(0x0000000080001000)));
168 CHECK_EQ(33, m.Call(uint64_t(0x0000000040000500)));
169 CHECK_EQ(34, m.Call(uint64_t(0x0000000020000300)));
170 CHECK_EQ(35, m.Call(uint64_t(0x0000000010000003)));
171 CHECK_EQ(36, m.Call(uint64_t(0x0000000008050000)));
172 CHECK_EQ(37, m.Call(uint64_t(0x0000000004006000)));
173 CHECK_EQ(38, m.Call(uint64_t(0x0000000002000000)));
174 CHECK_EQ(39, m.Call(uint64_t(0x00000000010000a0)));
175 CHECK_EQ(40, m.Call(uint64_t(0x0000000000800c00)));
176 CHECK_EQ(41, m.Call(uint64_t(0x0000000000400000)));
177 CHECK_EQ(42, m.Call(uint64_t(0x000000000020000d)));
178 CHECK_EQ(43, m.Call(uint64_t(0x0000000000100f00)));
179 CHECK_EQ(44, m.Call(uint64_t(0x0000000000080000)));
180 CHECK_EQ(45, m.Call(uint64_t(0x0000000000041000)));
181 CHECK_EQ(46, m.Call(uint64_t(0x0000000000020020)));
182 CHECK_EQ(47, m.Call(uint64_t(0x0000000000010300)));
183 CHECK_EQ(48, m.Call(uint64_t(0x0000000000008040)));
184 CHECK_EQ(49, m.Call(uint64_t(0x0000000000004005)));
185 CHECK_EQ(50, m.Call(uint64_t(0x0000000000002050)));
186 CHECK_EQ(51, m.Call(uint64_t(0x0000000000001700)));
187 CHECK_EQ(52, m.Call(uint64_t(0x0000000000000870)));
188 CHECK_EQ(53, m.Call(uint64_t(0x0000000000000405)));
189 CHECK_EQ(54, m.Call(uint64_t(0x0000000000000203)));
190 CHECK_EQ(55, m.Call(uint64_t(0x0000000000000101)));
191 CHECK_EQ(56, m.Call(uint64_t(0x0000000000000089)));
192 CHECK_EQ(57, m.Call(uint64_t(0x0000000000000041)));
193 CHECK_EQ(58, m.Call(uint64_t(0x0000000000000022)));
194 CHECK_EQ(59, m.Call(uint64_t(0x0000000000000013)));
195 CHECK_EQ(60, m.Call(uint64_t(0x0000000000000008)));
196 CHECK_EQ(61, m.Call(uint64_t(0x0000000000000004)));
197 CHECK_EQ(62, m.Call(uint64_t(0x0000000000000002)));
198 CHECK_EQ(63, m.Call(uint64_t(0x0000000000000001)));
199 CHECK_EQ(64, m.Call(uint64_t(0x0000000000000000)));
200 }
201 #endif // V8_TARGET_ARCH_64_BIT
202
203
130 void TestWord32Popcnt(int32_t value, int32_t expected) { 204 void TestWord32Popcnt(int32_t value, int32_t expected) {
131 RawMachineAssemblerTester<int32_t> m; 205 RawMachineAssemblerTester<int32_t> m;
132 compiler::OptionalOperator op = m.machine()->Word32Popcnt(); 206 compiler::OptionalOperator op = m.machine()->Word32Popcnt();
133 if (op.IsSupported()) { 207 if (op.IsSupported()) {
134 Node* popcnt = m.AddNode(op.op(), m.Int32Constant(value)); 208 Node* popcnt = m.AddNode(op.op(), m.Int32Constant(value));
135 m.Return(popcnt); 209 m.Return(popcnt);
136 CHECK_EQ(expected, m.Call()); 210 CHECK_EQ(expected, m.Call());
137 } 211 }
138 } 212 }
139 213
(...skipping 5419 matching lines...) Expand 10 before | Expand all | Expand 10 after
5559 Node* call = r.AddNode(r.common()->Call(desc), phi); 5633 Node* call = r.AddNode(r.common()->Call(desc), phi);
5560 r.Return(call); 5634 r.Return(call);
5561 5635
5562 CHECK_EQ(33, r.Call(1)); 5636 CHECK_EQ(33, r.Call(1));
5563 CHECK_EQ(44, r.Call(0)); 5637 CHECK_EQ(44, r.Call(0));
5564 } 5638 }
5565 5639
5566 } // namespace compiler 5640 } // namespace compiler
5567 } // namespace internal 5641 } // namespace internal
5568 } // namespace v8 5642 } // namespace v8
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698