|
From: <sv...@va...> - 2006-11-22 16:01:51
|
Author: sewardj
Date: 2006-11-22 16:01:45 +0000 (Wed, 22 Nov 2006)
New Revision: 1681
Log:
A couple more x86 spec rules: COPY-CondNZ and SUBL-CondNS.
Modified:
trunk/priv/guest-x86/ghelpers.c
Modified: trunk/priv/guest-x86/ghelpers.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/priv/guest-x86/ghelpers.c 2006-11-19 02:05:47 UTC (rev 1680)
+++ trunk/priv/guest-x86/ghelpers.c 2006-11-22 16:01:45 UTC (rev 1681)
@@ -885,6 +885,16 @@
mkU32(0)));
}
=20
+ if (isU32(cc_op, X86G_CC_OP_SUBL) && isU32(cond, X86CondNS)) {
+ /* long sub/cmp, then S=20
+ --> test !(dst-src <s 0)=20
+ --> test 0 <=3Ds (dst-src) */
+ return unop(Iop_1Uto32,
+ binop(Iop_CmpLE32S,
+ mkU32(0),
+ binop(Iop_Sub32, cc_dep1, cc_dep2)));
+ }
+
/*---------------- SUBW ----------------*/
=20
if (isU32(cc_op, X86G_CC_OP_SUBW) && isU32(cond, X86CondZ)) {
@@ -1124,8 +1134,8 @@
);
}
=20
- if (isU32(cc_op, X86G_CC_OP_COPY) &&=20
- (isU32(cond, X86CondB) || isU32(cond, X86CondNB))) {
+ if (isU32(cc_op, X86G_CC_OP_COPY)=20
+ && (isU32(cond, X86CondB) || isU32(cond, X86CondNB))) {
/* COPY, then B --> extract C from dep1, and test (C =3D=3D 1).=
*/
/* COPY, then NB --> extract C from dep1, and test (C =3D=3D 0)=
. */
UInt nnn =3D isU32(cond, X86CondB) ? 1 : 0;
@@ -1144,19 +1154,22 @@
);
}
=20
- if (isU32(cc_op, X86G_CC_OP_COPY) && isU32(cond, X86CondZ)) {
+ if (isU32(cc_op, X86G_CC_OP_COPY)=20
+ && (isU32(cond, X86CondZ) || isU32(cond, X86CondNZ))) {
/* COPY, then Z --> extract Z from dep1, and test (Z =3D=3D 1).=
*/
+ /* COPY, then NZ --> extract Z from dep1, and test (Z =3D=3D 0)=
. */
+ UInt nnn =3D isU32(cond, X86CondZ) ? 1 : 0;
return
unop(
Iop_1Uto32,
binop(
- Iop_CmpNE32,
+ Iop_CmpEQ32,
binop(
Iop_And32,
binop(Iop_Shr32, cc_dep1, mkU8(X86G_CC_SHIFT_Z)),
mkU32(1)
),
- mkU32(0)
+ mkU32(nnn)
)
);
}
|