|
|
@@ -200,10 +200,27 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|
|
// TODO: CC, X, corner cases
|
|
|
}
|
|
|
|
|
|
- public static void Imad(EmitterContext context)
|
|
|
+ public static void Icmp(EmitterContext context)
|
|
|
{
|
|
|
- OpCodeAlu op = (OpCodeAlu)context.CurrOp;
|
|
|
+ OpCode op = context.CurrOp;
|
|
|
+
|
|
|
+ bool isSigned = op.RawOpCode.Extract(48);
|
|
|
+
|
|
|
+ IntegerCondition cmpOp = (IntegerCondition)op.RawOpCode.Extract(49, 3);
|
|
|
+
|
|
|
+ Operand srcA = GetSrcA(context);
|
|
|
+ Operand srcB = GetSrcB(context);
|
|
|
+ Operand srcC = GetSrcC(context);
|
|
|
|
|
|
+ Operand cmpRes = GetIntComparison(context, cmpOp, srcC, Const(0), isSigned);
|
|
|
+
|
|
|
+ Operand res = context.ConditionalSelect(cmpRes, srcA, srcB);
|
|
|
+
|
|
|
+ context.Copy(GetDest(context), res);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Imad(EmitterContext context)
|
|
|
+ {
|
|
|
bool signedA = context.CurrOp.RawOpCode.Extract(48);
|
|
|
bool signedB = context.CurrOp.RawOpCode.Extract(53);
|
|
|
bool high = context.CurrOp.RawOpCode.Extract(54);
|
|
|
@@ -731,19 +748,16 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Instruction inst;
|
|
|
-
|
|
|
- switch (cond)
|
|
|
+ var inst = cond switch
|
|
|
{
|
|
|
- case IntegerCondition.Less: inst = Instruction.CompareLessU32; break;
|
|
|
- case IntegerCondition.Equal: inst = Instruction.CompareEqual; break;
|
|
|
- case IntegerCondition.LessOrEqual: inst = Instruction.CompareLessOrEqualU32; break;
|
|
|
- case IntegerCondition.Greater: inst = Instruction.CompareGreaterU32; break;
|
|
|
- case IntegerCondition.NotEqual: inst = Instruction.CompareNotEqual; break;
|
|
|
- case IntegerCondition.GreaterOrEqual: inst = Instruction.CompareGreaterOrEqualU32; break;
|
|
|
-
|
|
|
- default: throw new InvalidOperationException($"Unexpected condition \"{cond}\".");
|
|
|
- }
|
|
|
+ IntegerCondition.Less => Instruction.CompareLessU32,
|
|
|
+ IntegerCondition.Equal => Instruction.CompareEqual,
|
|
|
+ IntegerCondition.LessOrEqual => Instruction.CompareLessOrEqualU32,
|
|
|
+ IntegerCondition.Greater => Instruction.CompareGreaterU32,
|
|
|
+ IntegerCondition.NotEqual => Instruction.CompareNotEqual,
|
|
|
+ IntegerCondition.GreaterOrEqual => Instruction.CompareGreaterOrEqualU32,
|
|
|
+ _ => throw new InvalidOperationException($"Unexpected condition \"{cond}\".")
|
|
|
+ };
|
|
|
|
|
|
if (isSigned)
|
|
|
{
|