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

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

Issue 641153003: [turbofan]IA: ChangeFloat32ToFloat64 supports mem operand (Closed) Base URL: https://github.com/v8/v8.git@bleeding_edge
Patch Set: 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
« no previous file with comments | « src/ia32/assembler-ia32.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 4289 matching lines...) Expand 10 before | Expand all | Expand 10 after
4300 m.ChangeFloat32ToFloat64(m.LoadFromPointer(&expected, kMachFloat32))); 4300 m.ChangeFloat32ToFloat64(m.LoadFromPointer(&expected, kMachFloat32)));
4301 m.Return(m.Int32Constant(0)); 4301 m.Return(m.Int32Constant(0));
4302 FOR_FLOAT32_INPUTS(i) { 4302 FOR_FLOAT32_INPUTS(i) {
4303 expected = *i; 4303 expected = *i;
4304 CHECK_EQ(0, m.Call()); 4304 CHECK_EQ(0, m.Call());
4305 CHECK_EQ(expected, actual); 4305 CHECK_EQ(expected, actual);
4306 } 4306 }
4307 } 4307 }
4308 4308
4309 4309
4310 TEST(RunChangeFloat32ToFloat64_spilled) {
4311 RawMachineAssemblerTester<int32_t> m;
4312 const int kNumInputs = 32;
4313 int32_t magic = 0x786234;
4314 float input[kNumInputs];
4315 double result[kNumInputs];
4316 Node* input_node[kNumInputs];
4317
4318 for (int i = 0; i < kNumInputs; i++) {
4319 input_node[i] =
4320 m.Load(kMachFloat32, m.PointerConstant(&input), m.Int32Constant(i * 4));
4321 }
4322
4323 for (int i = 0; i < kNumInputs; i++) {
4324 m.Store(kMachFloat64, m.PointerConstant(&result), m.Int32Constant(i * 8),
4325 m.ChangeFloat32ToFloat64(input_node[i]));
4326 }
4327
4328 m.Return(m.Int32Constant(magic));
4329
4330 for (int i = 0; i < kNumInputs; i++) {
4331 input[i] = 100.9f + i;
4332 }
4333
4334 CHECK_EQ(magic, m.Call());
4335
4336 for (int i = 0; i < kNumInputs; i++) {
4337 CHECK_EQ(result[i], static_cast<double>(input[i]));
4338 }
4339 }
4340
4341
4310 TEST(RunTruncateFloat64ToFloat32) { 4342 TEST(RunTruncateFloat64ToFloat32) {
4311 float actual = 0.0f; 4343 float actual = 0.0f;
4312 double input = 0.0; 4344 double input = 0.0;
4313 RawMachineAssemblerTester<int32_t> m; 4345 RawMachineAssemblerTester<int32_t> m;
4314 m.StoreToPointer( 4346 m.StoreToPointer(
4315 &actual, kMachFloat32, 4347 &actual, kMachFloat32,
4316 m.TruncateFloat64ToFloat32(m.LoadFromPointer(&input, kMachFloat64))); 4348 m.TruncateFloat64ToFloat32(m.LoadFromPointer(&input, kMachFloat64)));
4317 m.Return(m.Int32Constant(0)); 4349 m.Return(m.Int32Constant(0));
4318 FOR_FLOAT64_INPUTS(i) { 4350 FOR_FLOAT64_INPUTS(i) {
4319 input = *i; 4351 input = *i;
(...skipping 10 matching lines...) Expand all
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/ia32/assembler-ia32.cc ('k') | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698