Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 0c121a9

Browse files
authored
Merge pull request #120 from Honry/sync-spec-tests
Integrate latest spec tests from WAVM
2 parents 0ff5c93 + e99a850 commit 0c121a9

29 files changed

+24519
-64
lines changed

test/core/simd/meta/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ Currently it only support following simd test files generation.
77
- 'simd_i16x8_cmp.wast'
88
- 'simd_i32x4_cmp.wast'
99
- 'simd_f32x4_cmp.wast'
10+
- 'simd_f64x2_cmp.wast'
11+
- 'simd_i8x16_arith.wast'
12+
- 'simd_i16x8_arith.wast'
13+
- 'simd_i32x4_arith.wast'
14+
- 'simd_f32x4_arith.wast'
15+
- 'simd_bitwise.wast'
16+
- 'simd_i8x16_sat_arith.wast'
17+
- 'simd_i16x8_sat_arith.wast'
18+
- 'simd_f32x4.wast'
1019

1120

1221
Usage:

test/core/simd/meta/gen_tests.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
'simd_i16x8_cmp',
1414
'simd_i32x4_cmp',
1515
'simd_f32x4_cmp',
16+
'simd_f64x2_cmp',
17+
'simd_i8x16_arith',
18+
'simd_i16x8_arith',
19+
'simd_i32x4_arith',
20+
'simd_f32x4_arith',
21+
'simd_sat_arith',
22+
'simd_bitwise',
23+
'simd_f32x4',
1624
)
1725

1826

@@ -24,6 +32,10 @@ def gen_group_tests(mod_name):
2432

2533

2634
def main():
35+
"""
36+
Default program entry
37+
"""
38+
2739
parser = argparse.ArgumentParser(
2840
description='Front-end script to call other modules to generate SIMD tests')
2941
parser.add_argument('-a', '--all', dest='gen_all', action='store_true',
@@ -44,4 +56,4 @@ def main():
4456

4557
if __name__ == '__main__':
4658
main()
47-
print('Done.')
59+
print('Done.')

test/core/simd/meta/simd.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32

43
"""
54
This python file is a tool class for SIMD and
@@ -9,13 +8,31 @@
98

109
class SIMD(object):
1110

11+
# Constant template
12+
CONST = '({}.const {})'
13+
1214
# v128 Constant template
1315
V128_CONST = '(v128.const {} {})'
1416

15-
# Params:
16-
# val: constant data, string or list,
17-
# lane_type: lane type, [i8x16, i16x8, i32x4, f32x4]
17+
def const(self, val, lane_type):
18+
"""
19+
generation constant data, [e.g. i32, i64, f32, f64]
20+
Params:
21+
val: constant data, string or list,
22+
lane_type: lane type, [i32, i64, f32, f64]
23+
"""
24+
return self.CONST.format(lane_type, ''.join(val))
25+
1826
def v128_const(self, val, lane_type):
27+
"""
28+
generation v128 constant data, [e.g. i8x16, i16x8, i32x4, f32x4]
29+
Params:
30+
val: constant data, string or list,
31+
lane_type: lane type, [e.g. i8x16, i16x8, i32x4, f32x4]
32+
"""
33+
34+
if lane_type.lower().find('x') == -1:
35+
return self.const(val, lane_type)
1936

2037
lane_cnt = int(lane_type[1:].split('x')[1])
2138

@@ -63,4 +80,4 @@ def v128_const(self, val, lane_type):
6380
data_elem = ' '.join(data_elem)
6481

6582
# Returns v128 constant text
66-
return self.V128_CONST.format(lane_type, data_elem)
83+
return self.V128_CONST.format(lane_type, data_elem)

0 commit comments

Comments
 (0)