JitArm64: Fix LSL/LSR/ROR/ASR wrappers.

The other method has a latency of 2 cycles. This also improves the
throughput a lot.
This commit is contained in:
Markus Wick 2017-08-11 23:41:15 +02:00
parent 5ee7f86199
commit d78009877b
2 changed files with 8 additions and 5 deletions

View File

@ -1542,19 +1542,22 @@ void ARM64XEmitter::MVN(ARM64Reg Rd, ARM64Reg Rm)
} }
void ARM64XEmitter::LSL(ARM64Reg Rd, ARM64Reg Rm, int shift) void ARM64XEmitter::LSL(ARM64Reg Rd, ARM64Reg Rm, int shift)
{ {
ORR(Rd, Is64Bit(Rd) ? ZR : WZR, Rm, ArithOption(Rm, ST_LSL, shift)); int bits = Is64Bit(Rd) ? 64 : 32;
UBFM(Rd, Rm, (bits - shift) & (bits - 1), bits - shift - 1);
} }
void ARM64XEmitter::LSR(ARM64Reg Rd, ARM64Reg Rm, int shift) void ARM64XEmitter::LSR(ARM64Reg Rd, ARM64Reg Rm, int shift)
{ {
ORR(Rd, Is64Bit(Rd) ? ZR : WZR, Rm, ArithOption(Rm, ST_LSR, shift)); int bits = Is64Bit(Rd) ? 64 : 32;
UBFM(Rd, Rm, shift, bits - 1);
} }
void ARM64XEmitter::ASR(ARM64Reg Rd, ARM64Reg Rm, int shift) void ARM64XEmitter::ASR(ARM64Reg Rd, ARM64Reg Rm, int shift)
{ {
ORR(Rd, Is64Bit(Rd) ? ZR : WZR, Rm, ArithOption(Rm, ST_ASR, shift)); int bits = Is64Bit(Rd) ? 64 : 32;
SBFM(Rd, Rm, shift, bits - 1);
} }
void ARM64XEmitter::ROR(ARM64Reg Rd, ARM64Reg Rm, int shift) void ARM64XEmitter::ROR(ARM64Reg Rd, ARM64Reg Rm, int shift)
{ {
ORR(Rd, Is64Bit(Rd) ? ZR : WZR, Rm, ArithOption(Rm, ST_ROR, shift)); EXTR(Rd, Rm, Rm, shift);
} }
// Logical (immediate) // Logical (immediate)

View File

@ -721,7 +721,7 @@ public:
void MOV(ARM64Reg Rd, ARM64Reg Rm); void MOV(ARM64Reg Rd, ARM64Reg Rm);
void MVN(ARM64Reg Rd, ARM64Reg Rm); void MVN(ARM64Reg Rd, ARM64Reg Rm);
// TODO: These are "slow" as they use arith+shift, should be replaced with UBFM/EXTR variants. // Convenience wrappers around UBFM/EXTR.
void LSR(ARM64Reg Rd, ARM64Reg Rm, int shift); void LSR(ARM64Reg Rd, ARM64Reg Rm, int shift);
void LSL(ARM64Reg Rd, ARM64Reg Rm, int shift); void LSL(ARM64Reg Rd, ARM64Reg Rm, int shift);
void ASR(ARM64Reg Rd, ARM64Reg Rm, int shift); void ASR(ARM64Reg Rd, ARM64Reg Rm, int shift);