From 8f1e6f3980c18e826728cc9d6f280d62d26cbb62 Mon Sep 17 00:00:00 2001 From: chrisps Date: Wed, 15 Jan 2020 16:11:29 -0800 Subject: [PATCH] Adding Xmm Select table, GetRawXMM --- src/xenia/cpu/backend/x64/x64_emitter.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index 91de2ef9b..f5f07a9aa 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -737,7 +737,9 @@ static const vec128_t xmm_consts[] = { /* XMMIntMax */ vec128i(INT_MAX), /* XMMIntMaxPD */ vec128d(INT_MAX), /* XMMPosIntMinPS */ vec128f((float)0x80000000u), - /* XMMQNaN */ vec128i(0x7FC00000u), + /* XMMQNaN */ vec128i(0x7FC00000u), + /*XMMSelectTableBase */vec128i(0), + /*XMMSelectTableLast*/ vec128i(-1) }; // First location to try and place constants. @@ -776,14 +778,17 @@ void X64Emitter::FreeConstData(uintptr_t data) { memory::DeallocFixed(reinterpret_cast(data), 0, memory::DeallocationType::kRelease); } - +uintptr_t X64Emitter::GetXmmRawAddress(XmmConst id) { + return backend_->emitter_data() + sizeof(vec128_t) * id; +} Xbyak::Address X64Emitter::GetXmmConstPtr(XmmConst id) { // Load through fixed constant table setup by PlaceConstData. // It's important that the pointer is not signed, as it will be sign-extended. - return ptr[reinterpret_cast(backend_->emitter_data() + - sizeof(vec128_t) * id)]; + return ptr[GetXmmRawAddress(id)]; } + + // Implies possible StashXmm(0, ...)! void X64Emitter::LoadConstantXmm(Xbyak::Xmm dest, const vec128_t& v) { // https://www.agner.org/optimize/optimizing_assembly.pdf