diff options
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm_select.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm_select.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp index 8f9df8e23..cfde86047 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp | |||
| @@ -29,9 +29,24 @@ void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, ScalarS32 cond, ScalarS32 t | |||
| 29 | ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value); | 29 | ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void EmitSelectU64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond, | 32 | void EmitSelectU64(EmitContext& ctx, IR::Inst& inst, ScalarS32 cond, Register true_value, |
| 33 | [[maybe_unused]] Register true_value, [[maybe_unused]] Register false_value) { | 33 | Register false_value) { |
| 34 | throw NotImplementedException("GLASM instruction"); | 34 | ctx.reg_alloc.InvalidateConditionCodes(); |
| 35 | const Register ret{ctx.reg_alloc.LongDefine(inst)}; | ||
| 36 | if (ret == true_value) { | ||
| 37 | ctx.Add("MOV.S.CC RC.x,{};" | ||
| 38 | "MOV.U64 {}.x(EQ.x),{};", | ||
| 39 | cond, ret, false_value); | ||
| 40 | } else if (ret == false_value) { | ||
| 41 | ctx.Add("MOV.S.CC RC.x,{};" | ||
| 42 | "MOV.U64 {}.x(NE.x),{};", | ||
| 43 | cond, ret, true_value); | ||
| 44 | } else { | ||
| 45 | ctx.Add("MOV.S.CC RC.x,{};" | ||
| 46 | "MOV.U64 {}.x(EQ.x),{};" | ||
| 47 | "MOV.U64 {}.x(NE.x),{};", | ||
| 48 | cond, ret, false_value, ret, true_value); | ||
| 49 | } | ||
| 35 | } | 50 | } |
| 36 | 51 | ||
| 37 | void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond, | 52 | void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond, |