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

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

Issue 1421163005: Implemented the ctz Turbo Fan operator for x64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 CHECK_EQ(56, m.Call(uint64_t(0x0000000000000089))); 191 CHECK_EQ(56, m.Call(uint64_t(0x0000000000000089)));
192 CHECK_EQ(57, m.Call(uint64_t(0x0000000000000041))); 192 CHECK_EQ(57, m.Call(uint64_t(0x0000000000000041)));
193 CHECK_EQ(58, m.Call(uint64_t(0x0000000000000022))); 193 CHECK_EQ(58, m.Call(uint64_t(0x0000000000000022)));
194 CHECK_EQ(59, m.Call(uint64_t(0x0000000000000013))); 194 CHECK_EQ(59, m.Call(uint64_t(0x0000000000000013)));
195 CHECK_EQ(60, m.Call(uint64_t(0x0000000000000008))); 195 CHECK_EQ(60, m.Call(uint64_t(0x0000000000000008)));
196 CHECK_EQ(61, m.Call(uint64_t(0x0000000000000004))); 196 CHECK_EQ(61, m.Call(uint64_t(0x0000000000000004)));
197 CHECK_EQ(62, m.Call(uint64_t(0x0000000000000002))); 197 CHECK_EQ(62, m.Call(uint64_t(0x0000000000000002)));
198 CHECK_EQ(63, m.Call(uint64_t(0x0000000000000001))); 198 CHECK_EQ(63, m.Call(uint64_t(0x0000000000000001)));
199 CHECK_EQ(64, m.Call(uint64_t(0x0000000000000000))); 199 CHECK_EQ(64, m.Call(uint64_t(0x0000000000000000)));
200 } 200 }
201
202
203 TEST(RunWord64Ctz) {
204 RawMachineAssemblerTester<int32_t> m(kMachUint64);
205 if (!m.machine()->Word64Ctz().IsSupported()) {
206 return;
207 }
208
209 m.Return(m.AddNode(m.machine()->Word64Ctz().op(), m.Parameter(0)));
210
211 CHECK_EQ(64, m.Call(uint64_t(0x0000000000000000)));
212 CHECK_EQ(63, m.Call(uint64_t(0x8000000000000000)));
213 CHECK_EQ(62, m.Call(uint64_t(0x4000000000000000)));
214 CHECK_EQ(61, m.Call(uint64_t(0x2000000000000000)));
215 CHECK_EQ(60, m.Call(uint64_t(0x1000000000000000)));
216 CHECK_EQ(59, m.Call(uint64_t(0xa800000000000000)));
217 CHECK_EQ(58, m.Call(uint64_t(0xf400000000000000)));
218 CHECK_EQ(57, m.Call(uint64_t(0x6200000000000000)));
219 CHECK_EQ(56, m.Call(uint64_t(0x9100000000000000)));
220 CHECK_EQ(55, m.Call(uint64_t(0xcd80000000000000)));
221 CHECK_EQ(54, m.Call(uint64_t(0x0940000000000000)));
222 CHECK_EQ(53, m.Call(uint64_t(0xaf20000000000000)));
223 CHECK_EQ(52, m.Call(uint64_t(0xac10000000000000)));
224 CHECK_EQ(51, m.Call(uint64_t(0xe0b8000000000000)));
225 CHECK_EQ(50, m.Call(uint64_t(0x9ce4000000000000)));
226 CHECK_EQ(49, m.Call(uint64_t(0xc792000000000000)));
227 CHECK_EQ(48, m.Call(uint64_t(0xb8f1000000000000)));
228 CHECK_EQ(47, m.Call(uint64_t(0x3b9f800000000000)));
229 CHECK_EQ(46, m.Call(uint64_t(0xdb4c400000000000)));
230 CHECK_EQ(45, m.Call(uint64_t(0xe9a3200000000000)));
231 CHECK_EQ(44, m.Call(uint64_t(0xfca6100000000000)));
232 CHECK_EQ(43, m.Call(uint64_t(0x6c8a780000000000)));
233 CHECK_EQ(42, m.Call(uint64_t(0x8ce5a40000000000)));
234 CHECK_EQ(41, m.Call(uint64_t(0xcb7d020000000000)));
235 CHECK_EQ(40, m.Call(uint64_t(0xcb4dc10000000000)));
236 CHECK_EQ(39, m.Call(uint64_t(0xdfbec58000000000)));
237 CHECK_EQ(38, m.Call(uint64_t(0x27a9db4000000000)));
238 CHECK_EQ(37, m.Call(uint64_t(0xde3bcb2000000000)));
239 CHECK_EQ(36, m.Call(uint64_t(0xd7e8a61000000000)));
240 CHECK_EQ(35, m.Call(uint64_t(0x9afdbc8800000000)));
241 CHECK_EQ(34, m.Call(uint64_t(0x9afdbc8400000000)));
242 CHECK_EQ(33, m.Call(uint64_t(0x9afdbc8200000000)));
243 CHECK_EQ(32, m.Call(uint64_t(0x9afdbc8100000000)));
244 CHECK_EQ(31, m.Call(uint64_t(0x0000000080000000)));
245 CHECK_EQ(30, m.Call(uint64_t(0x0000000040000000)));
246 CHECK_EQ(29, m.Call(uint64_t(0x0000000020000000)));
247 CHECK_EQ(28, m.Call(uint64_t(0x0000000010000000)));
248 CHECK_EQ(27, m.Call(uint64_t(0x00000000a8000000)));
249 CHECK_EQ(26, m.Call(uint64_t(0x00000000f4000000)));
250 CHECK_EQ(25, m.Call(uint64_t(0x0000000062000000)));
251 CHECK_EQ(24, m.Call(uint64_t(0x0000000091000000)));
252 CHECK_EQ(23, m.Call(uint64_t(0x00000000cd800000)));
253 CHECK_EQ(22, m.Call(uint64_t(0x0000000009400000)));
254 CHECK_EQ(21, m.Call(uint64_t(0x00000000af200000)));
255 CHECK_EQ(20, m.Call(uint64_t(0x00000000ac100000)));
256 CHECK_EQ(19, m.Call(uint64_t(0x00000000e0b80000)));
257 CHECK_EQ(18, m.Call(uint64_t(0x000000009ce40000)));
258 CHECK_EQ(17, m.Call(uint64_t(0x00000000c7920000)));
259 CHECK_EQ(16, m.Call(uint64_t(0x00000000b8f10000)));
260 CHECK_EQ(15, m.Call(uint64_t(0x000000003b9f8000)));
261 CHECK_EQ(14, m.Call(uint64_t(0x00000000db4c4000)));
262 CHECK_EQ(13, m.Call(uint64_t(0x00000000e9a32000)));
263 CHECK_EQ(12, m.Call(uint64_t(0x00000000fca61000)));
264 CHECK_EQ(11, m.Call(uint64_t(0x000000006c8a7800)));
265 CHECK_EQ(10, m.Call(uint64_t(0x000000008ce5a400)));
266 CHECK_EQ(9, m.Call(uint64_t(0x00000000cb7d0200)));
267 CHECK_EQ(8, m.Call(uint64_t(0x00000000cb4dc100)));
268 CHECK_EQ(7, m.Call(uint64_t(0x00000000dfbec580)));
269 CHECK_EQ(6, m.Call(uint64_t(0x0000000027a9db40)));
270 CHECK_EQ(5, m.Call(uint64_t(0x00000000de3bcb20)));
271 CHECK_EQ(4, m.Call(uint64_t(0x00000000d7e8a610)));
272 CHECK_EQ(3, m.Call(uint64_t(0x000000009afdbc88)));
273 CHECK_EQ(2, m.Call(uint64_t(0x000000009afdbc84)));
274 CHECK_EQ(1, m.Call(uint64_t(0x000000009afdbc82)));
275 CHECK_EQ(0, m.Call(uint64_t(0x000000009afdbc81)));
276 }
201 #endif // V8_TARGET_ARCH_64_BIT 277 #endif // V8_TARGET_ARCH_64_BIT
202 278
203 279
204 void TestWord32Popcnt(int32_t value, int32_t expected) { 280 void TestWord32Popcnt(int32_t value, int32_t expected) {
205 RawMachineAssemblerTester<int32_t> m; 281 RawMachineAssemblerTester<int32_t> m;
206 compiler::OptionalOperator op = m.machine()->Word32Popcnt(); 282 compiler::OptionalOperator op = m.machine()->Word32Popcnt();
207 if (op.IsSupported()) { 283 if (op.IsSupported()) {
208 Node* popcnt = m.AddNode(op.op(), m.Int32Constant(value)); 284 Node* popcnt = m.AddNode(op.op(), m.Int32Constant(value));
209 m.Return(popcnt); 285 m.Return(popcnt);
210 CHECK_EQ(expected, m.Call()); 286 CHECK_EQ(expected, m.Call());
(...skipping 5422 matching lines...) Expand 10 before | Expand all | Expand 10 after
5633 Node* call = r.AddNode(r.common()->Call(desc), phi); 5709 Node* call = r.AddNode(r.common()->Call(desc), phi);
5634 r.Return(call); 5710 r.Return(call);
5635 5711
5636 CHECK_EQ(33, r.Call(1)); 5712 CHECK_EQ(33, r.Call(1));
5637 CHECK_EQ(44, r.Call(0)); 5713 CHECK_EQ(44, r.Call(0));
5638 } 5714 }
5639 5715
5640 } // namespace compiler 5716 } // namespace compiler
5641 } // namespace internal 5717 } // namespace internal
5642 } // namespace v8 5718 } // namespace v8
OLDNEW
« src/x64/macro-assembler-x64.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698