summaryrefslogtreecommitdiff
path: root/Source/UnitTests
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-07-10 17:27:47 -0400
committerGitHub <noreply@github.com>2022-07-10 17:27:47 -0400
commit38cb76dea54b59fa0eae458e0898edebed13e7ca (patch)
tree75c3f91c49e0198ee60195b8f21f158bbdb1f1ac /Source/UnitTests
parent6e09b13ce361e9f560033234908565f7afa6f090 (diff)
parent0d947ed6fe21e51e2081418fa048c95b1ef66a97 (diff)
Merge pull request #10807 from merryhime/LogicalImm
Arm64Emitter: Simplify LogicalImm logic
Diffstat (limited to 'Source/UnitTests')
-rw-r--r--Source/UnitTests/Core/PowerPC/JitArm64/MovI2R.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/UnitTests/Core/PowerPC/JitArm64/MovI2R.cpp b/Source/UnitTests/Core/PowerPC/JitArm64/MovI2R.cpp
index 125e3de963..889878d43a 100644
--- a/Source/UnitTests/Core/PowerPC/JitArm64/MovI2R.cpp
+++ b/Source/UnitTests/Core/PowerPC/JitArm64/MovI2R.cpp
@@ -79,6 +79,37 @@ TEST(JitArm64, MovI2R_Rand)
}
}
+// Construct and test every 64-bit logical immediate
+TEST(JitArm64, MovI2R_LogImm)
+{
+ TestMovI2R test;
+
+ for (unsigned size = 2; size <= 64; size *= 2)
+ {
+ for (unsigned length = 1; length < size; ++length)
+ {
+ u64 imm = ~u64{0} >> (64 - length);
+ for (unsigned e = size; e < 64; e *= 2)
+ {
+ imm |= imm << e;
+ }
+ for (unsigned rotation = 0; rotation < size; ++rotation)
+ {
+ test.Check64(imm);
+ EXPECT_EQ(static_cast<bool>(LogicalImm(imm, 64)), true);
+
+ if (size < 64)
+ {
+ test.Check32(imm);
+ EXPECT_EQ(static_cast<bool>(LogicalImm(static_cast<u32>(imm), 32)), true);
+ }
+
+ imm = (imm >> 63) | (imm << 1);
+ }
+ }
+ }
+}
+
TEST(JitArm64, MovI2R_ADP)
{
TestMovI2R test;