Load SIMD constants with IR_FLOAD from GG_State.

Contributed by Peter Cawley.
This commit is contained in:
Mike Pall 2016-05-21 01:04:17 +02:00
parent 786dbb2ebd
commit ccae333844
4 changed files with 5 additions and 5 deletions

View File

@ -498,7 +498,7 @@ static void LJ_FASTCALL recff_getfenv(jit_State *J, RecordFFData *rd)
static void LJ_FASTCALL recff_math_abs(jit_State *J, RecordFFData *rd) static void LJ_FASTCALL recff_math_abs(jit_State *J, RecordFFData *rd)
{ {
TRef tr = lj_ir_tonum(J, J->base[0]); TRef tr = lj_ir_tonum(J, J->base[0]);
J->base[0] = emitir(IRTN(IR_ABS), tr, lj_ir_knum_abs(J)); J->base[0] = emitir(IRTN(IR_ABS), tr, lj_ir_ksimd(J, LJ_KSIMD_ABS));
UNUSED(rd); UNUSED(rd);
} }

View File

@ -77,8 +77,8 @@ static LJ_AINLINE TRef lj_ir_knum(jit_State *J, lua_Number n)
#define lj_ir_knum_tobit(J) lj_ir_knum_u64(J, U64x(43380000,00000000)) #define lj_ir_knum_tobit(J) lj_ir_knum_u64(J, U64x(43380000,00000000))
/* Special 128 bit SIMD constants. */ /* Special 128 bit SIMD constants. */
#define lj_ir_knum_abs(J) lj_ir_k64(J, IR_KNUM, LJ_KSIMD(J, LJ_KSIMD_ABS)) #define lj_ir_ksimd(J, idx) \
#define lj_ir_knum_neg(J) lj_ir_k64(J, IR_KNUM, LJ_KSIMD(J, LJ_KSIMD_NEG)) lj_ir_ggfload(J, IRT_NUM, (uintptr_t)LJ_KSIMD(J, idx) - (uintptr_t)J2GG(J))
/* Access to constants. */ /* Access to constants. */
LJ_FUNC void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir); LJ_FUNC void lj_ir_kvalue(lua_State *L, TValue *tv, const IRIns *ir);

View File

@ -999,7 +999,7 @@ LJFOLDF(simplify_nummuldiv_k)
return LEFTFOLD; return LEFTFOLD;
} else if (n == -1.0) { /* x o -1 ==> -x */ } else if (n == -1.0) { /* x o -1 ==> -x */
fins->o = IR_NEG; fins->o = IR_NEG;
fins->op2 = (IRRef1)lj_ir_knum_neg(J); fins->op2 = (IRRef1)lj_ir_ksimd(J, LJ_KSIMD_NEG);
return RETRYFOLD; return RETRYFOLD;
} else if (fins->o == IR_MUL && n == 2.0) { /* x * 2 ==> x + x */ } else if (fins->o == IR_MUL && n == 2.0) { /* x * 2 ==> x + x */
fins->o = IR_ADD; fins->o = IR_ADD;

View File

@ -555,7 +555,7 @@ TRef lj_opt_narrow_unm(jit_State *J, TRef rc, TValue *vc)
return emitir(IRTGI(IR_SUBOV), lj_ir_kint(J, 0), rc); return emitir(IRTGI(IR_SUBOV), lj_ir_kint(J, 0), rc);
rc = emitir(IRTN(IR_CONV), rc, IRCONV_NUM_INT); rc = emitir(IRTN(IR_CONV), rc, IRCONV_NUM_INT);
} }
return emitir(IRTN(IR_NEG), rc, lj_ir_knum_neg(J)); return emitir(IRTN(IR_NEG), rc, lj_ir_ksimd(J, LJ_KSIMD_NEG));
} }
/* Narrowing of modulo operator. */ /* Narrowing of modulo operator. */