PPC: Clean up masked shift/rotate target settings.

This commit is contained in:
Mike Pall 2010-08-29 12:52:20 +02:00
parent 9c16a9f705
commit 844e40d700
3 changed files with 14 additions and 17 deletions

View File

@ -52,7 +52,8 @@
#define LJ_TARGET_X86 1 #define LJ_TARGET_X86 1
#define LJ_TARGET_X86ORX64 1 #define LJ_TARGET_X86ORX64 1
#define LJ_PAGESIZE 4096 #define LJ_PAGESIZE 4096
#define LJ_TARGET_MASKEDSHIFT 1 #define LJ_TARGET_MASKSHIFT 1
#define LJ_TARGET_MASKROT 1
#elif LUAJIT_TARGET == LUAJIT_ARCH_X64 #elif LUAJIT_TARGET == LUAJIT_ARCH_X64
@ -62,7 +63,8 @@
#define LJ_TARGET_X64 1 #define LJ_TARGET_X64 1
#define LJ_TARGET_X86ORX64 1 #define LJ_TARGET_X86ORX64 1
#define LJ_PAGESIZE 4096 #define LJ_PAGESIZE 4096
#define LJ_TARGET_MASKEDSHIFT 1 #define LJ_TARGET_MASKSHIFT 1
#define LJ_TARGET_MASKROT 1
#elif LUAJIT_TARGET == LUAJIT_ARCH_PPC #elif LUAJIT_TARGET == LUAJIT_ARCH_PPC
@ -76,7 +78,8 @@
#define LJ_TARGET_PPC 1 #define LJ_TARGET_PPC 1
#define LJ_TARGET_PPCSPE 1 #define LJ_TARGET_PPCSPE 1
#define LJ_PAGESIZE 4096 #define LJ_PAGESIZE 4096
#define LJ_TARGET_MASKEDSHIFT 1 #define LJ_TARGET_MASKSHIFT 0
#define LJ_TARGET_MASKROT 1
#define LJ_ARCH_NOJIT 1 #define LJ_ARCH_NOJIT 1
#else #else
@ -92,6 +95,9 @@
#if defined(_LITTLE_ENDIAN) #if defined(_LITTLE_ENDIAN)
#error "No support for little-endian PowerPC" #error "No support for little-endian PowerPC"
#endif #endif
#if defined(_LP64)
#error "No support for PowerPC 64 bit mode"
#endif
#endif #endif
#endif #endif
@ -113,16 +119,9 @@
#if LJ_ARCH_BITS == 32 #if LJ_ARCH_BITS == 32
#define LJ_32 1 #define LJ_32 1
#define LJ_64 0 #define LJ_64 0
#elif LJ_ARCH_BITS == 64 #else
#define LJ_32 0 #define LJ_32 0
#define LJ_64 1 #define LJ_64 1
#else
#error "Bad LJ_ARCH_BITS setting"
#endif
/* Whether target CPU masks the shift count by the operand length or not. */
#ifndef LJ_TARGET_MASKEDSHIFT
#define LJ_TARGET_MASKEDSHIFT 0
#endif #endif
#endif #endif

View File

@ -811,17 +811,16 @@ LJFOLD(BROL any BAND)
LJFOLD(BROR any BAND) LJFOLD(BROR any BAND)
LJFOLDF(simplify_shift_andk) LJFOLDF(simplify_shift_andk)
{ {
#if LJ_TARGET_MASKEDSHIFT
IRIns *irk = IR(fright->op2); IRIns *irk = IR(fright->op2);
PHIBARRIER(fright); PHIBARRIER(fright);
if (irk->o == IR_KINT) { /* i o (j & 31) ==> i o j */ if ((fins->o < IR_BROL ? LJ_TARGET_MASKSHIFT : LJ_TARGET_MASKROT) &&
irk->o == IR_KINT) { /* i o (j & 31) ==> i o j */
int32_t k = irk->i & 31; int32_t k = irk->i & 31;
if (k == 31) { if (k == 31) {
fins->op2 = fright->op1; fins->op2 = fright->op1;
return RETRYFOLD; return RETRYFOLD;
} }
} }
#endif
return NEXTFOLD; return NEXTFOLD;
} }

View File

@ -1552,10 +1552,9 @@ static void LJ_FASTCALL recff_bit_shift(jit_State *J, RecordFFData *rd)
{ {
TRef tr = lj_ir_tobit(J, J->base[0]); TRef tr = lj_ir_tobit(J, J->base[0]);
TRef tsh = lj_ir_tobit(J, J->base[1]); TRef tsh = lj_ir_tobit(J, J->base[1]);
#if !LJ_TARGET_MASKEDSHIFT if (!(rd->data < IR_BROL ? LJ_TARGET_MASKSHIFT : LJ_TARGET_MASKROT) &&
if (!tref_isk(tsh)) !tref_isk(tsh))
tsh = emitir(IRTI(IR_BAND), tsh, lj_ir_kint(J, 31)); tsh = emitir(IRTI(IR_BAND), tsh, lj_ir_kint(J, 31));
#endif
J->base[0] = emitir(IRTI(rd->data), tr, tsh); J->base[0] = emitir(IRTI(rd->data), tr, tsh);
} }