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

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 974313002: [turbofan] Support for %_DoubleHi, %_DoubleLo and %_ConstructDouble. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed Svens comment. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc
index a7b1768d2a541ceac63234314dfee5b087cee5f6..4e30bec9c3c31b081947d199d51ca08ae0f03e0c 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -4647,6 +4647,72 @@ TEST(RunFloat32Constant) {
}
+TEST(RunFloat64ExtractLowWord32) {
+ uint64_t input = 0;
+ RawMachineAssemblerTester<int32_t> m;
+ m.Return(m.Float64ExtractLowWord32(m.LoadFromPointer(&input, kMachFloat64)));
+ FOR_FLOAT64_INPUTS(i) {
+ input = bit_cast<uint64_t>(*i);
+ int32_t expected = bit_cast<int32_t>(static_cast<uint32_t>(input));
+ CHECK_EQ(expected, m.Call());
+ }
+}
+
+
+TEST(RunFloat64ExtractHighWord32) {
+ uint64_t input = 0;
+ RawMachineAssemblerTester<int32_t> m;
+ m.Return(m.Float64ExtractHighWord32(m.LoadFromPointer(&input, kMachFloat64)));
+ FOR_FLOAT64_INPUTS(i) {
+ input = bit_cast<uint64_t>(*i);
+ int32_t expected = bit_cast<int32_t>(static_cast<uint32_t>(input >> 32));
+ CHECK_EQ(expected, m.Call());
+ }
+}
+
+
+TEST(RunFloat64InsertLowWord32) {
+ uint64_t input = 0;
+ uint64_t result = 0;
+ RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ m.StoreToPointer(
+ &result, kMachFloat64,
+ m.Float64InsertLowWord32(m.LoadFromPointer(&input, kMachFloat64),
+ m.Parameter(0)));
+ m.Return(m.Int32Constant(0));
+ FOR_FLOAT64_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
+ input = bit_cast<uint64_t>(*i);
+ uint64_t expected = (input & ~(V8_UINT64_C(0xFFFFFFFF))) |
+ (static_cast<uint64_t>(bit_cast<uint32_t>(*j)));
+ CHECK_EQ(0, m.Call(*j));
+ CHECK_EQ(expected, result);
+ }
+ }
+}
+
+
+TEST(RunFloat64InsertHighWord32) {
+ uint64_t input = 0;
+ uint64_t result = 0;
+ RawMachineAssemblerTester<int32_t> m(kMachInt32);
+ m.StoreToPointer(
+ &result, kMachFloat64,
+ m.Float64InsertHighWord32(m.LoadFromPointer(&input, kMachFloat64),
+ m.Parameter(0)));
+ m.Return(m.Int32Constant(0));
+ FOR_FLOAT64_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
+ input = bit_cast<uint64_t>(*i);
+ uint64_t expected = (input & ~(V8_UINT64_C(0xFFFFFFFF) << 32)) |
+ (static_cast<uint64_t>(bit_cast<uint32_t>(*j)) << 32);
+ CHECK_EQ(0, m.Call(*j));
+ CHECK_EQ(expected, result);
+ }
+ }
+}
+
+
static double two_30 = 1 << 30; // 2^30 is a smi boundary.
static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary.
static double kValues[] = {0.1,
« no previous file with comments | « src/x64/macro-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