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

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

Issue 487723002: [turbofan] Add proper conversion operators for int32<->int64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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 <functional> 5 #include <functional>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 #include "test/cctest/compiler/codegen-tester.h" 10 #include "test/cctest/compiler/codegen-tester.h"
(...skipping 4184 matching lines...) Expand 10 before | Expand all | Expand 10 after
4195 bt.AddReturn(val); 4195 bt.AddReturn(val);
4196 FOR_INT32_INPUTS(i) { 4196 FOR_INT32_INPUTS(i) {
4197 FOR_INT32_INPUTS(j) { 4197 FOR_INT32_INPUTS(j) {
4198 int32_t expected; 4198 int32_t expected;
4199 if (ssub_overflow(*i, *j, &expected)) expected = constant; 4199 if (ssub_overflow(*i, *j, &expected)) expected = constant;
4200 CHECK_EQ(expected, bt.call(*i, *j)); 4200 CHECK_EQ(expected, bt.call(*i, *j));
4201 } 4201 }
4202 } 4202 }
4203 } 4203 }
4204 4204
4205
4206 TEST(RunChangeInt32ToInt64P) {
4207 if (kPointerSize < 8) return;
4208 int64_t actual = -1;
4209 RawMachineAssemblerTester<int32_t> m(kMachInt32);
4210 m.StoreToPointer(&actual, kMachInt64, m.ChangeInt32ToInt64(m.Parameter(0)));
4211 m.Return(m.Int32Constant(0));
4212 FOR_INT32_INPUTS(i) {
4213 int64_t expected = *i;
4214 CHECK_EQ(0, m.Call(*i));
4215 CHECK_EQ(expected, actual);
4216 }
4217 }
4218
4219
4220 TEST(RunChangeUint32ToUint64P) {
4221 if (kPointerSize < 8) return;
4222 int64_t actual = -1;
4223 RawMachineAssemblerTester<int32_t> m(kMachUint32);
4224 m.StoreToPointer(&actual, kMachUint64,
4225 m.ChangeUint32ToUint64(m.Parameter(0)));
4226 m.Return(m.Int32Constant(0));
4227 FOR_UINT32_INPUTS(i) {
4228 int64_t expected = static_cast<uint64_t>(*i);
4229 CHECK_EQ(0, m.Call(*i));
4230 CHECK_EQ(expected, actual);
4231 }
4232 }
4233
4234
4235 TEST(RunTruncateInt64ToInt32P) {
4236 if (kPointerSize < 8) return;
4237 int64_t expected = -1;
4238 RawMachineAssemblerTester<int32_t> m;
4239 m.Return(m.TruncateInt64ToInt32(m.LoadFromPointer(&expected, kMachInt64)));
4240 FOR_UINT32_INPUTS(i) {
4241 FOR_UINT32_INPUTS(j) {
4242 expected = (static_cast<uint64_t>(*j) << 32) | *i;
4243 CHECK_UINT32_EQ(expected, m.Call());
4244 }
4245 }
4246 }
4247
4205 #endif // V8_TURBOFAN_TARGET 4248 #endif // V8_TURBOFAN_TARGET
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698