From: Julian Seward Date: Mon, 26 Dec 2005 19:33:55 +0000 (+0000) Subject: Performance improvements for flag handling. X-Git-Tag: svn/VALGRIND_3_2_3^2~141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2099a73646dc8890f91cf49f528aa8cc277fffad;p=thirdparty%2Fvalgrind.git Performance improvements for flag handling. git-svn-id: svn://svn.valgrind.org/vex/trunk@1513 --- diff --git a/VEX/priv/guest-amd64/ghelpers.c b/VEX/priv/guest-amd64/ghelpers.c index 7514a5dcc1..70d0ff505f 100644 --- a/VEX/priv/guest-amd64/ghelpers.c +++ b/VEX/priv/guest-amd64/ghelpers.c @@ -899,6 +899,18 @@ IRExpr* guest_amd64_spechelper ( HChar* function_name, /*---------------- SUBQ ----------------*/ + if (isU64(cc_op, AMD64G_CC_OP_SUBQ) && isU64(cond, AMD64CondZ)) { + /* long long sub/cmp, then Z --> test dst==src */ + return unop(Iop_1Uto64, + binop(Iop_CmpEQ64,cc_dep1,cc_dep2)); + } + + if (isU64(cc_op, AMD64G_CC_OP_SUBQ) && isU64(cond, AMD64CondNZ)) { + /* long long sub/cmp, then NZ --> test dst!=src */ + return unop(Iop_1Uto64, + binop(Iop_CmpNE64,cc_dep1,cc_dep2)); + } + if (isU64(cc_op, AMD64G_CC_OP_SUBQ) && isU64(cond, AMD64CondL)) { /* long long sub/cmp, then L (signed less than) --> test dst test src <=u dst */ + /* Note, args are opposite way round from the usual */ + return unop(Iop_1Uto64, + binop(Iop_CmpLE64U, cc_dep2, cc_dep1)); + } + + if (isU64(cc_op, AMD64G_CC_OP_SUBQ) && isU64(cond, AMD64CondBE)) { + /* long long sub/cmp, then BE (unsigned less than or equal) + --> test dst <=u src */ + return unop(Iop_1Uto64, + binop(Iop_CmpLE64U, cc_dep1, cc_dep2)); + } + /*---------------- SUBL ----------------*/ if (isU64(cc_op, AMD64G_CC_OP_SUBL) && isU64(cond, AMD64CondZ)) { /* long sub/cmp, then Z --> test dst==src */ return unop(Iop_1Uto64, - binop(Iop_CmpEQ32, - unop(Iop_64to32,cc_dep1), - unop(Iop_64to32,cc_dep2))); + binop(Iop_CmpEQ64, + binop(Iop_Shl64,cc_dep1,mkU8(32)), + binop(Iop_Shl64,cc_dep2,mkU8(32)))); + } + + if (isU64(cc_op, AMD64G_CC_OP_SUBL) && isU64(cond, AMD64CondNZ)) { + /* long sub/cmp, then NZ --> test dst!=src */ + return unop(Iop_1Uto64, + binop(Iop_CmpNE64, + binop(Iop_Shl64,cc_dep1,mkU8(32)), + binop(Iop_Shl64,cc_dep2,mkU8(32)))); } //.. if (isU32(cc_op, AMD64G_CC_OP_SUBL) && isU32(cond, X86CondNZ)) { @@ -936,7 +971,6 @@ IRExpr* guest_amd64_spechelper ( HChar* function_name, binop(Iop_CmpLT64S, binop(Iop_Shl64,cc_dep1,mkU8(32)), binop(Iop_Shl64,cc_dep2,mkU8(32)))); - } if (isU64(cc_op, AMD64G_CC_OP_SUBL) && isU64(cond, AMD64CondLE)) { @@ -949,14 +983,15 @@ IRExpr* guest_amd64_spechelper ( HChar* function_name, } + if (isU64(cc_op, AMD64G_CC_OP_SUBL) && isU64(cond, AMD64CondBE)) { + /* long sub/cmp, then BE (unsigned less than or equal) + --> test dst <=u src */ + return unop(Iop_1Uto64, + binop(Iop_CmpLE64U, + binop(Iop_Shl64,cc_dep1,mkU8(32)), + binop(Iop_Shl64,cc_dep2,mkU8(32)))); + } -//.. if (isU32(cc_op, AMD64G_CC_OP_SUBL) && isU32(cond, X86CondBE)) { -//.. /* long sub/cmp, then BE (unsigned less than or equal) -//.. --> test dst <=u src */ -//.. return unop(Iop_1Uto32, -//.. binop(Iop_CmpLE32U, cc_dep1, cc_dep2)); -//.. } -//.. //.. if (isU32(cc_op, AMD64G_CC_OP_SUBL) && isU32(cond, X86CondB)) { //.. /* long sub/cmp, then B (unsigned less than) //.. --> test dst test src <=u dst */ +//.. --> test src Iex.Binop.op == Iop_CmpLT64S || e->Iex.Binop.op == Iop_CmpLT64U || e->Iex.Binop.op == Iop_CmpLE64S - //|| e->Iex.Binop.op == Iop_CmpLE64U + || e->Iex.Binop.op == Iop_CmpLE64U )) { HReg r1 = iselIntExpr_R(env, e->Iex.Binop.arg1); AMD64RMI* rmi2 = iselIntExpr_RMI(env, e->Iex.Binop.arg2); @@ -2126,7 +2126,7 @@ static AMD64CondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e ) case Iop_CmpLT64S: return Acc_L; case Iop_CmpLT64U: return Acc_B; case Iop_CmpLE64S: return Acc_LE; - //case Iop_CmpLE64U: return Acc_BE; + case Iop_CmpLE64U: return Acc_BE; default: vpanic("iselCondCode(amd64): CmpXX64"); } }