mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-16 07:10:40 +00:00
CPUTranslator: add bitcast, trunc, zext, sext
This commit is contained in:
parent
cce0ad0c35
commit
fa04ff6d90
@ -711,6 +711,38 @@ public:
|
|||||||
return result;
|
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)
|
// Get unsigned addition carry into the sign bit (s = a + b)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline auto ucarry(T a, T b, T s)
|
static inline auto ucarry(T a, T b, T s)
|
||||||
|
Loading…
Reference in New Issue
Block a user