diff options
| author | 2021-05-10 01:41:07 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:31 -0400 | |
| commit | 0839e46736858986b422b2ffb163ded59c16421f (patch) | |
| tree | 290572487178105f8abf6ab983865c9e058a21f2 /src/shader_recompiler/backend/glasm/emit_glasm_select.cpp | |
| parent | glasm: Fix clamps so the min value has priority on NAN on GLASM (diff) | |
| download | yuzu-0839e46736858986b422b2ffb163ded59c16421f.tar.gz yuzu-0839e46736858986b422b2ffb163ded59c16421f.tar.xz yuzu-0839e46736858986b422b2ffb163ded59c16421f.zip | |
glasm: Implement SelectU64 on GLASM
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, |