about summary refs log tree commit diff stats
path: root/miasm2/arch/x86/sem.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2018-02-09 10:23:14 +0100
committerAjax <commial@gmail.com>2018-02-09 17:36:31 +0100
commitb8bd5c0f24b786616b6f372f7f6dfad43438ab01 (patch)
tree58aef70ebfa87e197836cb739fd32aa3bb12280f /miasm2/arch/x86/sem.py
parent950bb44e32c5bed4dba7ef77949db86b4d36c5ca (diff)
downloadmiasm-b8bd5c0f24b786616b6f372f7f6dfad43438ab01.tar.gz
miasm-b8bd5c0f24b786616b6f372f7f6dfad43438ab01.zip
Add PMULUDQ instruction
NP 0F F4 /r PMULUDQ mm1, mm2/m64
66 0F F4 /r PMULUDQ xmm1, xmm2/m128
Diffstat (limited to 'miasm2/arch/x86/sem.py')
-rw-r--r--miasm2/arch/x86/sem.py23
1 files changed, 23 insertions, 0 deletions
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)