|
From: <sv...@va...> - 2006-05-13 23:08:14
|
Author: sewardj
Date: 2006-05-14 00:08:06 +0100 (Sun, 14 May 2006)
New Revision: 1616
Log:
Add specialisation rules to simplify the IR for 'testl .. ; js ..',
'testw .. ; js ..' and 'testb .. ; js ..'. This gets rid of a bunch of=20
false errors in Memcheck of the form
=3D=3D2398=3D=3D Conditional jump or move depends on uninitialised value(=
s)
=3D=3D2398=3D=3D at 0x6C51B61: KHTMLPart::clear() (khtml_part.cpp:1370=
)
=3D=3D2398=3D=3D by 0x6C61A72: KHTMLPart::begin(KURL const&, int, int)=
=20
(khtml_part.cpp:1881)
(KDE 3.5.2 compiled by gcc-4.0.2, -g -O).
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-05-12 21:03:48 UTC (rev 1615)
+++ trunk/priv/guest-x86/ghelpers.c 2006-05-13 23:08:06 UTC (rev 1616)
@@ -920,11 +920,6 @@
return unop(Iop_1Uto32,binop(Iop_CmpEQ32, cc_dep1, mkU32(0)));
}
=20
- if (isU32(cc_op, X86G_CC_OP_LOGICL) && isU32(cond, X86CondS)) {
- /* long and/or/xor, then S --> test dst <s 0 */
- return unop(Iop_1Uto32,binop(Iop_CmpLT32S, cc_dep1, mkU32(0)));
- }
-
if (isU32(cc_op, X86G_CC_OP_LOGICL) && isU32(cond, X86CondLE)) {
/* long and/or/xor, then LE
This is pretty subtle. LOGIC sets SF and ZF according to th=
e
@@ -944,6 +939,14 @@
return unop(Iop_1Uto32,binop(Iop_CmpEQ32, cc_dep1, mkU32(0)));
}
=20
+ if (isU32(cc_op, X86G_CC_OP_LOGICL) && isU32(cond, X86CondS)) {
+ /* see comment below for (LOGICB, CondS) */
+ /* long and/or/xor, then S --> (UInt)result[31] */
+ return binop(Iop_And32,
+ binop(Iop_Shr32,cc_dep1,mkU8(31)),
+ mkU32(1));
+ }
+
/*---------------- LOGICW ----------------*/
=20
if (isU32(cc_op, X86G_CC_OP_LOGICW) && isU32(cond, X86CondZ)) {
@@ -953,6 +956,14 @@
mkU32(0)));
}
=20
+ if (isU32(cc_op, X86G_CC_OP_LOGICW) && isU32(cond, X86CondS)) {
+ /* see comment below for (LOGICB, CondS) */
+ /* word and/or/xor, then S --> (UInt)result[15] */
+ return binop(Iop_And32,
+ binop(Iop_Shr32,cc_dep1,mkU8(15)),
+ mkU32(1));
+ }
+
/*---------------- LOGICB ----------------*/
=20
if (isU32(cc_op, X86G_CC_OP_LOGICB) && isU32(cond, X86CondZ)) {
@@ -962,6 +973,19 @@
mkU32(0)));
}
=20
+ if (isU32(cc_op, X86G_CC_OP_LOGICB) && isU32(cond, X86CondS)) {
+ /* this is an idiom gcc sometimes uses to find out if the top
+ bit of a byte register is set: eg testb %al,%al; js ..
+ Since it just depends on the top bit of the byte, extract
+ that bit and explicitly get rid of all the rest. This
+ helps memcheck avoid false positives in the case where any
+ of the other bits in the byte are undefined. */
+ /* byte and/or/xor, then S --> (UInt)result[7] */
+ return binop(Iop_And32,
+ binop(Iop_Shr32,cc_dep1,mkU8(7)),
+ mkU32(1));
+ }
+
/*---------------- DECL ----------------*/
=20
if (isU32(cc_op, X86G_CC_OP_DECL) && isU32(cond, X86CondZ)) {
|