From 8cc4fe8a10e03b6ca025e20fa6d63a4c42f44f9e Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 6 Aug 2016 17:11:22 +0100 Subject: [PATCH] BackendX64/RegAlloc: HostLocToX64 now handles XMM registers properly --- src/backend_x64/reg_alloc.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/backend_x64/reg_alloc.cpp b/src/backend_x64/reg_alloc.cpp index 9671db28..c38e77fd 100644 --- a/src/backend_x64/reg_alloc.cpp +++ b/src/backend_x64/reg_alloc.cpp @@ -33,7 +33,14 @@ static Gen::OpArg ImmediateToOpArg(const IR::Value& imm) { static Gen::X64Reg HostLocToX64(HostLoc loc) { DEBUG_ASSERT(HostLocIsRegister(loc)); // HostLoc is ordered such that the numbers line up. - return static_cast(loc); + if (HostLocIsGPR(loc)) { + return static_cast(loc); + } + if (HostLocIsXMM(loc)) { + return static_cast(size_t(loc) - size_t(HostLoc::XMM0)); + } + ASSERT_MSG(false, "This should never happen."); + return Gen::INVALID_REG; } static Gen::OpArg SpillToOpArg(HostLoc loc) {