|
From: <sv...@va...> - 2005-05-05 12:05:16
|
Author: sewardj
Date: 2005-05-05 13:05:11 +0100 (Thu, 05 May 2005)
New Revision: 1161
Modified:
trunk/priv/guest-amd64/ghelpers.c
Log:
More %flags-helpers tuning.
Modified: trunk/priv/guest-amd64/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-amd64/ghelpers.c 2005-05-05 12:04:14 UTC (rev 1160)
+++ trunk/priv/guest-amd64/ghelpers.c 2005-05-05 12:05:11 UTC (rev 1161)
@@ -696,6 +696,8 @@
=20
/* Fast-case some common ones. */
switch (cc_op) {
+ case AMD64G_CC_OP_COPY:
+ return (cc_dep1 >> AMD64G_CC_SHIFT_C) & 1;
case AMD64G_CC_OP_LOGICQ:=20
case AMD64G_CC_OP_LOGICL:=20
case AMD64G_CC_OP_LOGICW:=20
@@ -1045,37 +1047,37 @@
//.. /* SHRL, then Z --> test dep1 =3D=3D 0 */
//.. return unop(Iop_1Uto32,binop(Iop_CmpEQ32, cc_dep1, mkU32(0=
)));
//.. }
-//..=20
-//.. /*---------------- COPY ----------------*/
-//.. /* This can happen, as a result of x87 FP compares: "fcom ...=
;
-//.. fnstsw %ax ; sahf ; jbe" for example. */
-//..=20
-//.. if (isU32(cc_op, AMD64G_CC_OP_COPY) &&=20
-//.. (isU32(cond, X86CondBE) || isU32(cond, X86CondNBE))) {
-//.. /* COPY, then BE --> extract C and Z from dep1, and test (=
C
-//.. or Z =3D=3D 1). */
-//.. /* COPY, then NBE --> extract C and Z from dep1, and test =
(C
-//.. or Z =3D=3D 0). */
-//.. UInt nnn =3D isU32(cond, X86CondBE) ? 1 : 0;
-//.. return
-//.. unop(
-//.. Iop_1Uto32,
-//.. binop(
-//.. Iop_CmpEQ32,
-//.. binop(
-//.. Iop_And32,
-//.. binop(
-//.. Iop_Or32,
-//.. binop(Iop_Shr32, cc_dep1, mkU8(AMD64G_CC_SH=
IFT_C)),
-//.. binop(Iop_Shr32, cc_dep1, mkU8(AMD64G_CC_SH=
IFT_Z))
-//.. ),
-//.. mkU32(1)
-//.. ),
-//.. mkU32(nnn)
-//.. )
-//.. );
-//.. }
-//.. =20
+
+ /*---------------- COPY ----------------*/
+ /* This can happen, as a result of amd64 FP compares: "comisd ... =
;
+ jbe" for example. */
+
+ if (isU64(cc_op, AMD64G_CC_OP_COPY) &&=20
+ (isU64(cond, AMD64CondBE) || isU64(cond, AMD64CondNBE))) {
+ /* COPY, then BE --> extract C and Z from dep1, and test (C
+ or Z =3D=3D 1). */
+ /* COPY, then NBE --> extract C and Z from dep1, and test (C
+ or Z =3D=3D 0). */
+ ULong nnn =3D isU64(cond, AMD64CondBE) ? 1 : 0;
+ return
+ unop(
+ Iop_1Uto64,
+ binop(
+ Iop_CmpEQ64,
+ binop(
+ Iop_And64,
+ binop(
+ Iop_Or64,
+ binop(Iop_Shr64, cc_dep1, mkU8(AMD64G_CC_SHIFT_C=
)),
+ binop(Iop_Shr64, cc_dep1, mkU8(AMD64G_CC_SHIFT_Z=
))
+ ),
+ mkU64(1)
+ ),
+ mkU64(nnn)
+ )
+ );
+ }
+ =20
//.. if (isU32(cc_op, AMD64G_CC_OP_COPY) && isU32(cond, X86CondB))=
{
//.. /* COPY, then B --> extract C dep1, and test (C =3D=3D 1).=
*/
//.. return
@@ -1133,13 +1135,13 @@
/* If the thunk is dec or inc, the cflag is supplied as CC_NDEP=
. */
return cc_ndep;
}
-//.. if (isU32(cc_op, AMD64G_CC_OP_COPY)) {
+//.. if (isU64(cc_op, AMD64G_CC_OP_COPY)) {
//.. /* cflag after COPY is stored in DEP1. */
//.. return
//.. binop(
-//.. Iop_And32,
-//.. binop(Iop_Shr32, cc_dep1, mkU8(AMD64G_CC_SHIFT_C)),
-//.. mkU32(1)
+//.. Iop_And64,
+//.. binop(Iop_Shr64, cc_dep1, mkU8(AMD64G_CC_SHIFT_C)),
+//.. mkU64(1)
//.. );
//.. }
//.. # if 0
|