From 584b33555080f95e42ef112e22830abc97bcf852 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Mon, 6 Jun 2011 10:17:46 +0000 Subject: [PATCH] Add some more spec rules, for performance purposes: * S and NS after LOGICL * BE after SUBB * B after SUBL git-svn-id: svn://svn.valgrind.org/vex/trunk@2157 --- VEX/priv/guest_amd64_helpers.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c index 9375f1db97..1c96a2b367 100644 --- a/VEX/priv/guest_amd64_helpers.c +++ b/VEX/priv/guest_amd64_helpers.c @@ -1030,6 +1030,15 @@ IRExpr* guest_amd64_spechelper ( HChar* function_name, mkU32(0))); } + if (isU64(cc_op, AMD64G_CC_OP_SUBL) && isU64(cond, AMD64CondB)) { + /* long sub/cmp, then B (unsigned less than) + --> test dst test dst <=u src */ + return unop(Iop_1Uto64, + binop(Iop_CmpLE64U, + binop(Iop_And64, cc_dep1, mkU64(0xFF)), + binop(Iop_And64, cc_dep2, mkU64(0xFF)))); + } + if (isU64(cc_op, AMD64G_CC_OP_SUBB) && isU64(cond, AMD64CondS) && isU64(cc_dep2, 0)) { /* byte sub/cmp of zero, then S --> test (dst-0 test dst!=0 */ return unop(Iop_1Uto64, @@ -1153,6 +1170,21 @@ IRExpr* guest_amd64_spechelper ( HChar* function_name, mkU32(0))); } + if (isU64(cc_op, AMD64G_CC_OP_LOGICL) && isU64(cond, AMD64CondS)) { + /* long and/or/xor, then S --> (ULong)result[31] */ + return binop(Iop_And64, + binop(Iop_Shr64, cc_dep1, mkU8(31)), + mkU64(1)); + } + if (isU64(cc_op, AMD64G_CC_OP_LOGICL) && isU64(cond, AMD64CondNS)) { + /* long and/or/xor, then S --> (ULong) ~ result[31] */ + return binop(Iop_Xor64, + binop(Iop_And64, + binop(Iop_Shr64, cc_dep1, mkU8(31)), + mkU64(1)), + mkU64(1)); + } + /*---------------- LOGICB ----------------*/ if (isU64(cc_op, AMD64G_CC_OP_LOGICB) && isU64(cond, AMD64CondZ)) { -- 2.47.2