mirror of
https://github.com/cea-sec/miasm
synced 2026-08-17 10:26:03 -04:00
[arch/x86] add phminposuw instructions support
This commit is contained in:
parent
8ca9855c53
commit
b03beb7d4c
2 changed files with 28 additions and 0 deletions
|
|
@ -4473,6 +4473,9 @@ addop("pminub", [bs8(0x0f), bs8(0xda), pref_66] +
|
|||
addop("pminuw", [bs8(0x0f), bs8(0x38), bs8(0x3a), pref_66] +
|
||||
rmmod(xmm_reg, rm_arg_xmm))
|
||||
|
||||
addop("phminposuw", [bs8(0x0f), bs8(0x38), bs8(0x41), pref_66] +
|
||||
rmmod(xmm_reg, rm_arg_xmm_m128))
|
||||
|
||||
addop("pminud", [bs8(0x0f), bs8(0x38), bs8(0x3b), pref_66] +
|
||||
rmmod(xmm_reg, rm_arg_xmm))
|
||||
|
||||
|
|
|
|||
|
|
@ -4432,6 +4432,15 @@ def pshufhw(_, instr, dst, src, imm):
|
|||
out.append(src[shift + 64: shift + 16 + 64])
|
||||
return [m2_expr.ExprAssign(dst, m2_expr.ExprCompose(*out))], []
|
||||
|
||||
def ptest(_, instr, dst, src):
|
||||
e = []
|
||||
e.append(m2_expr.ExprAssign(zf, m2_expr.ExprOp('FLAG_EQ', dst & src)))
|
||||
e.append(m2_expr.ExprAssign(cf, m2_expr.ExprOp('FLAG_EQ', src & ~dst)))
|
||||
e.append(m2_expr.ExprAssign(of, m2_expr.ExprInt(0, 1)))
|
||||
e.append(m2_expr.ExprAssign(af, m2_expr.ExprInt(0, 1)))
|
||||
e.append(m2_expr.ExprAssign(pf, m2_expr.ExprInt(0, 1)))
|
||||
e.append(m2_expr.ExprAssign(nf, m2_expr.ExprInt(0, 1)))
|
||||
return e, []
|
||||
|
||||
def ps_rl_ll(ir, instr, dst, src, op, size):
|
||||
mask = {16: 0xF,
|
||||
|
|
@ -4918,7 +4927,21 @@ def _signed_to_unsigned_saturation(expr, dst_size):
|
|||
)
|
||||
)
|
||||
|
||||
def phminposuw(ir, instr, dst, src):
|
||||
if dst.size != 128 or src.size != 128:
|
||||
raise RuntimeError("Unsupported size dst=%d src=%d" % (dst.size, src.size))
|
||||
|
||||
min_val = src[:16]
|
||||
min_idx = m2_expr.ExprInt(0, 16)
|
||||
|
||||
for i in range(1, 8):
|
||||
word = src[i * 16:(i + 1) * 16]
|
||||
cond = m2_expr.expr_is_unsigned_lower(word, min_val)
|
||||
min_val = m2_expr.ExprCond(cond, word, min_val)
|
||||
min_idx = m2_expr.ExprCond(cond, m2_expr.ExprInt(i, 16), min_idx)
|
||||
|
||||
result = m2_expr.ExprCompose(min_val, min_idx, m2_expr.ExprInt(0, 96))
|
||||
return [m2_expr.ExprAssign(dst, result)], []
|
||||
|
||||
def packsswb(ir, instr, dst, src):
|
||||
out = []
|
||||
|
|
@ -5758,6 +5781,8 @@ mnemo_func = {'mov': mov,
|
|||
|
||||
"pmovmskb": pmovmskb,
|
||||
|
||||
"phminposuw": phminposuw,
|
||||
|
||||
"packsswb": packsswb,
|
||||
"packssdw": packssdw,
|
||||
"packuswb": packuswb,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue