summaryrefslogtreecommitdiff
path: root/compiler/utils/assembler_test.h
diff options
context:
space:
mode:
author Chao-ying Fu <chao-ying.fu@intel.com> 2015-04-07 16:03:04 -0700
committer Chao-ying Fu <chao-ying.fu@intel.com> 2015-04-08 18:10:26 -0700
commitd23840d3ed900c6072d71e6599b3568b68de6b7c (patch)
treec21634a4f0150913ab7b18017a1848ad7ca0224c /compiler/utils/assembler_test.h
parentfa09d442dc74ade81806fce5f1c256f4ddc13004 (diff)
x86_64: Fix the rex prefix for movzxb, movsxb, movb
This patch sets the rex prefix for the source byte register of movzxb, movsxb, and movb that has the destination memory operand, when the register is SPL, BPL, SIL, DIL. This patch adds tests for movzxb and movsxb via Repeatrb(), and adds the tertiary and quaternary register views for word and byte registers on x86_64. TODO: Support tests with memory operands. Change-Id: I0c5c727f3dd4a75af039b87f7e57d0741e689038 Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Diffstat (limited to 'compiler/utils/assembler_test.h')
-rw-r--r--compiler/utils/assembler_test.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/compiler/utils/assembler_test.h b/compiler/utils/assembler_test.h
index b13edb68bf..3fe1a31d70 100644
--- a/compiler/utils/assembler_test.h
+++ b/compiler/utils/assembler_test.h
@@ -44,7 +44,9 @@ static std::string tmpnam_;
enum class RegisterView { // private
kUsePrimaryName,
- kUseSecondaryName
+ kUseSecondaryName,
+ kUseTertiaryName,
+ kUseQuaternaryName,
};
template<typename Ass, typename Reg, typename FPReg, typename Imm>
@@ -97,6 +99,15 @@ class AssemblerTest : public testing::Test {
fmt);
}
+ std::string Repeatrb(void (Ass::*f)(Reg, Reg), std::string fmt) {
+ return RepeatTemplatedRegisters<Reg, Reg>(f,
+ GetRegisters(),
+ GetRegisters(),
+ &AssemblerTest::GetRegName<RegisterView::kUseSecondaryName>,
+ &AssemblerTest::GetRegName<RegisterView::kUseQuaternaryName>,
+ fmt);
+ }
+
std::string RepeatRr(void (Ass::*f)(Reg, Reg), std::string fmt) {
return RepeatTemplatedRegisters<Reg, Reg>(f,
GetRegisters(),
@@ -240,6 +251,18 @@ class AssemblerTest : public testing::Test {
UNREACHABLE();
}
+ // Tertiary register names are the tertiary view on registers, e.g., 16b on 64b systems.
+ virtual std::string GetTertiaryRegisterName(const Reg& reg ATTRIBUTE_UNUSED) {
+ UNIMPLEMENTED(FATAL) << "Architecture does not support tertiary registers";
+ UNREACHABLE();
+ }
+
+ // Quaternary register names are the quaternary view on registers, e.g., 8b on 64b systems.
+ virtual std::string GetQuaternaryRegisterName(const Reg& reg ATTRIBUTE_UNUSED) {
+ UNIMPLEMENTED(FATAL) << "Architecture does not support quaternary registers";
+ UNREACHABLE();
+ }
+
std::string GetRegisterName(const Reg& reg) {
return GetRegName<RegisterView::kUsePrimaryName>(reg);
}
@@ -520,6 +543,14 @@ class AssemblerTest : public testing::Test {
case RegisterView::kUseSecondaryName:
sreg << GetSecondaryRegisterName(reg);
break;
+
+ case RegisterView::kUseTertiaryName:
+ sreg << GetTertiaryRegisterName(reg);
+ break;
+
+ case RegisterView::kUseQuaternaryName:
+ sreg << GetQuaternaryRegisterName(reg);
+ break;
}
return sreg.str();
}