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

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

Issue 582713002: [turbofan] IA: Float64ToUint32 supports mem operand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 } 3225 }
3226 3226
3227 CHECK_EQ(magic, m.Call()); 3227 CHECK_EQ(magic, m.Call());
3228 3228
3229 for (int i = 0; i < kNumInputs; i++) { 3229 for (int i = 0; i < kNumInputs; i++) {
3230 CHECK_EQ(result[i], 100 + i); 3230 CHECK_EQ(result[i], 100 + i);
3231 } 3231 }
3232 } 3232 }
3233 3233
3234 3234
3235 TEST(RunChangeFloat64ToUint32_spilled) {
3236 RawMachineAssemblerTester<uint32_t> m;
3237 const int kNumInputs = 32;
3238 int32_t magic = 0x786234;
3239 double input[kNumInputs];
3240 uint32_t result[kNumInputs];
3241 Node* input_node[kNumInputs];
3242
3243 for (int i = 0; i < kNumInputs; i++) {
3244 input_node[i] =
3245 m.Load(kMachFloat64, m.PointerConstant(&input), m.Int32Constant(i * 8));
3246 }
3247
3248 for (int i = 0; i < kNumInputs; i++) {
3249 m.Store(kMachUint32, m.PointerConstant(&result), m.Int32Constant(i * 4),
3250 m.ChangeFloat64ToUint32(input_node[i]));
3251 }
3252
3253 m.Return(m.Int32Constant(magic));
3254
3255 for (int i = 0; i < kNumInputs; i++) {
3256 if (i % 2) {
3257 input[i] = 100 + i + 2147483648;
3258 } else {
3259 input[i] = 100 + i;
3260 }
3261 }
3262
3263 CHECK_EQ(magic, m.Call());
3264
3265 for (int i = 0; i < kNumInputs; i++) {
3266 if (i % 2) {
3267 CHECK_EQ(result[i], 100 + i + 2147483648);
3268 } else {
3269 CHECK_EQ(result[i], 100 + i);
3270 }
3271 }
3272 }
3273
3274
3235 TEST(RunDeadChangeFloat64ToInt32) { 3275 TEST(RunDeadChangeFloat64ToInt32) {
3236 RawMachineAssemblerTester<int32_t> m; 3276 RawMachineAssemblerTester<int32_t> m;
3237 const int magic = 0x88abcda4; 3277 const int magic = 0x88abcda4;
3238 m.ChangeFloat64ToInt32(m.Float64Constant(999.78)); 3278 m.ChangeFloat64ToInt32(m.Float64Constant(999.78));
3239 m.Return(m.Int32Constant(magic)); 3279 m.Return(m.Int32Constant(magic));
3240 CHECK_EQ(magic, m.Call()); 3280 CHECK_EQ(magic, m.Call());
3241 } 3281 }
3242 3282
3243 3283
3244 TEST(RunDeadChangeInt32ToFloat64) { 3284 TEST(RunDeadChangeInt32ToFloat64) {
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 RawMachineAssemblerTester<int32_t> m; 4345 RawMachineAssemblerTester<int32_t> m;
4306 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64))); 4346 m.Return(m.TruncateFloat64ToInt32(m.LoadFromPointer(&input, kMachFloat64)));
4307 for (size_t i = 0; i < arraysize(kValues); ++i) { 4347 for (size_t i = 0; i < arraysize(kValues); ++i) {
4308 input = kValues[i].from; 4348 input = kValues[i].from;
4309 uint64_t expected = static_cast<int64_t>(kValues[i].raw); 4349 uint64_t expected = static_cast<int64_t>(kValues[i].raw);
4310 CHECK_EQ(static_cast<int>(expected), m.Call()); 4350 CHECK_EQ(static_cast<int>(expected), m.Call());
4311 } 4351 }
4312 } 4352 }
4313 4353
4314 #endif // V8_TURBOFAN_TARGET 4354 #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