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

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

Issue 2937653002: [ia32][wasm] Add I8x16/I16x8 Splat/ExtractLane/ReplaceLane (Closed)
Patch Set: Created 3 years, 6 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 "src/assembler-inl.h" 5 #include "src/assembler-inl.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 #include "test/cctest/compiler/value-helper.h" 7 #include "test/cctest/compiler/value-helper.h"
8 #include "test/cctest/wasm/wasm-run-utils.h" 8 #include "test/cctest/wasm/wasm-run-utils.h"
9 #include "test/common/wasm/wasm-macro-gen.h" 9 #include "test/common/wasm/wasm-macro-gen.h"
10 10
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 WASM_GET_LOCAL(new_val))), 651 WASM_GET_LOCAL(new_val))),
652 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, new_val, old_val), 652 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, new_val, old_val),
653 WASM_SET_LOCAL(simd, 653 WASM_SET_LOCAL(simd,
654 WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd), 654 WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
655 WASM_GET_LOCAL(new_val))), 655 WASM_GET_LOCAL(new_val))),
656 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, new_val), WASM_ONE); 656 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, new_val), WASM_ONE);
657 657
658 CHECK_EQ(1, r.Call(1, 2)); 658 CHECK_EQ(1, r.Call(1, 2));
659 } 659 }
660 660
661 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \
662 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
663 WASM_SIMD_TEST(I16x8Splat) { 661 WASM_SIMD_TEST(I16x8Splat) {
664 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 662 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
665 byte lane_val = 0; 663 byte lane_val = 0;
666 byte simd = r.AllocateLocal(kWasmS128); 664 byte simd = r.AllocateLocal(kWasmS128);
667 BUILD(r, 665 BUILD(r,
668 WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))), 666 WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))),
669 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE); 667 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE);
670 668
671 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 669 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
672 } 670 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 WASM_GET_LOCAL(new_val))), 710 WASM_GET_LOCAL(new_val))),
713 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val, 711 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val,
714 new_val, new_val, new_val, old_val), 712 new_val, new_val, new_val, old_val),
715 WASM_SET_LOCAL(simd, 713 WASM_SET_LOCAL(simd,
716 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd), 714 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd),
717 WASM_GET_LOCAL(new_val))), 715 WASM_GET_LOCAL(new_val))),
718 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE); 716 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE);
719 717
720 CHECK_EQ(1, r.Call(1, 2)); 718 CHECK_EQ(1, r.Call(1, 2));
721 } 719 }
722 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET ||
723 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
724 720
725 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || \
726 V8_TARGET_ARCH_MIPS64 || SIMD_LOWERING_TARGET
727 WASM_SIMD_TEST(I8x16Splat) { 721 WASM_SIMD_TEST(I8x16Splat) {
728 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 722 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
729 byte lane_val = 0; 723 byte lane_val = 0;
730 byte simd = r.AllocateLocal(kWasmS128); 724 byte simd = r.AllocateLocal(kWasmS128);
731 BUILD(r, 725 BUILD(r,
732 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))), 726 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))),
733 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE); 727 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE);
734 728
735 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 729 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
736 } 730 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, 825 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
832 new_val, new_val, new_val, new_val, new_val, new_val, 826 new_val, new_val, new_val, new_val, new_val, new_val,
833 new_val, new_val, new_val, new_val, new_val, old_val), 827 new_val, new_val, new_val, new_val, new_val, old_val),
834 WASM_SET_LOCAL(simd, 828 WASM_SET_LOCAL(simd,
835 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), 829 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd),
836 WASM_GET_LOCAL(new_val))), 830 WASM_GET_LOCAL(new_val))),
837 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); 831 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE);
838 832
839 CHECK_EQ(1, r.Call(1, 2)); 833 CHECK_EQ(1, r.Call(1, 2));
840 } 834 }
841 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS ||
842 // V8_TARGET_ARCH_MIPS64 || SIMD_LOWERING_TARGET
843 835
844 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ 836 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \
845 V8_TARGET_ARCH_MIPS64 837 V8_TARGET_ARCH_MIPS64
846 // Determines if conversion from float to int will be valid. 838 // Determines if conversion from float to int will be valid.
847 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { 839 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) {
848 const double max_uint = static_cast<double>(0xffffffffu); 840 const double max_uint = static_cast<double>(0xffffffffu);
849 const double max_int = static_cast<double>(kMaxInt); 841 const double max_int = static_cast<double>(kMaxInt);
850 const double min_int = static_cast<double>(kMinInt); 842 const double min_int = static_cast<double>(kMinInt);
851 843
852 // Check for NaN. 844 // Check for NaN.
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); 2177 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)));
2186 2178
2187 FOR_INT32_INPUTS(i) { 2179 FOR_INT32_INPUTS(i) {
2188 int32_t expected = *i; 2180 int32_t expected = *i;
2189 r.module().WriteMemory(&memory[0], expected); 2181 r.module().WriteMemory(&memory[0], expected);
2190 CHECK_EQ(expected, r.Call()); 2182 CHECK_EQ(expected, r.Call());
2191 } 2183 }
2192 } 2184 }
2193 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 || 2185 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 ||
2194 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 2186 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
OLDNEW
« src/compiler/ia32/instruction-scheduler-ia32.cc ('K') | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698