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

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

Issue 583963002: [turbofan] IA: Uint32ToFloat64 supports mem operand. (Closed) Base URL: https://github.com/v8/v8.git@bleeding_edge
Patch Set: Add tests 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/x64/assembler-x64.cc ('k') | test/cctest/test-disasm-x64.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 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 m.Return(m.Parameter(0)); 3095 m.Return(m.Parameter(0));
3096 3096
3097 FOR_UINT32_INPUTS(i) { 3097 FOR_UINT32_INPUTS(i) {
3098 uint32_t expect = *i; 3098 uint32_t expect = *i;
3099 CHECK_EQ(expect, m.Call(expect)); 3099 CHECK_EQ(expect, m.Call(expect));
3100 CHECK_EQ(static_cast<double>(expect), output); 3100 CHECK_EQ(static_cast<double>(expect), output);
3101 } 3101 }
3102 } 3102 }
3103 3103
3104 3104
3105 TEST(RunChangeUint32ToFloat64_spilled) {
3106 RawMachineAssemblerTester<int32_t> m;
3107 const int kNumInputs = 32;
3108 int32_t magic = 0x786234;
3109 uint32_t input[kNumInputs];
3110 double result[kNumInputs];
3111 Node* input_node[kNumInputs];
3112
3113 for (int i = 0; i < kNumInputs; i++) {
3114 input_node[i] =
3115 m.Load(kMachUint32, m.PointerConstant(&input), m.Int32Constant(i * 4));
3116 }
3117
3118 for (int i = 0; i < kNumInputs; i++) {
3119 m.Store(kMachFloat64, m.PointerConstant(&result), m.Int32Constant(i * 8),
3120 m.ChangeUint32ToFloat64(input_node[i]));
3121 }
3122
3123 m.Return(m.Int32Constant(magic));
3124
3125 for (int i = 0; i < kNumInputs; i++) {
3126 input[i] = 100 + i;
3127 }
3128
3129 CHECK_EQ(magic, m.Call());
3130
3131 for (int i = 0; i < kNumInputs; i++) {
3132 CHECK_EQ(result[i], static_cast<double>(100 + i));
3133 }
3134 }
3135
3136
3105 TEST(RunChangeFloat64ToInt32_A) { 3137 TEST(RunChangeFloat64ToInt32_A) {
3106 RawMachineAssemblerTester<int32_t> m; 3138 RawMachineAssemblerTester<int32_t> m;
3107 int32_t magic = 0x786234; 3139 int32_t magic = 0x786234;
3108 double input = 11.1; 3140 double input = 11.1;
3109 int32_t result = 0; 3141 int32_t result = 0;
3110 3142
3111 m.Store(kMachInt32, m.PointerConstant(&result), m.Int32Constant(0), 3143 m.Store(kMachInt32, m.PointerConstant(&result), m.Int32Constant(0),
3112 m.ChangeFloat64ToInt32(m.Float64Constant(input))); 3144 m.ChangeFloat64ToInt32(m.Float64Constant(input)));
3113 m.Return(m.Int32Constant(magic)); 3145 m.Return(m.Int32Constant(magic));
3114 3146
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 RawMachineAssemblerTester<int32_t> m; 4337 RawMachineAssemblerTester<int32_t> m;
4306 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); 4338 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64)));
4307 for (size_t i = 0; i < arraysize(kValues); ++i) { 4339 for (size_t i = 0; i < arraysize(kValues); ++i) {
4308 input = kValues[i].from; 4340 input = kValues[i].from;
4309 uint64_t expected = static_cast<int64_t>(kValues[i].raw); 4341 uint64_t expected = static_cast<int64_t>(kValues[i].raw);
4310 CHECK_EQ(static_cast<int>(expected), m.Call()); 4342 CHECK_EQ(static_cast<int>(expected), m.Call());
4311 } 4343 }
4312 } 4344 }
4313 4345
4314 #endif // V8_TURBOFAN_TARGET 4346 #endif // V8_TURBOFAN_TARGET
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698