diff options
author | Mike Pall <mike> | 2011-01-19 02:05:26 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-19 02:05:26 +0100 |
commit | d20e53c322332f8197f401d6125f48071488b711 (patch) | |
tree | 4f7acb83c9897897617ac380d5d8808979691016 /src | |
parent | 8407ac0eca109d466b388d04b29f12f21265a1e0 (diff) | |
download | luajit-d20e53c322332f8197f401d6125f48071488b711.tar.gz luajit-d20e53c322332f8197f401d6125f48071488b711.tar.bz2 luajit-d20e53c322332f8197f401d6125f48071488b711.zip |
Combine i8/u8 XLOAD with BAND+comparison into test byte mrm, imm8.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_asm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index bda86fc4..cc2ae597 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -2945,8 +2945,28 @@ static void asm_comp_(ASMState *as, IRIns *ir, int cc) | |||
2945 | if (!asm_isk32(as, irl->op2, &imm)) { | 2945 | if (!asm_isk32(as, irl->op2, &imm)) { |
2946 | left = ra_alloc1(as, irl->op2, allow); | 2946 | left = ra_alloc1(as, irl->op2, allow); |
2947 | rset_clear(allow, left); | 2947 | rset_clear(allow, left); |
2948 | } else { /* Try to Fuse IRT_I8/IRT_U8 loads, too. See below. */ | ||
2949 | IRIns *irll = IR(irl->op1); | ||
2950 | if (opisfusableload((IROp)irll->o) && | ||
2951 | (irt_isi8(irll->t) || irt_isu8(irll->t))) { | ||
2952 | IRType1 origt = irll->t; /* Temporarily flip types. */ | ||
2953 | irll->t.irt = (irll->t.irt & ~IRT_TYPE) | IRT_INT; | ||
2954 | as->curins--; /* Skip to BAND to avoid failing in noconflict(). */ | ||
2955 | right = asm_fuseload(as, irl->op1, RSET_GPR); | ||
2956 | as->curins++; | ||
2957 | irll->t = origt; | ||
2958 | if (right != RID_MRM) goto test_nofuse; | ||
2959 | /* Fusion succeeded, emit test byte mrm, imm8. */ | ||
2960 | asm_guardcc(as, cc); | ||
2961 | emit_i8(as, (imm & 0xff)); | ||
2962 | emit_mrm(as, XO_GROUP3b, XOg_TEST, RID_MRM); | ||
2963 | return; | ||
2964 | } | ||
2948 | } | 2965 | } |
2966 | as->curins--; /* Skip to BAND to avoid failing in noconflict(). */ | ||
2949 | right = asm_fuseload(as, irl->op1, allow); | 2967 | right = asm_fuseload(as, irl->op1, allow); |
2968 | as->curins++; /* Undo the above. */ | ||
2969 | test_nofuse: | ||
2950 | asm_guardcc(as, cc); | 2970 | asm_guardcc(as, cc); |
2951 | if (ra_noreg(left)) { | 2971 | if (ra_noreg(left)) { |
2952 | emit_i32(as, imm); | 2972 | emit_i32(as, imm); |