x86: Generate BMI2 shifts and rotates, if available.

Contributed by Peter Cawley.
This commit is contained in:
Mike Pall
2016-03-28 23:05:20 +02:00
parent 6801e7165c
commit 892887e584
5 changed files with 51 additions and 7 deletions

View File

@@ -2150,7 +2150,10 @@ static void asm_setup_regsp(ASMState *as)
#endif
#if LJ_TARGET_X86ORX64
/* Non-constant shift counts need to be in RID_ECX on x86/x64. */
case IR_BSHL: case IR_BSHR: case IR_BSAR: case IR_BROL: case IR_BROR:
case IR_BSHL: case IR_BSHR: case IR_BSAR:
if ((as->flags & JIT_F_BMI2)) /* Except if BMI2 is available. */
break;
case IR_BROL: case IR_BROR:
if (!irref_isk(ir->op2) && !ra_hashint(IR(ir->op2)->r)) {
IR(ir->op2)->r = REGSP_HINT(RID_ECX);
if (inloop)