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

Side by Side Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 1804953002: [wasm] Int64Lowering of I64ReinterpretF64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed unused variables. Created 4 years, 9 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/compiler/wasm-compiler.cc ('k') | test/unittests/compiler/int64-lowering-unittest.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/wasm/wasm-macro-gen.h" 9 #include "src/wasm/wasm-macro-gen.h"
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 V(I64SConvertF64, false) \ 76 V(I64SConvertF64, false) \
77 V(I64UConvertF32, false) \ 77 V(I64UConvertF32, false) \
78 V(I64UConvertF64, false) \ 78 V(I64UConvertF64, false) \
79 V(I64SConvertI32, true) \ 79 V(I64SConvertI32, true) \
80 V(I64UConvertI32, true) \ 80 V(I64UConvertI32, true) \
81 V(F32SConvertI64, true) \ 81 V(F32SConvertI64, true) \
82 V(F32UConvertI64, true) \ 82 V(F32UConvertI64, true) \
83 V(F64SConvertI64, true) \ 83 V(F64SConvertI64, true) \
84 V(F64UConvertI64, true) \ 84 V(F64UConvertI64, true) \
85 V(F64ReinterpretI64, false) \ 85 V(F64ReinterpretI64, false) \
86 V(I64ReinterpretF64, false) \ 86 V(I64ReinterpretF64, true) \
87 V(I64Ror, false) \ 87 V(I64Ror, false) \
88 V(I64Rol, false) 88 V(I64Rol, false)
89 89
90 #define DECLARE_CONST(name, cond) static const bool kSupported_##name = cond; 90 #define DECLARE_CONST(name, cond) static const bool kSupported_##name = cond;
91 FOREACH_I64_OPERATOR(DECLARE_CONST) 91 FOREACH_I64_OPERATOR(DECLARE_CONST)
92 #undef DECLARE_CONST 92 #undef DECLARE_CONST
93 93
94 #define REQUIRE(name) \ 94 #define REQUIRE(name) \
95 if (!WASM_64 && !kSupported_##name) return 95 if (!WASM_64 && !kSupported_##name) return
96 96
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 1177
1178 FOR_FLOAT64_INPUTS(i) { 1178 FOR_FLOAT64_INPUTS(i) {
1179 if (*i < static_cast<float>(UINT64_MAX) && *i > -1) { 1179 if (*i < static_cast<float>(UINT64_MAX) && *i > -1) {
1180 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); 1180 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
1181 } else { 1181 } else {
1182 CHECK_TRAP64(r.Call(*i)); 1182 CHECK_TRAP64(r.Call(*i));
1183 } 1183 }
1184 } 1184 }
1185 } 1185 }
1186 1186
1187 TEST(Run_Wasm_F64ReinterpretI64) { 1187 TEST(Run_Wasm_I64ReinterpretF64) {
1188 REQUIRE(F64ReinterpretI64); 1188 REQUIRE(I64ReinterpretF64);
1189 TestingModule module; 1189 TestingModule module;
1190 int64_t* memory = module.AddMemoryElems<int64_t>(8); 1190 int64_t* memory = module.AddMemoryElems<int64_t>(8);
1191 WasmRunner<int64_t> r(&module); 1191 WasmRunner<int64_t> r(&module);
1192 1192
1193 BUILD(r, WASM_I64_REINTERPRET_F64( 1193 BUILD(r, WASM_I64_REINTERPRET_F64(
1194 WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO))); 1194 WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)));
1195 1195
1196 FOR_INT32_INPUTS(i) { 1196 FOR_INT32_INPUTS(i) {
1197 int64_t expected = static_cast<int64_t>(*i) * 0x300010001; 1197 int64_t expected = static_cast<int64_t>(*i) * 0x300010001;
1198 memory[0] = expected; 1198 memory[0] = expected;
1199 CHECK_EQ(expected, r.Call()); 1199 CHECK_EQ(expected, r.Call());
1200 } 1200 }
1201 } 1201 }
1202 1202
1203 TEST(Run_Wasm_I64ReinterpretF64) { 1203 TEST(Run_Wasm_F64ReinterpretI64) {
1204 REQUIRE(I64ReinterpretF64); 1204 REQUIRE(F64ReinterpretI64);
1205 TestingModule module; 1205 TestingModule module;
1206 int64_t* memory = module.AddMemoryElems<int64_t>(8); 1206 int64_t* memory = module.AddMemoryElems<int64_t>(8);
1207 WasmRunner<int64_t> r(&module, MachineType::Int64()); 1207 WasmRunner<int64_t> r(&module, MachineType::Int64());
1208 1208
1209 BUILD(r, WASM_BLOCK( 1209 BUILD(r, WASM_BLOCK(
1210 2, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, 1210 2, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO,
1211 WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), 1211 WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))),
1212 WASM_GET_LOCAL(0))); 1212 WASM_GET_LOCAL(0)));
1213 1213
1214 FOR_INT32_INPUTS(i) { 1214 FOR_INT32_INPUTS(i) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 REQUIRE(I64Eq); 1298 REQUIRE(I64Eq);
1299 1299
1300 WasmRunner<int32_t> r(MachineType::Int64()); 1300 WasmRunner<int32_t> r(MachineType::Int64());
1301 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); 1301 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
1302 1302
1303 FOR_INT64_INPUTS(i) { 1303 FOR_INT64_INPUTS(i) {
1304 int32_t result = *i == 0 ? 1 : 0; 1304 int32_t result = *i == 0 ? 1 : 0;
1305 CHECK_EQ(result, r.Call(*i)); 1305 CHECK_EQ(result, r.Call(*i));
1306 } 1306 }
1307 } 1307 }
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698