about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2016-01-06 11:23:16 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2016-01-06 11:23:16 +0100
commit1eb15a19f2033e5e96d4f7614caf8f11c28396d7 (patch)
tree9b6240e033572ae1e479454c4c0feafd962c18c0
parentd10e08ebb6b90370e60298f323388a4e996f1231 (diff)
downloadmiasm-1eb15a19f2033e5e96d4f7614caf8f11c28396d7.tar.gz
miasm-1eb15a19f2033e5e96d4f7614caf8f11c28396d7.zip
X86: add pshufd
-rw-r--r--miasm2/arch/x86/arch.py2
-rw-r--r--miasm2/arch/x86/sem.py11
-rw-r--r--test/arch/x86/arch.py2
3 files changed, 15 insertions, 0 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index af79ea97..ee4f5fbf 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -3983,6 +3983,8 @@ addop("pshufb", [bs8(0x0f), bs8(0x38), bs8(0x00), no_xmm_pref] +
       rmmod(mm_reg, rm_arg_mm))
 addop("pshufb", [bs8(0x0f), bs8(0x38), bs8(0x00), pref_66] +
       rmmod(xmm_reg, rm_arg_xmm))
+addop("pshufd", [bs8(0x0f), bs8(0x70), pref_66] +
+      rmmod(xmm_reg, rm_arg_xmm) + [u08])
 
 
 
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index d3927821..61e56bbe 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -3583,6 +3583,16 @@ def pshufb(ir, instr, a, b):
     return e, []
 
 
+def pshufd(ir, instr, a, b, c):
+    e = []
+    for i in xrange(4):
+        index = c[2 * i:2 * (i + 1)].zeroExtend(a.size)
+        index <<= m2_expr.ExprInt(5, a.size)
+        value = (a >> index)[:32]
+        e.append(m2_expr.ExprAff(a[32 * i:32 * (i + 1)], value))
+    return e, []
+
+
 def ps_rl_ll(ir, instr, a, b, op, size):
     lbl_zero = m2_expr.ExprId(ir.gen_label(), ir.IRDst.size)
     lbl_do = m2_expr.ExprId(ir.gen_label(), ir.IRDst.size)
@@ -4348,6 +4358,7 @@ mnemo_func = {'mov': mov,
               "rdmsr": rdmsr,
               "wrmsr": wrmsr,
               "pshufb": pshufb,
+              "pshufd": pshufd,
 
               "psrlw": psrlw,
               "psrld": psrld,
diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py
index 76d376d0..3fe33ac8 100644
--- a/test/arch/x86/arch.py
+++ b/test/arch/x86/arch.py
@@ -2617,6 +2617,8 @@ reg_tests = [
     "0F380036"),
     (m32, "00000000    PSHUFB     XMM6, XMMWORD PTR [ESI]",
     "660F380036"),
+    (m32, "00000000    PSHUFD     XMM6, XMMWORD PTR [ESI], 0xEE",
+    "660F7036EE"),
 
 
     (m32, "00000000    PSRLQ      MM6, 0x5",