translate_arm: Remove unnecessary rotr() function

We already have RotateRight() in our common code, so we can remove this
function and replace it with it. We can also implement ArmExpandImm_C()
in terms of ArmExpandImm().
This commit is contained in:
Lioncash 2018-07-15 21:24:23 -04:00 committed by MerryMage
parent c167715336
commit 9db6d1e98b

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include "common/bit_util.h"
#include "frontend/A32/ir_emitter.h" #include "frontend/A32/ir_emitter.h"
#include "frontend/A32/location_descriptor.h" #include "frontend/A32/location_descriptor.h"
@ -37,14 +38,8 @@ struct ArmTranslatorVisitor final {
bool UnpredictableInstruction(); bool UnpredictableInstruction();
bool UndefinedInstruction(); bool UndefinedInstruction();
static u32 rotr(u32 x, int shift) {
shift &= 31;
if (!shift) return x;
return (x >> shift) | (x << (32 - shift));
}
static u32 ArmExpandImm(int rotate, Imm8 imm8) { static u32 ArmExpandImm(int rotate, Imm8 imm8) {
return rotr(static_cast<u32>(imm8), rotate*2); return Common::RotateRight<u32>(imm8, rotate * 2);
} }
struct ImmAndCarry { struct ImmAndCarry {
@ -56,8 +51,8 @@ struct ArmTranslatorVisitor final {
u32 imm32 = imm8; u32 imm32 = imm8;
auto carry_out = carry_in; auto carry_out = carry_in;
if (rotate) { if (rotate) {
imm32 = rotr(imm8, rotate * 2); imm32 = ArmExpandImm(rotate, static_cast<Imm8>(imm8));
carry_out = ir.Imm1(imm32 >> 31 == 1); carry_out = ir.Imm1(Common::Bit<31>(imm32));
} }
return {imm32, carry_out}; return {imm32, carry_out};
} }