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

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

Issue 1360133002: [test] Add FOR_INT64_INPUTS and FOR_UINT64_INPUTS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/compiler/value-helper.h » ('j') | 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 <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 5262 matching lines...) Expand 10 before | Expand all | Expand 10 after
5273 kMachInt32, function, param, param, param, param, 5273 kMachInt32, function, param, param, param, param,
5274 param, param, param, param)); 5274 param, param, param, param));
5275 FOR_INT32_INPUTS(i) { 5275 FOR_INT32_INPUTS(i) {
5276 int32_t const x = *i; 5276 int32_t const x = *i;
5277 CHECK_EQ(x * 8, m.Call(x)); 5277 CHECK_EQ(x * 8, m.Call(x));
5278 } 5278 }
5279 } 5279 }
5280 #endif // USE_SIMULATOR 5280 #endif // USE_SIMULATOR
5281 5281
5282 #if V8_TARGET_ARCH_64_BIT 5282 #if V8_TARGET_ARCH_64_BIT
5283 // TODO(titzer): run int64 tests on all platforms when supported.
5283 TEST(RunCheckedLoadInt64) { 5284 TEST(RunCheckedLoadInt64) {
5284 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL}; 5285 int64_t buffer[] = {0x66bbccddeeff0011LL, 0x1122334455667788LL};
5285 RawMachineAssemblerTester<int64_t> m(kMachInt32); 5286 RawMachineAssemblerTester<int64_t> m(kMachInt32);
5286 Node* base = m.PointerConstant(buffer); 5287 Node* base = m.PointerConstant(buffer);
5287 Node* index = m.Parameter(0); 5288 Node* index = m.Parameter(0);
5288 Node* length = m.Int32Constant(16); 5289 Node* length = m.Int32Constant(16);
5289 Node* load = 5290 Node* load =
5290 m.AddNode(m.machine()->CheckedLoad(kMachInt64), base, index, length); 5291 m.AddNode(m.machine()->CheckedLoad(kMachInt64), base, index, length);
5291 m.Return(load); 5292 m.Return(load);
5292 5293
(...skipping 25 matching lines...) Expand all
5318 CHECK_EQ(write, buffer[0]); 5319 CHECK_EQ(write, buffer[0]);
5319 CHECK_EQ(before, buffer[1]); 5320 CHECK_EQ(before, buffer[1]);
5320 5321
5321 CHECK_EQ(11, m.Call(8)); 5322 CHECK_EQ(11, m.Call(8));
5322 CHECK_EQ(write, buffer[0]); 5323 CHECK_EQ(write, buffer[0]);
5323 CHECK_EQ(write, buffer[1]); 5324 CHECK_EQ(write, buffer[1]);
5324 } 5325 }
5325 5326
5326 5327
5327 TEST(RunBitcastInt64ToFloat64) { 5328 TEST(RunBitcastInt64ToFloat64) {
5328 // TODO(titzer): run int64 tests on all platforms when supported.
5329 int64_t input = 1; 5329 int64_t input = 1;
5330 double output = 0.0; 5330 double output = 0.0;
5331 RawMachineAssemblerTester<int32_t> m; 5331 RawMachineAssemblerTester<int32_t> m;
5332 m.StoreToPointer( 5332 m.StoreToPointer(
5333 &output, kMachFloat64, 5333 &output, kMachFloat64,
5334 m.BitcastInt64ToFloat64(m.LoadFromPointer(&input, kMachInt64))); 5334 m.BitcastInt64ToFloat64(m.LoadFromPointer(&input, kMachInt64)));
5335 m.Return(m.Int32Constant(11)); 5335 m.Return(m.Int32Constant(11));
5336 FOR_INT32_INPUTS(i) { 5336 FOR_INT64_INPUTS(i) {
5337 input = static_cast<int64_t>(*i) * 14444; 5337 input = *i;
5338 CHECK_EQ(11, m.Call()); 5338 CHECK_EQ(11, m.Call());
5339 double expected = bit_cast<double>(input); 5339 double expected = bit_cast<double>(input);
5340 CHECK_EQ(bit_cast<int64_t>(expected), bit_cast<int64_t>(output)); 5340 CHECK_EQ(bit_cast<int64_t>(expected), bit_cast<int64_t>(output));
5341 } 5341 }
5342 } 5342 }
5343 5343
5344 5344
5345 TEST(RunBitcastFloat64ToInt64) { 5345 TEST(RunBitcastFloat64ToInt64) {
5346 // TODO(titzer): run int64 tests on all platforms when supported.
5347 double input = 0; 5346 double input = 0;
5348 int64_t output = 0; 5347 int64_t output = 0;
5349 RawMachineAssemblerTester<int32_t> m; 5348 RawMachineAssemblerTester<int32_t> m;
5350 m.StoreToPointer( 5349 m.StoreToPointer(
5351 &output, kMachInt64, 5350 &output, kMachInt64,
5352 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64))); 5351 m.BitcastFloat64ToInt64(m.LoadFromPointer(&input, kMachFloat64)));
5353 m.Return(m.Int32Constant(11)); 5352 m.Return(m.Int32Constant(11));
5354 FOR_FLOAT64_INPUTS(i) { 5353 FOR_FLOAT64_INPUTS(i) {
5355 input = *i; 5354 input = *i;
5356 CHECK_EQ(11, m.Call()); 5355 CHECK_EQ(11, m.Call());
(...skipping 24 matching lines...) Expand all
5381 &output, kMachFloat32, 5380 &output, kMachFloat32,
5382 m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, kMachInt32))); 5381 m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, kMachInt32)));
5383 m.Return(m.Int32Constant(11)); 5382 m.Return(m.Int32Constant(11));
5384 FOR_INT32_INPUTS(i) { 5383 FOR_INT32_INPUTS(i) {
5385 input = *i; 5384 input = *i;
5386 CHECK_EQ(11, m.Call()); 5385 CHECK_EQ(11, m.Call());
5387 float expected = bit_cast<float>(input); 5386 float expected = bit_cast<float>(input);
5388 CHECK_EQ(bit_cast<int32_t>(expected), bit_cast<int32_t>(output)); 5387 CHECK_EQ(bit_cast<int32_t>(expected), bit_cast<int32_t>(output));
5389 } 5388 }
5390 } 5389 }
OLDNEW
« no previous file with comments | « no previous file | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698