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

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

Issue 639283003: [turbofan] IA: TruncateFloat64ToFloat32 supports mem operand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ia32 port Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-disasm-ia32.cc » ('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 <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 "src/compiler/generic-node-inl.h" 9 #include "src/compiler/generic-node-inl.h"
10 #include "test/cctest/cctest.h" 10 #include "test/cctest/cctest.h"
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3313 for (int i = 0; i < kNumInputs; i++) { 3313 for (int i = 0; i < kNumInputs; i++) {
3314 if (i % 2) { 3314 if (i % 2) {
3315 CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i + 2147483648u)); 3315 CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i + 2147483648u));
3316 } else { 3316 } else {
3317 CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i)); 3317 CHECK_UINT32_EQ(result[i], static_cast<uint32_t>(100 + i));
3318 } 3318 }
3319 } 3319 }
3320 } 3320 }
3321 3321
3322 3322
3323 TEST(RunTruncateFloat64ToFloat32_spilled) {
3324 RawMachineAssemblerTester<uint32_t> m;
3325 const int kNumInputs = 32;
3326 int32_t magic = 0x786234;
3327 double input[kNumInputs];
3328 float result[kNumInputs];
3329 Node* input_node[kNumInputs];
3330
3331 for (int i = 0; i < kNumInputs; i++) {
3332 input_node[i] =
3333 m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(i * 8));
3334 }
3335
3336 for (int i = 0; i < kNumInputs; i++) {
3337 m.Store(kMachFloat32, m.PointerConstant(&result), m.Int32Constant(i * 4),
3338 m.TruncateFloat64ToFloat32(input_node[i]));
3339 }
3340
3341 m.Return(m.Int32Constant(magic));
3342
3343 for (int i = 0; i < kNumInputs; i++) {
3344 input[i] = 0.1 + i;
3345 }
3346
3347 CHECK_EQ(magic, m.Call());
3348
3349 for (int i = 0; i < kNumInputs; i++) {
3350 CHECK_EQ(result[i], DoubleToFloat32(input[i]));
3351 }
3352 }
3353
3354
3323 TEST(RunDeadChangeFloat64ToInt32) { 3355 TEST(RunDeadChangeFloat64ToInt32) {
3324 RawMachineAssemblerTester<int32_t> m; 3356 RawMachineAssemblerTester<int32_t> m;
3325 const int magic = 0x88abcda4; 3357 const int magic = 0x88abcda4;
3326 m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); 3358 m.ChangeFloat64ToInt32(m.Float64Constant(999.78));
3327 m.Return(m.Int32Constant(magic)); 3359 m.Return(m.Int32Constant(magic));
3328 CHECK_EQ(magic, m.Call()); 3360 CHECK_EQ(magic, m.Call());
3329 } 3361 }
3330 3362
3331 3363
3332 TEST(RunDeadChangeInt32ToFloat64) { 3364 TEST(RunDeadChangeInt32ToFloat64) {
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
4330 float actual = *i; 4362 float actual = *i;
4331 RawMachineAssemblerTester<int32_t> m; 4363 RawMachineAssemblerTester<int32_t> m;
4332 m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected)); 4364 m.StoreToPointer(&actual, kMachFloat32, m.Float32Constant(expected));
4333 m.Return(m.Int32Constant(0)); 4365 m.Return(m.Int32Constant(0));
4334 CHECK_EQ(0, m.Call()); 4366 CHECK_EQ(0, m.Call());
4335 CHECK_EQ(expected, actual); 4367 CHECK_EQ(expected, actual);
4336 } 4368 }
4337 } 4369 }
4338 4370
4339 #endif // V8_TURBOFAN_TARGET 4371 #endif // V8_TURBOFAN_TARGET
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698