OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 // kExprI64Ne: | 64 // kExprI64Ne: |
65 TEST(Run_WasmI64Ne) { | 65 TEST(Run_WasmI64Ne) { |
66 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 66 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
67 BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 67 BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
68 FOR_INT64_INPUTS(i) { | 68 FOR_INT64_INPUTS(i) { |
69 FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); } | 69 FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); } |
70 } | 70 } |
71 } | 71 } |
72 // kExprI64LtS: | 72 // kExprI64LtS: |
73 // kExprI64LeS: | 73 TEST(Run_WasmI64LtS) { |
74 // kExprI64LtU: | 74 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
75 // kExprI64LeU: | 75 BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
76 // kExprI64GtS: | 76 FOR_INT64_INPUTS(i) { |
77 // kExprI64GeS: | 77 FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } |
78 // kExprI64GtU: | 78 } |
79 // kExprI64GeU: | 79 } |
| 80 TEST(Run_WasmI64LeS) { |
| 81 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 82 BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 83 FOR_INT64_INPUTS(i) { |
| 84 FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } |
| 85 } |
| 86 } |
| 87 TEST(Run_WasmI64LtU) { |
| 88 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 89 BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 90 FOR_UINT64_INPUTS(i) { |
| 91 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); } |
| 92 } |
| 93 } |
| 94 TEST(Run_WasmI64LeU) { |
| 95 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 96 BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 97 FOR_UINT64_INPUTS(i) { |
| 98 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); } |
| 99 } |
| 100 } |
| 101 TEST(Run_WasmI64GtS) { |
| 102 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 103 BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 104 FOR_INT64_INPUTS(i) { |
| 105 FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } |
| 106 } |
| 107 } |
| 108 TEST(Run_WasmI64GeS) { |
| 109 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 110 BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 111 FOR_INT64_INPUTS(i) { |
| 112 FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } |
| 113 } |
| 114 } |
80 | 115 |
| 116 TEST(Run_WasmI64GtU) { |
| 117 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 118 BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 119 FOR_UINT64_INPUTS(i) { |
| 120 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); } |
| 121 } |
| 122 } |
| 123 |
| 124 TEST(Run_WasmI64GeU) { |
| 125 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
| 126 BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 127 FOR_UINT64_INPUTS(i) { |
| 128 FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); } |
| 129 } |
| 130 } |
81 // kExprI32ConvertI64: | 131 // kExprI32ConvertI64: |
82 TEST(Run_WasmI32ConvertI64) { | 132 TEST(Run_WasmI32ConvertI64) { |
83 FOR_INT64_INPUTS(i) { | 133 FOR_INT64_INPUTS(i) { |
84 WasmRunner<int32_t> r; | 134 WasmRunner<int32_t> r; |
85 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64(*i))); | 135 BUILD(r, WASM_I32_CONVERT_I64(WASM_I64(*i))); |
86 CHECK_EQ(static_cast<int32_t>(*i), r.Call()); | 136 CHECK_EQ(static_cast<int32_t>(*i), r.Call()); |
87 } | 137 } |
88 } | 138 } |
89 // kExprI64SConvertI32: | 139 // kExprI64SConvertI32: |
90 // kExprI64UConvertI32: | 140 // kExprI64UConvertI32: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), | 184 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), |
135 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), | 185 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), |
136 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), | 186 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), |
137 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), | 187 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), |
138 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), | 188 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), |
139 WASM_I64(0xbcd123400000001d)))); | 189 WASM_I64(0xbcd123400000001d)))); |
140 | 190 |
141 CHECK_EQ(i + 0xb, r.Call()); | 191 CHECK_EQ(i + 0xb, r.Call()); |
142 } | 192 } |
143 } | 193 } |
OLD | NEW |