|
From: <sv...@va...> - 2008-03-31 21:57:14
|
Author: sewardj
Date: 2008-03-31 22:57:17 +0100 (Mon, 31 Mar 2008)
New Revision: 1817
Log:
Specialise CondNS after SUBB on amd64.
Modified:
trunk/priv/guest-amd64/ghelpers.c
trunk/priv/guest-x86/ghelpers.c
Modified: trunk/priv/guest-amd64/ghelpers.c
===================================================================
--- trunk/priv/guest-amd64/ghelpers.c 2008-03-31 01:51:57 UTC (rev 1816)
+++ trunk/priv/guest-amd64/ghelpers.c 2008-03-31 21:57:17 UTC (rev 1817)
@@ -1043,6 +1043,18 @@
binop(Iop_Shr64,cc_dep1,mkU8(7)),
mkU64(1));
}
+ if (isU64(cc_op, AMD64G_CC_OP_SUBB) && isU64(cond, AMD64CondNS)
+ && isU64(cc_dep2, 0)) {
+ /* byte sub/cmp of zero, then NS --> test !(dst-0 <s 0)
+ --> test !(dst <s 0)
+ --> (ULong) !dst[7]
+ */
+ return binop(Iop_Xor64,
+ binop(Iop_And64,
+ binop(Iop_Shr64,cc_dep1,mkU8(7)),
+ mkU64(1)),
+ mkU64(1));
+ }
/*---------------- LOGICQ ----------------*/
Modified: trunk/priv/guest-x86/ghelpers.c
===================================================================
--- trunk/priv/guest-x86/ghelpers.c 2008-03-31 01:51:57 UTC (rev 1816)
+++ trunk/priv/guest-x86/ghelpers.c 2008-03-31 21:57:17 UTC (rev 1817)
@@ -967,7 +967,6 @@
binop(Iop_Shr32,cc_dep1,mkU8(7)),
mkU32(1));
}
-
if (isU32(cc_op, X86G_CC_OP_SUBB) && isU32(cond, X86CondNS)
&& isU32(cc_dep2, 0)) {
/* byte sub/cmp of zero, then NS --> test !(dst-0 <s 0)
|