|
From: <sv...@va...> - 2011-05-02 18:58:04
|
Author: sewardj
Date: 2011-05-02 19:57:56 +0100 (Mon, 02 May 2011)
New Revision: 2140
Log:
Add a spec rule for V after SUB.
Modified:
trunk/priv/guest_arm_helpers.c
Modified: trunk/priv/guest_arm_helpers.c
===================================================================
--- trunk/priv/guest_arm_helpers.c 2011-05-02 07:21:04 UTC (rev 2139)
+++ trunk/priv/guest_arm_helpers.c 2011-05-02 18:57:56 UTC (rev 2140)
@@ -717,6 +717,25 @@
return cc_ndep;
}
+ if (isU32(cc_op, ARMG_CC_OP_SUB)) {
+ /* Thunk args are (argL, argR, unused) */
+ /* V after SUB
+ --> let res = argL - argR
+ in ((argL ^ argR) & (argL ^ res)) >> 31
+ --> ((argL ^ argR) & (argL ^ (argL - argR))) >> 31
+ */
+ IRExpr* argL = cc_dep1;
+ IRExpr* argR = cc_dep2;
+ return
+ binop(Iop_Shr32,
+ binop(Iop_And32,
+ binop(Iop_Xor32, argL, argR),
+ binop(Iop_Xor32, argL, binop(Iop_Sub32, argL, argR))
+ ),
+ mkU8(31)
+ );
+ }
+
if (isU32(cc_op, ARMG_CC_OP_SBB)) {
/* This happens occasionally in softfloat code, eg __divdf3+140 */
/* thunk is: (dep1=argL, dep2=argR, ndep=oldC) */
|