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

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

Issue 1729263002: [wasm] I added comparison operators to the Int64Lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 unified diff | Download patch
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 FOR_INT64_INPUTS(i) { 49 FOR_INT64_INPUTS(i) {
50 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); } 50 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); }
51 } 51 }
52 } 52 }
53 // kExprI64Shl: 53 // kExprI64Shl:
54 // kExprI64ShrU: 54 // kExprI64ShrU:
55 // kExprI64ShrS: 55 // kExprI64ShrS:
56 // kExprI64Eq: 56 // kExprI64Eq:
57 // kExprI64Ne: 57 // kExprI64Ne:
58 // kExprI64LtS: 58 // kExprI64LtS:
59 TEST(Run_WasmI64LtS) {
60 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
61 BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
62 FOR_INT64_INPUTS(i) {
63 FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
64 }
65 }
59 // kExprI64LeS: 66 // kExprI64LeS:
67 TEST(Run_WasmI64LeS) {
68 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
69 BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
70 FOR_INT64_INPUTS(i) {
71 FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
72 }
73 }
60 // kExprI64LtU: 74 // kExprI64LtU:
75 TEST(Run_WasmI64LtU) {
76 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
77 BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
78 FOR_UINT64_INPUTS(i) {
79 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
80 }
81 }
61 // kExprI64LeU: 82 // kExprI64LeU:
83 TEST(Run_WasmI64LeU) {
84 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
85 BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
86 FOR_UINT64_INPUTS(i) {
87 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
88 }
89 }
62 // kExprI64GtS: 90 // kExprI64GtS:
91 TEST(Run_WasmI64GtS) {
92 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
93 BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
94 FOR_INT64_INPUTS(i) {
95 FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
96 }
97 }
63 // kExprI64GeS: 98 // kExprI64GeS:
99 TEST(Run_WasmI64GeS) {
100 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
101 BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
102 FOR_INT64_INPUTS(i) {
103 FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
104 }
105 }
106
64 // kExprI64GtU: 107 // kExprI64GtU:
108 TEST(Run_WasmI64GtU) {
109 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
110 BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
111 FOR_UINT64_INPUTS(i) {
112 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
113 }
114 }
115
65 // kExprI64GeU: 116 // kExprI64GeU:
66 117 TEST(Run_WasmI64GeU) {
118 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
119 BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
120 FOR_UINT64_INPUTS(i) {
121 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
122 }
123 }
67 // kExprI32ConvertI64: 124 // kExprI32ConvertI64:
68 TEST(Run_WasmI32ConvertI64) { 125 TEST(Run_WasmI32ConvertI64) {
69 FOR_INT64_INPUTS(i) { 126 FOR_INT64_INPUTS(i) {
70 WasmRunner<int32_t> r; 127 WasmRunner<int32_t> r;
71 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64(*i))); 128 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64(*i)));
72 CHECK_EQ(static_cast<int32_t>(*i), r.Call()); 129 CHECK_EQ(static_cast<int32_t>(*i), r.Call());
73 } 130 }
74 } 131 }
75 // kExprI64SConvertI32: 132 // kExprI64SConvertI32:
76 // kExprI64UConvertI32: 133 // kExprI64UConvertI32:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), 177 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014),
121 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), 178 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016),
122 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), 179 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018),
123 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), 180 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a),
124 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), 181 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c),
125 WASM_I64(0xbcd123400000001d)))); 182 WASM_I64(0xbcd123400000001d))));
126 183
127 CHECK_EQ(i + 0xb, r.Call()); 184 CHECK_EQ(i + 0xb, r.Call());
128 } 185 }
129 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698