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 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 { | 3122 { |
3123 WasmRunner<double> r; | 3123 WasmRunner<double> r; |
3124 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), | 3124 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), |
3125 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); | 3125 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); |
3126 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); | 3126 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
3127 } | 3127 } |
3128 } | 3128 } |
3129 | 3129 |
3130 #endif | 3130 #endif |
3131 | 3131 |
3132 #if WASM_64 | |
3133 TEST(Run_Wasm_I64SConvertF32) { | |
3134 WasmRunner<int64_t> r(MachineType::Float32()); | |
3135 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); | |
3136 | |
3137 FOR_FLOAT32_INPUTS(i) { | |
3138 if (*i < static_cast<float>(INT64_MAX) && | |
3139 *i >= static_cast<float>(INT64_MIN)) { | |
3140 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | |
3141 } else { | |
3142 CHECK_TRAP64(r.Call(*i)); | |
3143 } | |
3144 } | |
3145 } | |
3146 | |
3147 | |
3148 TEST(Run_Wasm_I64SConvertF64) { | |
3149 WasmRunner<int64_t> r(MachineType::Float64()); | |
3150 BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); | |
3151 | |
3152 FOR_FLOAT64_INPUTS(i) { | |
3153 if (*i < static_cast<double>(INT64_MAX) && | |
3154 *i >= static_cast<double>(INT64_MIN)) { | |
3155 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | |
3156 } else { | |
3157 CHECK_TRAP64(r.Call(*i)); | |
3158 } | |
3159 } | |
3160 } | |
3161 | |
3162 | |
3163 TEST(Run_Wasm_I64UConvertF32) { | |
3164 WasmRunner<uint64_t> r(MachineType::Float32()); | |
3165 BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); | |
3166 | |
3167 FOR_FLOAT32_INPUTS(i) { | |
3168 if (*i < static_cast<float>(UINT64_MAX) && *i > -1) { | |
3169 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); | |
3170 } else { | |
3171 CHECK_TRAP64(r.Call(*i)); | |
3172 } | |
3173 } | |
3174 } | |
3175 | |
3176 | |
3177 TEST(Run_Wasm_I64UConvertF64) { | |
3178 WasmRunner<uint64_t> r(MachineType::Float64()); | |
3179 BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); | |
3180 | |
3181 FOR_FLOAT64_INPUTS(i) { | |
3182 if (*i < static_cast<float>(UINT64_MAX) && *i > -1) { | |
3183 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); | |
3184 } else { | |
3185 CHECK_TRAP64(r.Call(*i)); | |
3186 } | |
3187 } | |
3188 } | |
3189 #endif | |
3190 | |
3191 | |
3192 // TODO(titzer): Fix and re-enable. | 3132 // TODO(titzer): Fix and re-enable. |
3193 #if 0 | 3133 #if 0 |
3194 TEST(Run_Wasm_I32SConvertF32) { | 3134 TEST(Run_Wasm_I32SConvertF32) { |
3195 WasmRunner<int32_t> r(MachineType::Float32()); | 3135 WasmRunner<int32_t> r(MachineType::Float32()); |
3196 BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0))); | 3136 BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0))); |
3197 | 3137 |
3198 FOR_FLOAT32_INPUTS(i) { | 3138 FOR_FLOAT32_INPUTS(i) { |
3199 if (*i < static_cast<float>(INT32_MAX) && | 3139 if (*i < static_cast<float>(INT32_MAX) && |
3200 *i >= static_cast<float>(INT32_MIN)) { | 3140 *i >= static_cast<float>(INT32_MIN)) { |
3201 CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); | 3141 CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3310 | 3250 |
3311 #if WASM_64 | 3251 #if WASM_64 |
3312 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3252 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
3313 #endif | 3253 #endif |
3314 | 3254 |
3315 | 3255 |
3316 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3256 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
3317 | 3257 |
3318 | 3258 |
3319 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3259 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |