mirror of
https://github.com/ish-app/ish.git
synced 2026-02-01 14:32:26 +00:00
Implement shld
This commit is contained in:
parent
7cacc23b50
commit
3f4fee556c
@ -34,18 +34,17 @@
|
||||
.gadget_array \type
|
||||
.endr
|
||||
|
||||
.irp arg, imm,cl
|
||||
.macro do_shiftd op, arg
|
||||
.macro x name, reg
|
||||
.gadget shrd_\arg\()32_\name
|
||||
.gadget \op\()_\arg\()32_\name
|
||||
.ifc \arg,imm
|
||||
pushq %rcx
|
||||
movb (%_ip), %cl
|
||||
.endif
|
||||
testb $(32 - 1), %cl
|
||||
jz 1f
|
||||
shrd %cl, %\reg, %tmpd
|
||||
\op %cl, %\reg, %tmpd
|
||||
setf_oc
|
||||
setf_zsp %tmpd, l
|
||||
1:
|
||||
.ifc \arg,imm
|
||||
popq %rcx
|
||||
@ -56,7 +55,12 @@
|
||||
.endm
|
||||
.each_reg x
|
||||
.purgem x
|
||||
.gadget_array shrd_\arg
|
||||
.gadget_array \op\()_\arg
|
||||
.endm
|
||||
.irp op, shrd,shld
|
||||
.irp arg, imm,cl
|
||||
do_shiftd \op, \arg
|
||||
.endr
|
||||
.endr
|
||||
|
||||
.macro do_bt arg
|
||||
|
||||
12
emu/gen.c
12
emu/gen.c
@ -274,10 +274,16 @@ static inline bool gen_op(struct gen_state *state, gadget_t *gadgets, enum arg a
|
||||
#define SHR(count, val,z) los(shr, count, val, z)
|
||||
#define SAR(count, val,z) los(sar, count, val, z)
|
||||
|
||||
#define SHLD(count, extra, dst,z) UNDEFINED
|
||||
#define SHRD(count, extra, dst,z) load(dst,z); \
|
||||
#define SHLD(count, extra, dst,z) \
|
||||
load(dst,z); \
|
||||
if (arg_##count == arg_reg_c) op(shld_cl, extra,z); \
|
||||
else { op(shld_imm, extra,z); GEN(imm); } \
|
||||
store(dst,z)
|
||||
#define SHRD(count, extra, dst,z) \
|
||||
load(dst,z); \
|
||||
if (arg_##count == arg_reg_c) op(shrd_cl, extra,z); \
|
||||
else { op(shrd_imm, extra,z); GEN(imm); } store(dst,z)
|
||||
else { op(shrd_imm, extra,z); GEN(imm); } \
|
||||
store(dst,z)
|
||||
|
||||
#define BT(bit, val,z) lo(bt, bit, val, z)
|
||||
#define BTC(bit, val,z) UNDEFINED
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user