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

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

Issue 2639353002: [wasm] Fix I32ReinterpretF32 and I64ReinterpretF64 on ia32. (Closed)
Patch Set: use memcpy instead of reinterpret_cast Created 3 years, 11 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/wasm/wasm-interpreter.cc ('k') | test/cctest/wasm/test-run-wasm-64.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/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), 1041 WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))),
1042 WASM_I32V_2(107)); 1042 WASM_I32V_2(107));
1043 1043
1044 FOR_INT32_INPUTS(i) { 1044 FOR_INT32_INPUTS(i) {
1045 int32_t expected = *i; 1045 int32_t expected = *i;
1046 CHECK_EQ(107, r.Call(expected)); 1046 CHECK_EQ(107, r.Call(expected));
1047 CHECK_EQ(expected, r.module().ReadMemory(&memory[0])); 1047 CHECK_EQ(expected, r.module().ReadMemory(&memory[0]));
1048 } 1048 }
1049 } 1049 }
1050 1050
1051 WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) {
1052 WasmRunner<int32_t> r(execution_mode);
1053
1054 BUILD(r, WASM_I32_REINTERPRET_F32(
1055 WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xa0, 0x7f)));
1056
1057 // This is a signalling nan.
1058 CHECK_EQ(0x7fa00000, r.Call());
1059 }
1060
1051 WASM_EXEC_TEST_WITH_TRAP(LoadMaxUint32Offset) { 1061 WASM_EXEC_TEST_WITH_TRAP(LoadMaxUint32Offset) {
1052 WasmRunner<int32_t> r(execution_mode); 1062 WasmRunner<int32_t> r(execution_mode);
1053 r.module().AddMemoryElems<int32_t>(8); 1063 r.module().AddMemoryElems<int32_t>(8);
1054 1064
1055 BUILD(r, kExprI32Const, 0, // index 1065 BUILD(r, kExprI32Const, 0, // index
1056 static_cast<byte>(v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf( 1066 static_cast<byte>(v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(
1057 MachineType::Int32(), false)), // -- 1067 MachineType::Int32(), false)), // --
1058 0, // alignment 1068 0, // alignment
1059 U32V_5(0xffffffff)); // offset 1069 U32V_5(0xffffffff)); // offset
1060 1070
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, 2876 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
2867 WASM_ZERO); 2877 WASM_ZERO);
2868 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2878 const int32_t kMin = std::numeric_limits<int32_t>::min();
2869 CHECK_EQ(0, r.Call(133, 100)); 2879 CHECK_EQ(0, r.Call(133, 100));
2870 CHECK_EQ(0, r.Call(kMin, -1)); 2880 CHECK_EQ(0, r.Call(kMin, -1));
2871 CHECK_EQ(0, r.Call(0, 1)); 2881 CHECK_EQ(0, r.Call(0, 1));
2872 CHECK_TRAP(r.Call(100, 0)); 2882 CHECK_TRAP(r.Call(100, 0));
2873 CHECK_TRAP(r.Call(-1001, 0)); 2883 CHECK_TRAP(r.Call(-1001, 0));
2874 CHECK_TRAP(r.Call(kMin, 0)); 2884 CHECK_TRAP(r.Call(kMin, 0));
2875 } 2885 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698