1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python3
"""
This python file is a tool class for SIMD and
currently only supports generating v128 const constant data.
"""
# Constant template
=
# v128 Constant template
=
"""
generation constant data, [e.g. i32, i64, f32, f64]
Params:
value: constant data, string or list,
lane_type: lane type, [i32, i64, f32, f64]
"""
return
"""
generation v128 constant data, [e.g. i8x16, i16x8, i32x4, f32x4]
Params:
value: constant data, string or list,
lane_type: lane type, [e.g. i8x16, i16x8, i32x4, f32x4]
"""
return
=
# value is a string type, generating constant data
# of value according to the number of lanes
= *
# If value is type of list, generate constant data
# according to combination of list contents and number of lanes
# If it is an empty list, generate all constant data with 0x00
return
=
# Calculate the number of times each element in value is copied
= //
# Calculate whether the data needs to be filled according to
# the number of elements in the value list and the number of lanes.
= %
=
# If the number of elements in the value list is greater than the number of lanes,
# paste data with the number of lanes from the value list.
= 1
= 0
=
# Copy data
=
# Fill in the data
# Get string
=
# Returns v128 constant text
return