diff options
| author | Ajax <commial@gmail.com> | 2018-02-09 09:33:24 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-02-09 17:36:31 +0100 |
| commit | df4b2904c00bca0d15062493666ce50ff0b56632 (patch) | |
| tree | a4aeb5b8a5dff4af1548e3189d38eb442373a93c | |
| parent | 426fc42a2b991e0249e73edab304530ba96e8a79 (diff) | |
| download | miasm-df4b2904c00bca0d15062493666ce50ff0b56632.tar.gz miasm-df4b2904c00bca0d15062493666ce50ff0b56632.zip | |
Fix PMINSW semantic
Tested against QEMU
Diffstat (limited to '')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 5811502c..97373abf 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -3403,6 +3403,14 @@ def _keep_mul_high(expr, signed=False): arg2 = expr.args[1].zeroExtend(expr.size * 2) return m2_expr.ExprOp("*", arg1, arg2)[expr.size:] +def _signed_min(expr): + assert expr.is_op("min") and len(expr.args) == 2 + return m2_expr.ExprCond( + m2_expr.expr_is_signed_lower(expr.args[1], expr.args[0]), + expr.args[1], + expr.args[0], + ) + # Integer arithmetic # @@ -3441,6 +3449,13 @@ pmulhw = vec_vertical_instr('*', 16, lambda x: _keep_mul_high(x, signed=True)) pmulhd = vec_vertical_instr('*', 32, lambda x: _keep_mul_high(x, signed=True)) pmulhq = vec_vertical_instr('*', 64, lambda x: _keep_mul_high(x, signed=True)) +# Comparisons +# + +# SSE +pminsw = vec_vertical_instr('min', 16, _signed_min) + + # Floating-point arithmetic # @@ -3491,12 +3506,6 @@ def por(_, instr, dst, src): return e, [] -def pminsw(_, instr, dst, src): - e = [] - e.append(m2_expr.ExprAff(dst, m2_expr.ExprCond((dst - src).msb(), dst, src))) - return e, [] - - def cvtdq2pd(_, instr, dst, src): e = [] e.append( |