mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-15 22:53:47 +00:00
CPUTranslator: add bitcast, trunc, zext, sext
This commit is contained in:
parent
cce0ad0c35
commit
fa04ff6d90
@ -711,6 +711,38 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename T2>
|
||||
value_t<T> bitcast(T2 expr)
|
||||
{
|
||||
value_t<T> result;
|
||||
result.value = m_ir->CreateBitCast(expr.eval(m_ir), result.get_type(m_context));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename T2>
|
||||
value_t<T> trunc(T2 expr)
|
||||
{
|
||||
value_t<T> result;
|
||||
result.value = m_ir->CreateTrunc(expr.eval(m_ir), result.get_type(m_context));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename T2>
|
||||
value_t<T> sext(T2 expr)
|
||||
{
|
||||
value_t<T> result;
|
||||
result.value = m_ir->CreateSExt(expr.eval(m_ir), result.get_type(m_context));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename T2>
|
||||
value_t<T> zext(T2 expr)
|
||||
{
|
||||
value_t<T> result;
|
||||
result.value = m_ir->CreateZExt(expr.eval(m_ir), result.get_type(m_context));
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get unsigned addition carry into the sign bit (s = a + b)
|
||||
template <typename T>
|
||||
static inline auto ucarry(T a, T b, T s)
|
||||
|
Loading…
Reference in New Issue
Block a user