diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-23 22:08:43 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-24 18:38:19 +0100 |
| commit | 7dd9de865892837d275f0ef0a55f70d8df55fe43 (patch) | |
| tree | 830af67a279489dd0f55294984353af77d991744 /miasm2/arch/x86/sem.py | |
| parent | 8f5cd4efc8bc1442a413d7909ee3ee5edc486321 (diff) | |
| download | miasm-7dd9de865892837d275f0ef0a55f70d8df55fe43.tar.gz miasm-7dd9de865892837d275f0ef0a55f70d8df55fe43.zip | |
X86: add pcmpeq
Diffstat (limited to 'miasm2/arch/x86/sem.py')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index ec0598d7..f7f6ea75 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -3561,6 +3561,27 @@ def pminud(ir, instr, a, b): return pminu(ir, instr, a, b, 32) + +def pcmpeq(ir, instr, a, b, size): + e = [] + for i in xrange(0, a.size, size): + test = a[i:i+size] - b[i:i+size] + e.append(m2_expr.ExprAff(a[i:i+size], + m2_expr.ExprCond(test, + m2_expr.ExprInt(0, size), + m2_expr.ExprInt(-1, size)))) + return e, [] + + +def pcmpeqb(ir, instr, a, b): + return pcmpeq(ir, instr, a, b, 8) + +def pcmpeqw(ir, instr, a, b): + return pcmpeq(ir, instr, a, b, 16) + +def pcmpeqd(ir, instr, a, b): + return pcmpeq(ir, instr, a, b, 32) + mnemo_func = {'mov': mov, 'xchg': xchg, 'movzx': movzx, @@ -3991,6 +4012,11 @@ mnemo_func = {'mov': mov, "pminub" : pminub, "pminuw" : pminuw, "pminud" : pminud, + + "pcmpeqb" : pcmpeqb, + "pcmpeqw" : pcmpeqw, + "pcmpeqd" : pcmpeqd, + } |