diff options
| -rw-r--r-- | miasm2/arch/x86/arch.py | 4 | ||||
| -rw-r--r-- | miasm2/arch/x86/sem.py | 23 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 5 |
3 files changed, 32 insertions, 0 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index aaf877fe..839487e8 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -4488,6 +4488,10 @@ addop("pmulhw", [bs8(0x0f), bs8(0xe5), no_xmm_pref] + rmmod(mm_reg, rm_arg_mm_m64)) addop("pmulhw", [bs8(0x0f), bs8(0xe5), pref_66] + rmmod(xmm_reg, rm_arg_xmm_m128)) +addop("pmuludq", [bs8(0x0f), bs8(0xf4), no_xmm_pref] + + rmmod(mm_reg, rm_arg_mm_m64)) +addop("pmuludq", [bs8(0x0f), bs8(0xf4), pref_66] + + rmmod(xmm_reg, rm_arg_xmm_m128)) addop("psubusb", [bs8(0x0f), bs8(0xd8), no_xmm_pref] + diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 5beedede..d73eac96 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -3418,6 +3418,7 @@ def _min_max(expr, signed): expr.args[0], ) + # Integer arithmetic # @@ -3456,6 +3457,27 @@ 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)) +def pmuludq(ir, instr, dst, src): + e = [] + if dst.size == 64: + e.append(m2_expr.ExprAff( + dst, + src[:32].zeroExtend(64) * dst[:32].zeroExtend(64) + )) + elif dst.size == 128: + e.append(m2_expr.ExprAff( + dst[:64], + src[:32].zeroExtend(64) * dst[:32].zeroExtend(64) + )) + e.append(m2_expr.ExprAff( + dst[64:], + src[64:96].zeroExtend(64) * dst[64:96].zeroExtend(64) + )) + else: + raise RuntimeError("Unsupported size %d" % dst.size) + return e, [] + + # Comparisons # @@ -4725,6 +4747,7 @@ mnemo_func = {'mov': mov, "pmulhw": pmulhw, "pmulhd": pmulhd, "pmulhq": pmulhq, + "pmuludq": pmuludq, # Arithmetic (floating-point) diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index cc0a0a93..93ab4a48 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -3044,6 +3044,11 @@ reg_tests = [ "0feed9"), (m32, "00000000 PMAXSW XMM0, XMM6", "660feec6"), + + (m32, "00000000 PMULUDQ MM3, MM1", + "0ff4d9"), + (m32, "00000000 PMULUDQ XMM0, XMM6", + "660ff4c6"), ] |