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

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

Issue 1919513002: [turbofan] Introduce TruncateTaggedToWord32 simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this 1 // Copyright 2014 the V8 project authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 5305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 m.Return(m.TruncateInt64ToInt32( 5316 m.Return(m.TruncateInt64ToInt32(
5317 m.LoadFromPointer(&expected, MachineType::Int64()))); 5317 m.LoadFromPointer(&expected, MachineType::Int64())));
5318 FOR_UINT32_INPUTS(i) { 5318 FOR_UINT32_INPUTS(i) {
5319 FOR_UINT32_INPUTS(j) { 5319 FOR_UINT32_INPUTS(j) {
5320 expected = (static_cast<uint64_t>(*j) << 32) | *i; 5320 expected = (static_cast<uint64_t>(*j) << 32) | *i;
5321 CHECK_EQ(static_cast<int32_t>(expected), m.Call()); 5321 CHECK_EQ(static_cast<int32_t>(expected), m.Call());
5322 } 5322 }
5323 } 5323 }
5324 } 5324 }
5325 5325
5326 5326 TEST(RunTruncateFloat64ToWord32P) {
5327 TEST(RunTruncateFloat64ToInt32P) {
5328 struct { 5327 struct {
5329 double from; 5328 double from;
5330 double raw; 5329 double raw;
5331 } kValues[] = {{0, 0}, 5330 } kValues[] = {{0, 0},
5332 {0.5, 0}, 5331 {0.5, 0},
5333 {-0.5, 0}, 5332 {-0.5, 0},
5334 {1.5, 1}, 5333 {1.5, 1},
5335 {-1.5, -1}, 5334 {-1.5, -1},
5336 {5.5, 5}, 5335 {5.5, 5},
5337 {-5.0, -5}, 5336 {-5.0, -5},
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5378 {9.6714157802890681e+24, -2147483648.0}, 5377 {9.6714157802890681e+24, -2147483648.0},
5379 {-9.6714157802890681e+24, -2147483648.0}, 5378 {-9.6714157802890681e+24, -2147483648.0},
5380 {1.9342813113834065e+25, 2147483648.0}, 5379 {1.9342813113834065e+25, 2147483648.0},
5381 {-1.9342813113834065e+25, 2147483648.0}, 5380 {-1.9342813113834065e+25, 2147483648.0},
5382 {3.868562622766813e+25, 0}, 5381 {3.868562622766813e+25, 0},
5383 {-3.868562622766813e+25, 0}, 5382 {-3.868562622766813e+25, 0},
5384 {1.7976931348623157e+308, 0}, 5383 {1.7976931348623157e+308, 0},
5385 {-1.7976931348623157e+308, 0}}; 5384 {-1.7976931348623157e+308, 0}};
5386 double input = -1.0; 5385 double input = -1.0;
5387 RawMachineAssemblerTester<int32_t> m; 5386 RawMachineAssemblerTester<int32_t> m;
5388 m.Return(m.TruncateFloat64ToInt32( 5387 m.Return(m.TruncateFloat64ToWord32(
5389 TruncationMode::kJavaScript,
5390 m.LoadFromPointer(&input, MachineType::Float64()))); 5388 m.LoadFromPointer(&input, MachineType::Float64())));
5391 for (size_t i = 0; i < arraysize(kValues); ++i) { 5389 for (size_t i = 0; i < arraysize(kValues); ++i) {
5392 input = kValues[i].from; 5390 input = kValues[i].from;
5393 uint64_t expected = static_cast<int64_t>(kValues[i].raw); 5391 uint64_t expected = static_cast<int64_t>(kValues[i].raw);
5394 CHECK_EQ(static_cast<int>(expected), m.Call()); 5392 CHECK_EQ(static_cast<int>(expected), m.Call());
5395 } 5393 }
5396 } 5394 }
5397 5395
5398 5396
5399 TEST(RunChangeFloat32ToFloat64) { 5397 TEST(RunChangeFloat32ToFloat64) {
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
6242 r.Goto(&merge); 6240 r.Goto(&merge);
6243 r.Bind(&merge); 6241 r.Bind(&merge);
6244 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb); 6242 Node* phi = r.Phi(MachineRepresentation::kWord32, fa, fb);
6245 r.Return(phi); 6243 r.Return(phi);
6246 CHECK_EQ(1, r.Call(1)); 6244 CHECK_EQ(1, r.Call(1));
6247 } 6245 }
6248 6246
6249 } // namespace compiler 6247 } // namespace compiler
6250 } // namespace internal 6248 } // namespace internal
6251 } // namespace v8 6249 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698