Skip to content

Commit

Permalink
New SPU interpreter (SPU fast)
Browse files Browse the repository at this point in the history
Use LLVM to build SPU interpreter.
Simplify interpreter loop.
  • Loading branch information
Nekotekina committed Mar 25, 2019
1 parent 956d039 commit 1de4900
Show file tree
Hide file tree
Showing 5 changed files with 962 additions and 320 deletions.
22 changes: 22 additions & 0 deletions rpcs3/Emu/CPU/CPUTranslator.h
Expand Up @@ -1083,6 +1083,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 +1266,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

0 comments on commit 1de4900

Please sign in to comment.