@@ -12,8 +12,8 @@ class ArithmeticOp:
12
12
may be required for the operations.
13
13
The following operators are covered:
14
14
add, sub, mul, neg,
15
- add_saturate_s, add_saturate_u ,
16
- sub_saturate_s, sub_saturate_u ,
15
+ add_sat_s, add_sat_u ,
16
+ sub_sat_s, sub_sat_u ,
17
17
min_s, min_u, max_s, max_u, avgr_u, abs
18
18
"""
19
19
def __init__ (self , op : str ):
@@ -45,7 +45,7 @@ def _saturate(self, operand1: int, operand2: int, lane: LaneValue) -> int:
45
45
"""Get the result of saturating arithmetic operation on 2 operands.
46
46
The operands can be both signed or unsigned. The following ops
47
47
are covered:
48
- add_saturate_s, sub_saturate_s, add_saturate_u, sub_saturate_u ,
48
+ add_sat_s, sub_sat_s, add_sat_u, sub_sat_u ,
49
49
50
50
Saturating arithmetic can make sure:
51
51
When the operation result is less than the minimum, return the minimum.
@@ -56,7 +56,7 @@ def _saturate(self, operand1: int, operand2: int, lane: LaneValue) -> int:
56
56
:param lane: the LaneValue instance of a lane in v128
57
57
:return: the result of the saturating arithmetic operation
58
58
"""
59
- if self .op .endswith ('saturate_s ' ):
59
+ if self .op .endswith ('sat_s ' ):
60
60
if operand1 > lane .max :
61
61
operand1 -= lane .mod
62
62
if operand2 > lane .max :
@@ -72,7 +72,7 @@ def _saturate(self, operand1: int, operand2: int, lane: LaneValue) -> int:
72
72
if value < lane .min :
73
73
return lane .min
74
74
75
- if self .op .endswith ('saturate_u ' ):
75
+ if self .op .endswith ('sat_u ' ):
76
76
if operand1 < 0 :
77
77
operand1 += lane .mod
78
78
if operand2 < 0 :
@@ -127,8 +127,8 @@ def binary_op(self, operand1, operand2, lane):
127
127
128
128
Supported ops:
129
129
add, sub, mul,
130
- add_saturate_s, add_saturate_u ,
131
- sub_saturate_s, sub_saturate_u ,
130
+ add_sat_s, add_sat_u ,
131
+ sub_sat_s, sub_sat_u ,
132
132
min_s, min_u, max_s, max_u, avgr_u
133
133
134
134
:param operand1: the operand 1, integer or literal string in hex or decimal format
@@ -155,7 +155,7 @@ def binary_op(self, operand1, operand2, lane):
155
155
value = v1 - v2
156
156
elif self .op == 'mul' :
157
157
value = v1 * v2
158
- elif 'saturate ' in self .op :
158
+ elif 'sat ' in self .op :
159
159
value = self ._saturate (v1 , v2 , lane )
160
160
if self .op .endswith ('_u' ):
161
161
result_signed = False
0 commit comments