|
From: <sv...@va...> - 2005-05-02 17:07:06
|
Author: sewardj
Date: 2005-05-02 18:07:02 +0100 (Mon, 02 May 2005)
New Revision: 1156
Modified:
trunk/priv/guest-x86/toIR.c
Log:
When handling 'sbb %reg,%reg', first put zero into %reg. This removes
the false result dependency on the previous value of %reg.
Modified: trunk/priv/guest-x86/toIR.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/toIR.c 2005-05-02 16:16:15 UTC (rev 1155)
+++ trunk/priv/guest-x86/toIR.c 2005-05-02 17:07:02 UTC (rev 1156)
@@ -1811,24 +1811,6 @@
/*--- Disassembling common idioms ---*/
/*------------------------------------------------------------*/
=20
-static
-void codegen_XOR_reg_with_itself ( Int size, Int ge_reg )
-{
- IRType ty =3D szToITy(size);
- /* reg :=3D 0 */
- putIReg(size, ge_reg, mkU(ty,0));
- /* Flags: C,A,O=3D0, Z=3D1, S=3D0, P=3D1 */
- stmt( IRStmt_Put( OFFB_CC_OP, mkU32(X86G_CC_OP_COPY) ));
- stmt( IRStmt_Put( OFFB_CC_DEP1, mkU32(X86G_CC_MASK_Z|X86G_CC_MASK_P) =
));
- stmt( IRStmt_Put( OFFB_CC_DEP2, mkU32(0) ));
- /* Set NDEP even though it isn't used. This makes redundant-PUT
- elimination of previous stores to this field work better. */
- stmt( IRStmt_Put( OFFB_CC_NDEP, mkU32(0) ));
- DIP("xor%c %s, %s\n", nameISize(size),
- nameIReg(size,ge_reg), nameIReg(size,ge_reg) );
-}
-
-
/* Handle binary integer instructions of the form
op E, G meaning
op reg-or-mem, reg
@@ -1885,10 +1867,10 @@
/* Specially handle XOR reg,reg, because that doesn't really
depend on reg, and doing the obvious thing potentially
generates a spurious value check failure due to the bogus
- dependency. */
- if (op8 =3D=3D Iop_Xor8 && gregOfRM(rm) =3D=3D eregOfRM(rm)) {
- codegen_XOR_reg_with_itself ( size, gregOfRM(rm) );
- return 1+delta0;
+ dependency. Ditto SBB reg,reg. */
+ if ((op8 =3D=3D Iop_Xor8 || (op8 =3D=3D Iop_Sub8 && addSubCarry))
+ && gregOfRM(rm) =3D=3D eregOfRM(rm)) {
+ putIReg(size, gregOfRM(rm), mkU(ty,0));
}
assign( dst0, getIReg(size,gregOfRM(rm)) );
assign( src, getIReg(size,eregOfRM(rm)) );
@@ -1993,10 +1975,10 @@
/* Specially handle XOR reg,reg, because that doesn't really
depend on reg, and doing the obvious thing potentially
generates a spurious value check failure due to the bogus
- dependency. */
- if (op8 =3D=3D Iop_Xor8 && gregOfRM(rm) =3D=3D eregOfRM(rm)) {
- codegen_XOR_reg_with_itself ( size, gregOfRM(rm) );
- return 1+delta0;
+ dependency. Ditto SBB reg,reg.*/
+ if ((op8 =3D=3D Iop_Xor8 || (op8 =3D=3D Iop_Sub8 && addSubCarry))
+ && gregOfRM(rm) =3D=3D eregOfRM(rm)) {
+ putIReg(size, eregOfRM(rm), mkU(ty,0));
}
assign(dst0, getIReg(size,eregOfRM(rm)));
assign(src, getIReg(size,gregOfRM(rm)));
|