summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2016-10-26 20:47:03 +0200
committerdegasus <wickmarkus@web.de>2016-10-26 21:54:09 +0200
commitdf250b84ccc4b8358be3d9cf07c0659f480d39b2 (patch)
tree985fe7b3d8589dfcb82e9ac38cdb2dbb56071e5c /Source/Core/Common
parent838b23431761467c6f3dca8a1924950cf4dc2260 (diff)
JitArm64: Avoid MOVI2R is possible.
Just use all kind of ADDI2R, SUBI2R, ... They have some optimizations internally.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Arm64Emitter.cpp52
-rw-r--r--Source/Core/Common/Arm64Emitter.h1
2 files changed, 36 insertions, 17 deletions
diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp
index b2f546d448..0063d499f0 100644
--- a/Source/Core/Common/Arm64Emitter.cpp
+++ b/Source/Core/Common/Arm64Emitter.cpp
@@ -4145,6 +4145,24 @@ void ARM64XEmitter::ADDI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
}
}
+void ARM64XEmitter::ADDSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
+{
+ u32 val;
+ bool shift;
+ if (IsImmArithmetic(imm, &val, &shift))
+ {
+ ADDS(Rd, Rn, val, shift);
+ }
+ else
+ {
+ _assert_msg_(DYNA_REC, scratch != INVALID_REG,
+ "ADDSI2R - failed to construct arithmetic immediate value from %08x, need scratch",
+ (u32)imm);
+ MOVI2R(scratch, imm);
+ ADDS(Rd, Rn, scratch);
+ }
+}
+
void ARM64XEmitter::SUBI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
{
u32 val;
@@ -4163,6 +4181,23 @@ void ARM64XEmitter::SUBI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
}
}
+void ARM64XEmitter::SUBSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
+{
+ u32 val;
+ bool shift;
+ if (IsImmArithmetic(imm, &val, &shift))
+ {
+ SUBS(Rd, Rn, val, shift);
+ }
+ else
+ {
+ _assert_msg_(DYNA_REC, scratch != INVALID_REG,
+ "ANDSI2R - failed to construct immediate value from %08x, need scratch", (u32)imm);
+ MOVI2R(scratch, imm);
+ SUBS(Rd, Rn, scratch);
+ }
+}
+
void ARM64XEmitter::CMPI2R(ARM64Reg Rn, u64 imm, ARM64Reg scratch)
{
u32 val;
@@ -4320,21 +4355,4 @@ void ARM64FloatEmitter::MOVI2FDUP(ARM64Reg Rd, float value, ARM64Reg scratch)
DUP(32, Rd, Rd, 0);
}
-void ARM64XEmitter::SUBSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
-{
- u32 val;
- bool shift;
- if (IsImmArithmetic(imm, &val, &shift))
- {
- SUBS(Rd, Rn, val, shift);
- }
- else
- {
- _assert_msg_(DYNA_REC, scratch != INVALID_REG,
- "ANDSI2R - failed to construct immediate value from %08x, need scratch", (u32)imm);
- MOVI2R(scratch, imm);
- SUBS(Rd, Rn, scratch);
- }
-}
-
} // namespace
diff --git a/Source/Core/Common/Arm64Emitter.h b/Source/Core/Common/Arm64Emitter.h
index 34fab4f1d8..3426fe2be2 100644
--- a/Source/Core/Common/Arm64Emitter.h
+++ b/Source/Core/Common/Arm64Emitter.h
@@ -855,6 +855,7 @@ public:
void CMPI2R(ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void ADDI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
+ void ADDSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void SUBI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void SUBSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);