Adding Xmm Select table, GetRawXMM

This commit is contained in:
chrisps 2020-01-15 16:11:29 -08:00 committed by illusion
parent b79f33526d
commit 8f1e6f3980
1 changed files with 9 additions and 4 deletions

View File

@ -738,6 +738,8 @@ static const vec128_t xmm_consts[] = {
/* XMMIntMaxPD */ vec128d(INT_MAX), /* XMMIntMaxPD */ vec128d(INT_MAX),
/* XMMPosIntMinPS */ vec128f((float)0x80000000u), /* XMMPosIntMinPS */ vec128f((float)0x80000000u),
/* XMMQNaN */ vec128i(0x7FC00000u), /* XMMQNaN */ vec128i(0x7FC00000u),
/*XMMSelectTableBase */vec128i(0),
/*XMMSelectTableLast*/ vec128i(-1)
}; };
// First location to try and place constants. // First location to try and place constants.
@ -776,14 +778,17 @@ void X64Emitter::FreeConstData(uintptr_t data) {
memory::DeallocFixed(reinterpret_cast<void*>(data), 0, memory::DeallocFixed(reinterpret_cast<void*>(data), 0,
memory::DeallocationType::kRelease); memory::DeallocationType::kRelease);
} }
uintptr_t X64Emitter::GetXmmRawAddress(XmmConst id) {
return backend_->emitter_data() + sizeof(vec128_t) * id;
}
Xbyak::Address X64Emitter::GetXmmConstPtr(XmmConst id) { Xbyak::Address X64Emitter::GetXmmConstPtr(XmmConst id) {
// Load through fixed constant table setup by PlaceConstData. // Load through fixed constant table setup by PlaceConstData.
// It's important that the pointer is not signed, as it will be sign-extended. // It's important that the pointer is not signed, as it will be sign-extended.
return ptr[reinterpret_cast<void*>(backend_->emitter_data() + return ptr[GetXmmRawAddress(id)];
sizeof(vec128_t) * id)];
} }
// Implies possible StashXmm(0, ...)! // Implies possible StashXmm(0, ...)!
void X64Emitter::LoadConstantXmm(Xbyak::Xmm dest, const vec128_t& v) { void X64Emitter::LoadConstantXmm(Xbyak::Xmm dest, const vec128_t& v) {
// https://www.agner.org/optimize/optimizing_assembly.pdf // https://www.agner.org/optimize/optimizing_assembly.pdf