Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New LLVM-based SPU interpreter (SPU fast) #5762

Merged
merged 1 commit into from Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions rpcs3/Emu/CPU/CPUTranslator.h
Expand Up @@ -923,6 +923,12 @@ class cpu_translator
return llvm_value_t<T>::get_type(m_context);
}

template <typename R, typename... Args>
llvm::FunctionType* get_ftype()
{
return llvm::FunctionType::get(get_type<R>(), {get_type<Args>()...}, false);
}

template <typename T>
using value_t = llvm_value_t<T>;

Expand Down Expand Up @@ -1083,6 +1089,15 @@ class cpu_translator
return result;
}

template <typename T, typename V>
auto vsplat(V v)
{
value_t<T> result;
static_assert(result.is_vector);
result.value = m_ir->CreateVectorSplat(result.is_vector, v.eval(m_ir));
return result;
}

// Min
template <typename T>
auto min(T a, T b)
Expand Down Expand Up @@ -1257,6 +1272,19 @@ class cpu_translator
return result;
}

llvm::Value* load_const(llvm::GlobalVariable* g, llvm::Value* i)
{
return m_ir->CreateLoad(m_ir->CreateGEP(g, {m_ir->getInt64(0), m_ir->CreateZExtOrTrunc(i, get_type<u64>())}));
}

template <typename T, typename I>
value_t<T> load_const(llvm::GlobalVariable* g, I i)
{
value_t<T> result;
result.value = load_const(g, i.eval(m_ir));
return result;
}

template <typename R = v128>
R get_const_vector(llvm::Constant*, u32 a, u32 b);

Expand Down