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 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 expected = *i; | 3115 expected = *i; |
3116 } else { | 3116 } else { |
3117 expected = *j; | 3117 expected = *j; |
3118 } | 3118 } |
3119 | 3119 |
3120 CheckDoubleEq(expected, r.Call(*i, *j)); | 3120 CheckDoubleEq(expected, r.Call(*i, *j)); |
3121 } | 3121 } |
3122 } | 3122 } |
3123 } | 3123 } |
3124 | 3124 |
| 3125 // TODO(ahaas): Fix on arm and reenable. |
| 3126 #if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 |
| 3127 |
| 3128 TEST(Run_Wasm_F32Min_Snan) { |
| 3129 // Test that the instruction does not return a signalling NaN. |
| 3130 { |
| 3131 WasmRunner<float> r; |
| 3132 BUILD(r, |
| 3133 WASM_F32_MIN(WASM_F32(bit_cast<float>(0xff80f1e2)), WASM_F32(57.67))); |
| 3134 CHECK_EQ(0xffc0f1e2, bit_cast<uint32_t>(r.Call())); |
| 3135 } |
| 3136 { |
| 3137 WasmRunner<float> r; |
| 3138 BUILD(r, |
| 3139 WASM_F32_MIN(WASM_F32(45.73), WASM_F32(bit_cast<float>(0x7f80f1e2)))); |
| 3140 CHECK_EQ(0x7fc0f1e2, bit_cast<uint32_t>(r.Call())); |
| 3141 } |
| 3142 } |
| 3143 |
| 3144 TEST(Run_Wasm_F32Max_Snan) { |
| 3145 // Test that the instruction does not return a signalling NaN. |
| 3146 { |
| 3147 WasmRunner<float> r; |
| 3148 BUILD(r, |
| 3149 WASM_F32_MAX(WASM_F32(bit_cast<float>(0xff80f1e2)), WASM_F32(57.67))); |
| 3150 CHECK_EQ(0xffc0f1e2, bit_cast<uint32_t>(r.Call())); |
| 3151 } |
| 3152 { |
| 3153 WasmRunner<float> r; |
| 3154 BUILD(r, |
| 3155 WASM_F32_MAX(WASM_F32(45.73), WASM_F32(bit_cast<float>(0x7f80f1e2)))); |
| 3156 CHECK_EQ(0x7fc0f1e2, bit_cast<uint32_t>(r.Call())); |
| 3157 } |
| 3158 } |
| 3159 |
| 3160 TEST(Run_Wasm_F64Min_Snan) { |
| 3161 // Test that the instruction does not return a signalling NaN. |
| 3162 { |
| 3163 WasmRunner<double> r; |
| 3164 BUILD(r, WASM_F64_MIN(WASM_F64(bit_cast<double>(0xfff000000000f1e2)), |
| 3165 WASM_F64(57.67))); |
| 3166 CHECK_EQ(0xfff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3167 } |
| 3168 { |
| 3169 WasmRunner<double> r; |
| 3170 BUILD(r, WASM_F64_MIN(WASM_F64(45.73), |
| 3171 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); |
| 3172 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3173 } |
| 3174 } |
| 3175 |
| 3176 TEST(Run_Wasm_F64Max_Snan) { |
| 3177 // Test that the instruction does not return a signalling NaN. |
| 3178 { |
| 3179 WasmRunner<double> r; |
| 3180 BUILD(r, WASM_F64_MAX(WASM_F64(bit_cast<double>(0xfff000000000f1e2)), |
| 3181 WASM_F64(57.67))); |
| 3182 CHECK_EQ(0xfff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3183 } |
| 3184 { |
| 3185 WasmRunner<double> r; |
| 3186 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), |
| 3187 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); |
| 3188 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3189 } |
| 3190 } |
| 3191 |
| 3192 #endif |
3125 | 3193 |
3126 #if WASM_64 | 3194 #if WASM_64 |
3127 TEST(Run_Wasm_F32SConvertI64) { | 3195 TEST(Run_Wasm_F32SConvertI64) { |
3128 WasmRunner<float> r(MachineType::Int64()); | 3196 WasmRunner<float> r(MachineType::Int64()); |
3129 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | 3197 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); |
3130 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | 3198 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } |
3131 } | 3199 } |
3132 | 3200 |
3133 | 3201 |
3134 #if !defined(_WIN64) | 3202 #if !defined(_WIN64) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3339 | 3407 |
3340 #if WASM_64 | 3408 #if WASM_64 |
3341 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3409 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
3342 #endif | 3410 #endif |
3343 | 3411 |
3344 | 3412 |
3345 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3413 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
3346 | 3414 |
3347 | 3415 |
3348 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3416 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |