aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
index 5833d879..17e80f4a 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
@@ -16,6 +16,38 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), GetSrcB(context));
}
+ public static void R2p(EmitterContext context)
+ {
+ OpCodeAlu op = (OpCodeAlu)context.CurrOp;
+
+ bool isCC = op.RawOpCode.Extract(40);
+ int shift = op.RawOpCode.Extract(41, 2) * 8;
+
+ Operand value = GetSrcA(context);
+ Operand mask = GetSrcB(context);
+
+ Operand Test(Operand value, int bit)
+ {
+ return context.ICompareNotEqual(context.BitwiseAnd(value, Const(1 << bit)), Const(0));
+ }
+
+ if (isCC)
+ {
+ // TODO.
+ }
+ else
+ {
+ for (int bit = 0; bit < 7; bit++)
+ {
+ Operand pred = Register(bit, RegisterType.Predicate);
+
+ Operand res = context.ConditionalSelect(Test(mask, bit), Test(value, bit + shift), pred);
+
+ context.Copy(pred, res);
+ }
+ }
+ }
+
public static void S2r(EmitterContext context)
{
// TODO: Better impl.