This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It multiplies respective lanes from the 2 input operands, then adds adjacent lanes. This was merged into the proposal in #127.
- Loading branch information
Showing
12 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
'simd_f64x2_rounding', | ||
'simd_f32x4_pmin_pmax', | ||
'simd_f64x2_pmin_pmax', | ||
'simd_i32x4_dot_i16x8', | ||
) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from simd_arithmetic import SimdArithmeticCase, i16 | ||
from simd_integer_op import ArithmeticOp | ||
|
||
|
||
class SimdI32x4DotI16x8TestCase(SimdArithmeticCase): | ||
LANE_TYPE = 'i32x4' | ||
UNARY_OPS = () | ||
BINARY_OPS = ('dot_i16x8_s',) | ||
|
||
@property | ||
def lane(self): | ||
return i16 | ||
|
||
def binary_op(self, x, y, lane): | ||
# For test data we always splat a single value to the | ||
# entire v128, so '* 2' will work here. | ||
return ArithmeticOp.get_valid_value(x, i16) * ArithmeticOp.get_valid_value(y, i16) * 2 | ||
|
||
@property | ||
def hex_binary_op_test_data(self): | ||
return [] | ||
|
||
@property | ||
def bin_test_data(self): | ||
return [ | ||
(self.normal_binary_op_test_data, ['i16x8', 'i16x8', 'i32x4']), | ||
(self.hex_binary_op_test_data, ['i16x8', 'i16x8', 'i32x4']) | ||
] | ||
|
||
def get_case_data(self): | ||
case_data = [] | ||
op_name = 'i32x4.dot_i16x8_s' | ||
case_data.append(['#', op_name]) | ||
for data_group, v128_forms in self.bin_test_data: | ||
for data in data_group: | ||
case_data.append([op_name, [str(data[0]), str(data[1])], | ||
str(self.binary_op(data[0], data[1], self.lane)), | ||
v128_forms]) | ||
return case_data | ||
|
||
def get_combine_cases(self): | ||
return '' | ||
|
||
def gen_test_cases(self): | ||
wast_filename = '../simd_i32x4_dot_i16x8.wast' | ||
with open(wast_filename, 'w') as fp: | ||
fp.write(self.get_all_cases()) | ||
|
||
def gen_test_cases(): | ||
simd_i16x8_arith = SimdI32x4DotI16x8TestCase() | ||
simd_i16x8_arith.gen_test_cases() | ||
|
||
if __name__ == '__main__': | ||
gen_test_cases() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
;; Tests for i32x4 arithmetic operations on major boundary values and all special values. | ||
|
||
|
||
(module | ||
(func (export "i32x4.dot_i16x8_s") (param v128 v128) (result v128) (i32x4.dot_i16x8_s (local.get 0) (local.get 1))) | ||
) | ||
|
||
|
||
;; i32x4.dot_i16x8_s | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 0 0 0 0 0 0 0 0) | ||
(v128.const i16x8 0 0 0 0 0 0 0 0)) | ||
(v128.const i32x4 0 0 0 0)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 0 0 0 0 0 0 0 0) | ||
(v128.const i16x8 1 1 1 1 1 1 1 1)) | ||
(v128.const i32x4 0 0 0 0)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 1 1 1 1 1 1 1 1) | ||
(v128.const i16x8 1 1 1 1 1 1 1 1)) | ||
(v128.const i32x4 2 2 2 2)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 0 0 0 0 0 0 0 0) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 0 0 0 0)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 1 1 1 1 1 1 1 1) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 -2 -2 -2 -2)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 2 2 2 2)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 16383 16383 16383 16383 16383 16383 16383 16383) | ||
(v128.const i16x8 16384 16384 16384 16384 16384 16384 16384 16384)) | ||
(v128.const i32x4 536838144 536838144 536838144 536838144)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 16384 16384 16384 16384 16384 16384 16384 16384) | ||
(v128.const i16x8 16384 16384 16384 16384 16384 16384 16384 16384)) | ||
(v128.const i32x4 536870912 536870912 536870912 536870912)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -16383 -16383 -16383 -16383 -16383 -16383 -16383 -16383) | ||
(v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384)) | ||
(v128.const i32x4 536838144 536838144 536838144 536838144)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384) | ||
(v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384)) | ||
(v128.const i32x4 536870912 536870912 536870912 536870912)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -16385 -16385 -16385 -16385 -16385 -16385 -16385 -16385) | ||
(v128.const i16x8 -16384 -16384 -16384 -16384 -16384 -16384 -16384 -16384)) | ||
(v128.const i32x4 536903680 536903680 536903680 536903680)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32765 32765 32765 32765 32765 32765 32765 32765) | ||
(v128.const i16x8 1 1 1 1 1 1 1 1)) | ||
(v128.const i32x4 65530 65530 65530 65530)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32766 32766 32766 32766 32766 32766 32766 32766) | ||
(v128.const i16x8 1 1 1 1 1 1 1 1)) | ||
(v128.const i32x4 65532 65532 65532 65532)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32768 32768 32768 32768 32768 32768 32768 32768) | ||
(v128.const i16x8 1 1 1 1 1 1 1 1)) | ||
(v128.const i32x4 -65536 -65536 -65536 -65536)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32766 -32766 -32766 -32766 -32766 -32766 -32766 -32766) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 65532 65532 65532 65532)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 65534 65534 65534 65534)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 65536 65536 65536 65536)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 32767 32767 32767 32767 32767 32767 32767 32767) | ||
(v128.const i16x8 32767 32767 32767 32767 32767 32767 32767 32767)) | ||
(v128.const i32x4 2147352578 2147352578 2147352578 2147352578)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768) | ||
(v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768)) | ||
(v128.const i32x4 2147483648 2147483648 2147483648 2147483648)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768) | ||
(v128.const i16x8 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767)) | ||
(v128.const i32x4 2147418112 2147418112 2147418112 2147418112)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535) | ||
(v128.const i16x8 0 0 0 0 0 0 0 0)) | ||
(v128.const i32x4 0 0 0 0)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535) | ||
(v128.const i16x8 1 1 1 1 1 1 1 1)) | ||
(v128.const i32x4 -2 -2 -2 -2)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535) | ||
(v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) | ||
(v128.const i32x4 2 2 2 2)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535) | ||
(v128.const i16x8 32767 32767 32767 32767 32767 32767 32767 32767)) | ||
(v128.const i32x4 -65534 -65534 -65534 -65534)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535) | ||
(v128.const i16x8 -32768 -32768 -32768 -32768 -32768 -32768 -32768 -32768)) | ||
(v128.const i32x4 65536 65536 65536 65536)) | ||
(assert_return (invoke "i32x4.dot_i16x8_s" (v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535) | ||
(v128.const i16x8 65535 65535 65535 65535 65535 65535 65535 65535)) | ||
(v128.const i32x4 2 2 2 2)) | ||
|
||
;; type check | ||
(assert_invalid (module (func (result v128) (i32x4.dot_i16x8_s (i32.const 0) (f32.const 0.0)))) "type mismatch") | ||
|
||
;; Test operation with empty argument | ||
|
||
(assert_invalid | ||
(module | ||
(func $i32x4.dot_i16x8_s-1st-arg-empty (result v128) | ||
(i32x4.dot_i16x8_s (v128.const i32x4 0 0 0 0)) | ||
) | ||
) | ||
"type mismatch" | ||
) | ||
(assert_invalid | ||
(module | ||
(func $i32x4.dot_i16x8_s-arg-empty (result v128) | ||
(i32x4.dot_i16x8_s) | ||
) | ||
) | ||
"type mismatch" | ||
) | ||
|