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

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: Rebase 2 Created 3 years, 5 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 | « src/ia32/macro-assembler-ia32.cc ('k') | 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 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 WASM_GET_LOCAL(new_val))), 643 WASM_GET_LOCAL(new_val))),
644 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, new_val, old_val), 644 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, new_val, old_val),
645 WASM_SET_LOCAL(simd, 645 WASM_SET_LOCAL(simd,
646 WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd), 646 WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
647 WASM_GET_LOCAL(new_val))), 647 WASM_GET_LOCAL(new_val))),
648 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, new_val), WASM_ONE); 648 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, new_val), WASM_ONE);
649 649
650 CHECK_EQ(1, r.Call(1, 2)); 650 CHECK_EQ(1, r.Call(1, 2));
651 } 651 }
652 652
653 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \
654 SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
655 WASM_SIMD_TEST(I16x8Splat) { 653 WASM_SIMD_TEST(I16x8Splat) {
656 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 654 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
657 byte lane_val = 0; 655 byte lane_val = 0;
658 byte simd = r.AllocateLocal(kWasmS128); 656 byte simd = r.AllocateLocal(kWasmS128);
659 BUILD(r, 657 BUILD(r,
660 WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))), 658 WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))),
661 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE); 659 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE);
662 660
663 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 661 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
664 } 662 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 WASM_GET_LOCAL(new_val))), 702 WASM_GET_LOCAL(new_val))),
705 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val, 703 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val,
706 new_val, new_val, new_val, old_val), 704 new_val, new_val, new_val, old_val),
707 WASM_SET_LOCAL(simd, 705 WASM_SET_LOCAL(simd,
708 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd), 706 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd),
709 WASM_GET_LOCAL(new_val))), 707 WASM_GET_LOCAL(new_val))),
710 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE); 708 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE);
711 709
712 CHECK_EQ(1, r.Call(1, 2)); 710 CHECK_EQ(1, r.Call(1, 2));
713 } 711 }
714 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 ||
715 // SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
716 712
717 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || \
718 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || SIMD_LOWERING_TARGET
719 WASM_SIMD_TEST(I8x16Splat) { 713 WASM_SIMD_TEST(I8x16Splat) {
720 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 714 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
721 byte lane_val = 0; 715 byte lane_val = 0;
722 byte simd = r.AllocateLocal(kWasmS128); 716 byte simd = r.AllocateLocal(kWasmS128);
723 BUILD(r, 717 BUILD(r,
724 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))), 718 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))),
725 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE); 719 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE);
726 720
727 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 721 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
728 } 722 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, 817 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
824 new_val, new_val, new_val, new_val, new_val, new_val, 818 new_val, new_val, new_val, new_val, new_val, new_val,
825 new_val, new_val, new_val, new_val, new_val, old_val), 819 new_val, new_val, new_val, new_val, new_val, old_val),
826 WASM_SET_LOCAL(simd, 820 WASM_SET_LOCAL(simd,
827 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), 821 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd),
828 WASM_GET_LOCAL(new_val))), 822 WASM_GET_LOCAL(new_val))),
829 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); 823 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE);
830 824
831 CHECK_EQ(1, r.Call(1, 2)); 825 CHECK_EQ(1, r.Call(1, 2));
832 } 826 }
833 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 ||
834 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 || SIMD_LOWERING_TARGET
835 827
836 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || SIMD_LOWERING_TARGET || \ 828 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || SIMD_LOWERING_TARGET || \
837 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 829 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
838 // Determines if conversion from float to int will be valid. 830 // Determines if conversion from float to int will be valid.
839 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { 831 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) {
840 const double max_uint = static_cast<double>(0xffffffffu); 832 const double max_uint = static_cast<double>(0xffffffffu);
841 const double max_int = static_cast<double>(kMaxInt); 833 const double max_int = static_cast<double>(kMaxInt);
842 const double min_int = static_cast<double>(kMinInt); 834 const double min_int = static_cast<double>(kMinInt);
843 835
844 // Check for NaN. 836 // Check for NaN.
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_ZERO))); 2172 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_ZERO)));
2181 2173
2182 FOR_INT32_INPUTS(i) { 2174 FOR_INT32_INPUTS(i) {
2183 int32_t expected = *i; 2175 int32_t expected = *i;
2184 r.module().WriteMemory(&memory[0], expected); 2176 r.module().WriteMemory(&memory[0], expected);
2185 CHECK_EQ(expected, r.Call()); 2177 CHECK_EQ(expected, r.Call());
2186 } 2178 }
2187 } 2179 }
2188 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || SIMD_LOWERING_TARGET || 2180 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || SIMD_LOWERING_TARGET ||
2189 // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 2181 // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698