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

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

Issue 1690343002: [wasm] Reenable tests that were disabled for no SSE 4. (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
« no previous file with comments | « no previous file | no next file » | 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/wasm/wasm-macro-gen.h" 9 #include "src/wasm/wasm-macro-gen.h"
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 FOR_INT32_INPUTS(i) { 189 FOR_INT32_INPUTS(i) {
190 FOR_INT32_INPUTS(j) { 190 FOR_INT32_INPUTS(j) {
191 int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) + 191 int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
192 static_cast<uint32_t>(*j)); 192 static_cast<uint32_t>(*j));
193 CHECK_EQ(expected, r.Call(*i, *j)); 193 CHECK_EQ(expected, r.Call(*i, *j));
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 198
199 // TODO(titzer): Fix for nosee4 and re-enable.
200 #if 0
201
202 TEST(Run_WasmFloat32Add) { 199 TEST(Run_WasmFloat32Add) {
203 WasmRunner<int32_t> r; 200 WasmRunner<int32_t> r;
204 // int(11.5f + 44.5f) 201 // int(11.5f + 44.5f)
205 BUILD(r, 202 BUILD(r,
206 WASM_I32_SCONVERT_F32(WASM_F32_ADD(WASM_F32(11.5f), WASM_F32(44.5f)))); 203 WASM_I32_SCONVERT_F32(WASM_F32_ADD(WASM_F32(11.5f), WASM_F32(44.5f))));
207 CHECK_EQ(56, r.Call()); 204 CHECK_EQ(56, r.Call());
208 } 205 }
209 206
210 207
211 TEST(Run_WasmFloat64Add) { 208 TEST(Run_WasmFloat64Add) {
212 WasmRunner<int32_t> r; 209 WasmRunner<int32_t> r;
213 // return int(13.5d + 43.5d) 210 // return int(13.5d + 43.5d)
214 BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5)))); 211 BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5))));
215 CHECK_EQ(57, r.Call()); 212 CHECK_EQ(57, r.Call());
216 } 213 }
217 214
218 #endif
219
220 215
221 void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) { 216 void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) {
222 { 217 {
223 WasmRunner<int32_t> r; 218 WasmRunner<int32_t> r;
224 // K op K 219 // K op K
225 BUILD(r, WASM_BINOP(opcode, WASM_I32(a), WASM_I32(b))); 220 BUILD(r, WASM_BINOP(opcode, WASM_I32(a), WASM_I32(b)));
226 CHECK_EQ(expected, r.Call()); 221 CHECK_EQ(expected, r.Call());
227 } 222 }
228 { 223 {
229 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); 224 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 CHECK_EQ(expected, r.Call()); 797 CHECK_EQ(expected, r.Call());
803 } 798 }
804 { 799 {
805 WasmRunner<int32_t> r(MachineType::Float64()); 800 WasmRunner<int32_t> r(MachineType::Float64());
806 // return int(op(a)) 801 // return int(op(a))
807 BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_GET_LOCAL(0)))); 802 BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_GET_LOCAL(0))));
808 CHECK_EQ(expected, r.Call(a)); 803 CHECK_EQ(expected, r.Call(a));
809 } 804 }
810 } 805 }
811 806
812
813 // TODO(titzer): Fix for nosee4 and re-enable.
814 #if 0
815
816 TEST(Run_WasmFloat32Binops) { 807 TEST(Run_WasmFloat32Binops) {
817 TestFloat32Binop(kExprF32Eq, 1, 8.125f, 8.125f); 808 TestFloat32Binop(kExprF32Eq, 1, 8.125f, 8.125f);
818 TestFloat32Binop(kExprF32Ne, 1, 8.125f, 8.127f); 809 TestFloat32Binop(kExprF32Ne, 1, 8.125f, 8.127f);
819 TestFloat32Binop(kExprF32Lt, 1, -9.5f, -9.0f); 810 TestFloat32Binop(kExprF32Lt, 1, -9.5f, -9.0f);
820 TestFloat32Binop(kExprF32Le, 1, -1111.0f, -1111.0f); 811 TestFloat32Binop(kExprF32Le, 1, -1111.0f, -1111.0f);
821 TestFloat32Binop(kExprF32Gt, 1, -9.0f, -9.5f); 812 TestFloat32Binop(kExprF32Gt, 1, -9.0f, -9.5f);
822 TestFloat32Binop(kExprF32Ge, 1, -1111.0f, -1111.0f); 813 TestFloat32Binop(kExprF32Ge, 1, -1111.0f, -1111.0f);
823 814
824 TestFloat32BinopWithConvert(kExprF32Add, 10, 3.5f, 6.5f); 815 TestFloat32BinopWithConvert(kExprF32Add, 10, 3.5f, 6.5f);
825 TestFloat32BinopWithConvert(kExprF32Sub, 2, 44.5f, 42.5f); 816 TestFloat32BinopWithConvert(kExprF32Sub, 2, 44.5f, 42.5f);
826 TestFloat32BinopWithConvert(kExprF32Mul, -66, -132.1f, 0.5f); 817 TestFloat32BinopWithConvert(kExprF32Mul, -66, -132.1f, 0.5f);
827 TestFloat32BinopWithConvert(kExprF32Div, 11, 22.1f, 2.0f); 818 TestFloat32BinopWithConvert(kExprF32Div, 11, 22.1f, 2.0f);
828 } 819 }
829 820
830
831 TEST(Run_WasmFloat32Unops) { 821 TEST(Run_WasmFloat32Unops) {
832 TestFloat32UnopWithConvert(kExprF32Abs, 8, 8.125f); 822 TestFloat32UnopWithConvert(kExprF32Abs, 8, 8.125f);
833 TestFloat32UnopWithConvert(kExprF32Abs, 9, -9.125f); 823 TestFloat32UnopWithConvert(kExprF32Abs, 9, -9.125f);
834 TestFloat32UnopWithConvert(kExprF32Neg, -213, 213.125f); 824 TestFloat32UnopWithConvert(kExprF32Neg, -213, 213.125f);
835 TestFloat32UnopWithConvert(kExprF32Sqrt, 12, 144.4f); 825 TestFloat32UnopWithConvert(kExprF32Sqrt, 12, 144.4f);
836 } 826 }
837 827
838
839 TEST(Run_WasmFloat64Binops) { 828 TEST(Run_WasmFloat64Binops) {
840 TestFloat64Binop(kExprF64Eq, 1, 16.25, 16.25); 829 TestFloat64Binop(kExprF64Eq, 1, 16.25, 16.25);
841 TestFloat64Binop(kExprF64Ne, 1, 16.25, 16.15); 830 TestFloat64Binop(kExprF64Ne, 1, 16.25, 16.15);
842 TestFloat64Binop(kExprF64Lt, 1, -32.4, 11.7); 831 TestFloat64Binop(kExprF64Lt, 1, -32.4, 11.7);
843 TestFloat64Binop(kExprF64Le, 1, -88.9, -88.9); 832 TestFloat64Binop(kExprF64Le, 1, -88.9, -88.9);
844 TestFloat64Binop(kExprF64Gt, 1, 11.7, -32.4); 833 TestFloat64Binop(kExprF64Gt, 1, 11.7, -32.4);
845 TestFloat64Binop(kExprF64Ge, 1, -88.9, -88.9); 834 TestFloat64Binop(kExprF64Ge, 1, -88.9, -88.9);
846 835
847 TestFloat64BinopWithConvert(kExprF64Add, 100, 43.5, 56.5); 836 TestFloat64BinopWithConvert(kExprF64Add, 100, 43.5, 56.5);
848 TestFloat64BinopWithConvert(kExprF64Sub, 200, 12200.1, 12000.1); 837 TestFloat64BinopWithConvert(kExprF64Sub, 200, 12200.1, 12000.1);
849 TestFloat64BinopWithConvert(kExprF64Mul, -33, 134, -0.25); 838 TestFloat64BinopWithConvert(kExprF64Mul, -33, 134, -0.25);
850 TestFloat64BinopWithConvert(kExprF64Div, -1111, -2222.3, 2); 839 TestFloat64BinopWithConvert(kExprF64Div, -1111, -2222.3, 2);
851 } 840 }
852 841
853
854 TEST(Run_WasmFloat64Unops) { 842 TEST(Run_WasmFloat64Unops) {
855 TestFloat64UnopWithConvert(kExprF64Abs, 108, 108.125); 843 TestFloat64UnopWithConvert(kExprF64Abs, 108, 108.125);
856 TestFloat64UnopWithConvert(kExprF64Abs, 209, -209.125); 844 TestFloat64UnopWithConvert(kExprF64Abs, 209, -209.125);
857 TestFloat64UnopWithConvert(kExprF64Neg, -209, 209.125); 845 TestFloat64UnopWithConvert(kExprF64Neg, -209, 209.125);
858 TestFloat64UnopWithConvert(kExprF64Sqrt, 13, 169.4); 846 TestFloat64UnopWithConvert(kExprF64Sqrt, 13, 169.4);
859 } 847 }
860 848
861 #endif
862
863
864 TEST(Run_WasmFloat32Neg) { 849 TEST(Run_WasmFloat32Neg) {
865 WasmRunner<float> r(MachineType::Float32()); 850 WasmRunner<float> r(MachineType::Float32());
866 BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0))); 851 BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
867 852
868 FOR_FLOAT32_INPUTS(i) { 853 FOR_FLOAT32_INPUTS(i) {
869 CHECK_EQ(0x80000000, 854 CHECK_EQ(0x80000000,
870 bit_cast<uint32_t>(*i) ^ bit_cast<uint32_t>(r.Call(*i))); 855 bit_cast<uint32_t>(*i) ^ bit_cast<uint32_t>(r.Call(*i)));
871 } 856 }
872 } 857 }
873 858
(...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 3408
3424 #if WASM_64 3409 #if WASM_64
3425 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } 3410 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); }
3426 #endif 3411 #endif
3427 3412
3428 3413
3429 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } 3414 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); }
3430 3415
3431 3416
3432 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } 3417 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698