diff options
Diffstat (limited to 'src/shader_recompiler/backend')
4 files changed, 164 insertions, 138 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h index 30cc6c2eb..13f47b253 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h +++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h | |||
| @@ -208,8 +208,8 @@ void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true | |||
| 208 | std::string_view false_value); | 208 | std::string_view false_value); |
| 209 | void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 209 | void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value, |
| 210 | std::string_view false_value); | 210 | std::string_view false_value); |
| 211 | void EmitSelectU32(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 211 | void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, |
| 212 | std::string_view false_value); | 212 | std::string_view true_value, std::string_view false_value); |
| 213 | void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 213 | void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value, |
| 214 | std::string_view false_value); | 214 | std::string_view false_value); |
| 215 | void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | 215 | void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, |
| @@ -332,14 +332,14 @@ void EmitFPIsNan16(EmitContext& ctx, std::string_view value); | |||
| 332 | void EmitFPIsNan32(EmitContext& ctx, std::string_view value); | 332 | void EmitFPIsNan32(EmitContext& ctx, std::string_view value); |
| 333 | void EmitFPIsNan64(EmitContext& ctx, std::string_view value); | 333 | void EmitFPIsNan64(EmitContext& ctx, std::string_view value); |
| 334 | void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); | 334 | void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 335 | void EmitIAdd64(EmitContext& ctx, std::string_view a, std::string_view b); | 335 | void EmitIAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 336 | void EmitISub32(EmitContext& ctx, std::string_view a, std::string_view b); | 336 | void EmitISub32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 337 | void EmitISub64(EmitContext& ctx, std::string_view a, std::string_view b); | 337 | void EmitISub64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 338 | void EmitIMul32(EmitContext& ctx, std::string_view a, std::string_view b); | 338 | void EmitIMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 339 | void EmitINeg32(EmitContext& ctx, std::string_view value); | 339 | void EmitINeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 340 | void EmitINeg64(EmitContext& ctx, std::string_view value); | 340 | void EmitINeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 341 | void EmitIAbs32(EmitContext& ctx, std::string_view value); | 341 | void EmitIAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 342 | void EmitIAbs64(EmitContext& ctx, std::string_view value); | 342 | void EmitIAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 343 | void EmitShiftLeftLogical32(EmitContext& ctx, std::string_view base, std::string_view shift); | 343 | void EmitShiftLeftLogical32(EmitContext& ctx, std::string_view base, std::string_view shift); |
| 344 | void EmitShiftLeftLogical64(EmitContext& ctx, std::string_view base, std::string_view shift); | 344 | void EmitShiftLeftLogical64(EmitContext& ctx, std::string_view base, std::string_view shift); |
| 345 | void EmitShiftRightLogical32(EmitContext& ctx, std::string_view base, std::string_view shift); | 345 | void EmitShiftRightLogical32(EmitContext& ctx, std::string_view base, std::string_view shift); |
| @@ -349,35 +349,39 @@ void EmitShiftRightArithmetic64(EmitContext& ctx, std::string_view base, std::st | |||
| 349 | void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); | 349 | void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 350 | void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); | 350 | void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 351 | void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); | 351 | void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 352 | void EmitBitFieldInsert(EmitContext& ctx, std::string_view base, std::string_view insert, | 352 | void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 353 | std::string_view offset, std::string_view count); | 353 | std::string_view insert, std::string_view offset, std::string_view count); |
| 354 | void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, | 354 | void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 355 | std::string_view offset, std::string_view count); | 355 | std::string_view offset, std::string_view count); |
| 356 | void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, | 356 | void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 357 | std::string_view offset, std::string_view count); | 357 | std::string_view offset, std::string_view count); |
| 358 | void EmitBitReverse32(EmitContext& ctx, std::string_view value); | 358 | void EmitBitReverse32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 359 | void EmitBitCount32(EmitContext& ctx, std::string_view value); | 359 | void EmitBitCount32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 360 | void EmitBitwiseNot32(EmitContext& ctx, std::string_view value); | 360 | void EmitBitwiseNot32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 361 | void EmitFindSMsb32(EmitContext& ctx, std::string_view value); | 361 | void EmitFindSMsb32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 362 | void EmitFindUMsb32(EmitContext& ctx, std::string_view value); | 362 | void EmitFindUMsb32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 363 | void EmitSMin32(EmitContext& ctx, std::string_view a, std::string_view b); | 363 | void EmitSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 364 | void EmitUMin32(EmitContext& ctx, std::string_view a, std::string_view b); | 364 | void EmitUMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 365 | void EmitSMax32(EmitContext& ctx, std::string_view a, std::string_view b); | 365 | void EmitSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 366 | void EmitUMax32(EmitContext& ctx, std::string_view a, std::string_view b); | 366 | void EmitUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b); |
| 367 | void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, | 367 | void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, |
| 368 | std::string_view max); | 368 | std::string_view max); |
| 369 | void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, | 369 | void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min, |
| 370 | std::string_view max); | 370 | std::string_view max); |
| 371 | void EmitSLessThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 371 | void EmitSLessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 372 | void EmitULessThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 372 | void EmitULessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 373 | void EmitIEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 373 | void EmitIEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 374 | void EmitSLessThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 374 | void EmitSLessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 375 | void EmitULessThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 375 | std::string_view rhs); |
| 376 | void EmitSGreaterThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 376 | void EmitULessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, |
| 377 | void EmitUGreaterThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 377 | std::string_view rhs); |
| 378 | void EmitINotEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 378 | void EmitSGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 379 | void EmitSGreaterThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 379 | void EmitUGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 380 | void EmitUGreaterThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs); | 380 | void EmitINotEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs); |
| 381 | void EmitSGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | ||
| 382 | std::string_view rhs); | ||
| 383 | void EmitUGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, | ||
| 384 | std::string_view rhs); | ||
| 381 | void EmitSharedAtomicIAdd32(EmitContext& ctx, std::string_view pointer_offset, | 385 | void EmitSharedAtomicIAdd32(EmitContext& ctx, std::string_view pointer_offset, |
| 382 | std::string_view value); | 386 | std::string_view value); |
| 383 | void EmitSharedAtomicSMin32(EmitContext& ctx, std::string_view pointer_offset, | 387 | void EmitSharedAtomicSMin32(EmitContext& ctx, std::string_view pointer_offset, |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp index e228fa072..d4e519a2a 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp | |||
| @@ -12,42 +12,46 @@ namespace Shader::Backend::GLASM { | |||
| 12 | 12 | ||
| 13 | void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 13 | void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 14 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 14 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 15 | throw NotImplementedException("GLASM instruction"); | 15 | ctx.Add("ADD {},{},{};", inst, a, b); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 18 | void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 19 | [[maybe_unused]] std::string_view b) { | 19 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 20 | throw NotImplementedException("GLASM instruction"); | 20 | throw NotImplementedException("GLASM instruction"); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 23 | void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 24 | [[maybe_unused]] std::string_view b) { | 24 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 25 | throw NotImplementedException("GLASM instruction"); | 25 | ctx.Add("SUB {},{},{};", inst, a, b); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 28 | void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 29 | [[maybe_unused]] std::string_view b) { | 29 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 30 | throw NotImplementedException("GLASM instruction"); | 30 | throw NotImplementedException("GLASM instruction"); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 33 | void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 34 | [[maybe_unused]] std::string_view b) { | 34 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 35 | throw NotImplementedException("GLASM instruction"); | 35 | throw NotImplementedException("GLASM instruction"); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 38 | void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 39 | [[maybe_unused]] std::string_view value) { | ||
| 39 | throw NotImplementedException("GLASM instruction"); | 40 | throw NotImplementedException("GLASM instruction"); |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 43 | void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 44 | [[maybe_unused]] std::string_view value) { | ||
| 43 | throw NotImplementedException("GLASM instruction"); | 45 | throw NotImplementedException("GLASM instruction"); |
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 48 | void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 49 | [[maybe_unused]] std::string_view value) { | ||
| 47 | throw NotImplementedException("GLASM instruction"); | 50 | throw NotImplementedException("GLASM instruction"); |
| 48 | } | 51 | } |
| 49 | 52 | ||
| 50 | void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 53 | void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 54 | [[maybe_unused]] std::string_view value) { | ||
| 51 | throw NotImplementedException("GLASM instruction"); | 55 | throw NotImplementedException("GLASM instruction"); |
| 52 | } | 56 | } |
| 53 | 57 | ||
| @@ -94,7 +98,7 @@ void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In | |||
| 94 | 98 | ||
| 95 | void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 99 | void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 96 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { | 100 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 97 | throw NotImplementedException("GLASM instruction"); | 101 | ctx.Add("OR {},{},{};", inst, a, b); |
| 98 | } | 102 | } |
| 99 | 103 | ||
| 100 | void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 104 | void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -102,64 +106,66 @@ void EmitBitwiseXor32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In | |||
| 102 | throw NotImplementedException("GLASM instruction"); | 106 | throw NotImplementedException("GLASM instruction"); |
| 103 | } | 107 | } |
| 104 | 108 | ||
| 105 | void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view base, | 109 | void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 106 | [[maybe_unused]] std::string_view insert, | 110 | std::string_view insert, std::string_view offset, std::string_view count) { |
| 107 | [[maybe_unused]] std::string_view offset, | 111 | ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset); |
| 108 | [[maybe_unused]] std::string_view count) { | 112 | ctx.Add("BFI.U {},RC,{},{};", inst, insert, base); |
| 109 | throw NotImplementedException("GLASM instruction"); | ||
| 110 | } | 113 | } |
| 111 | 114 | ||
| 112 | void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 115 | void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 113 | [[maybe_unused]] std::string_view base, | 116 | std::string_view offset, std::string_view count) { |
| 114 | [[maybe_unused]] std::string_view offset, | 117 | ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset); |
| 115 | [[maybe_unused]] std::string_view count) { | 118 | ctx.Add("BFE.S {},RC,{};", inst, base); |
| 116 | throw NotImplementedException("GLASM instruction"); | ||
| 117 | } | 119 | } |
| 118 | 120 | ||
| 119 | void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 121 | void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base, |
| 120 | [[maybe_unused]] std::string_view base, | 122 | std::string_view offset, std::string_view count) { |
| 121 | [[maybe_unused]] std::string_view offset, | 123 | ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset); |
| 122 | [[maybe_unused]] std::string_view count) { | 124 | ctx.Add("BFE.U {},RC,{};", inst, base); |
| 123 | throw NotImplementedException("GLASM instruction"); | ||
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 127 | void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 127 | throw NotImplementedException("GLASM instruction"); | 128 | [[maybe_unused]] std::string_view value) { |
| 129 | ctx.Add("BFR {},{};", inst, value); | ||
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 132 | void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 133 | [[maybe_unused]] std::string_view value) { | ||
| 131 | throw NotImplementedException("GLASM instruction"); | 134 | throw NotImplementedException("GLASM instruction"); |
| 132 | } | 135 | } |
| 133 | 136 | ||
| 134 | void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 137 | void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 138 | [[maybe_unused]] std::string_view value) { | ||
| 135 | throw NotImplementedException("GLASM instruction"); | 139 | throw NotImplementedException("GLASM instruction"); |
| 136 | } | 140 | } |
| 137 | 141 | ||
| 138 | void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 142 | void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 143 | [[maybe_unused]] std::string_view value) { | ||
| 139 | throw NotImplementedException("GLASM instruction"); | 144 | throw NotImplementedException("GLASM instruction"); |
| 140 | } | 145 | } |
| 141 | 146 | ||
| 142 | void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) { | 147 | void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 148 | [[maybe_unused]] std::string_view value) { | ||
| 143 | throw NotImplementedException("GLASM instruction"); | 149 | throw NotImplementedException("GLASM instruction"); |
| 144 | } | 150 | } |
| 145 | 151 | ||
| 146 | void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 152 | void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 147 | [[maybe_unused]] std::string_view b) { | 153 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 148 | throw NotImplementedException("GLASM instruction"); | 154 | throw NotImplementedException("GLASM instruction"); |
| 149 | } | 155 | } |
| 150 | 156 | ||
| 151 | void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 157 | void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 152 | [[maybe_unused]] std::string_view b) { | 158 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 153 | throw NotImplementedException("GLASM instruction"); | 159 | throw NotImplementedException("GLASM instruction"); |
| 154 | } | 160 | } |
| 155 | 161 | ||
| 156 | void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 162 | void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 157 | [[maybe_unused]] std::string_view b) { | 163 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 158 | throw NotImplementedException("GLASM instruction"); | 164 | throw NotImplementedException("GLASM instruction"); |
| 159 | } | 165 | } |
| 160 | 166 | ||
| 161 | void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a, | 167 | void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 162 | [[maybe_unused]] std::string_view b) { | 168 | [[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) { |
| 163 | throw NotImplementedException("GLASM instruction"); | 169 | throw NotImplementedException("GLASM instruction"); |
| 164 | } | 170 | } |
| 165 | 171 | ||
| @@ -175,54 +181,60 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& | |||
| 175 | throw NotImplementedException("GLASM instruction"); | 181 | throw NotImplementedException("GLASM instruction"); |
| 176 | } | 182 | } |
| 177 | 183 | ||
| 178 | void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 184 | void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 179 | [[maybe_unused]] std::string_view rhs) { | 185 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 180 | throw NotImplementedException("GLASM instruction"); | 186 | ctx.Add("SLT.S {},{},{};", inst, lhs, rhs); |
| 181 | } | 187 | } |
| 182 | 188 | ||
| 183 | void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 189 | void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 184 | [[maybe_unused]] std::string_view rhs) { | 190 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 185 | throw NotImplementedException("GLASM instruction"); | 191 | ctx.Add("SLT.U {},{},{};", inst, lhs, rhs); |
| 186 | } | 192 | } |
| 187 | 193 | ||
| 188 | void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 194 | void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 189 | [[maybe_unused]] std::string_view rhs) { | 195 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 190 | throw NotImplementedException("GLASM instruction"); | 196 | ctx.Add("SEQ {},{},{};", inst, lhs, rhs); |
| 191 | } | 197 | } |
| 192 | 198 | ||
| 193 | void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 199 | void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 200 | [[maybe_unused]] std::string_view lhs, | ||
| 194 | [[maybe_unused]] std::string_view rhs) { | 201 | [[maybe_unused]] std::string_view rhs) { |
| 195 | throw NotImplementedException("GLASM instruction"); | 202 | ctx.Add("SLE.S {},{},{};", inst, lhs, rhs); |
| 196 | } | 203 | } |
| 197 | 204 | ||
| 198 | void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 205 | void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 206 | [[maybe_unused]] std::string_view lhs, | ||
| 199 | [[maybe_unused]] std::string_view rhs) { | 207 | [[maybe_unused]] std::string_view rhs) { |
| 200 | throw NotImplementedException("GLASM instruction"); | 208 | ctx.Add("SLE.U {},{},{};", inst, lhs, rhs); |
| 201 | } | 209 | } |
| 202 | 210 | ||
| 203 | void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 211 | void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 212 | [[maybe_unused]] std::string_view lhs, | ||
| 204 | [[maybe_unused]] std::string_view rhs) { | 213 | [[maybe_unused]] std::string_view rhs) { |
| 205 | throw NotImplementedException("GLASM instruction"); | 214 | ctx.Add("SGT.S {},{},{};", inst, lhs, rhs); |
| 206 | } | 215 | } |
| 207 | 216 | ||
| 208 | void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 217 | void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 218 | [[maybe_unused]] std::string_view lhs, | ||
| 209 | [[maybe_unused]] std::string_view rhs) { | 219 | [[maybe_unused]] std::string_view rhs) { |
| 210 | throw NotImplementedException("GLASM instruction"); | 220 | ctx.Add("SGT.U {},{},{};", inst, lhs, rhs); |
| 211 | } | 221 | } |
| 212 | 222 | ||
| 213 | void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 223 | void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 214 | [[maybe_unused]] std::string_view rhs) { | 224 | [[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) { |
| 215 | throw NotImplementedException("GLASM instruction"); | 225 | throw NotImplementedException("GLASM instruction"); |
| 216 | } | 226 | } |
| 217 | 227 | ||
| 218 | void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 228 | void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 229 | [[maybe_unused]] std::string_view lhs, | ||
| 219 | [[maybe_unused]] std::string_view rhs) { | 230 | [[maybe_unused]] std::string_view rhs) { |
| 220 | throw NotImplementedException("GLASM instruction"); | 231 | ctx.Add("SGE.S {},{},{};", inst, lhs, rhs); |
| 221 | } | 232 | } |
| 222 | 233 | ||
| 223 | void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs, | 234 | void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 235 | [[maybe_unused]] std::string_view lhs, | ||
| 224 | [[maybe_unused]] std::string_view rhs) { | 236 | [[maybe_unused]] std::string_view rhs) { |
| 225 | throw NotImplementedException("GLASM instruction"); | 237 | ctx.Add("SGE.U {},{},{};", inst, lhs, rhs); |
| 226 | } | 238 | } |
| 227 | 239 | ||
| 228 | } // namespace Shader::Backend::GLASM | 240 | } // namespace Shader::Backend::GLASM |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp index 1337f4ae8..32eb87837 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_not_implemented.cpp | |||
| @@ -413,46 +413,6 @@ void EmitCompositeInsertF64x4(EmitContext& ctx, std::string_view composite, std: | |||
| 413 | NotImplemented(); | 413 | NotImplemented(); |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | void EmitSelectU1(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 417 | std::string_view false_value) { | ||
| 418 | NotImplemented(); | ||
| 419 | } | ||
| 420 | |||
| 421 | void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 422 | std::string_view false_value) { | ||
| 423 | NotImplemented(); | ||
| 424 | } | ||
| 425 | |||
| 426 | void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 427 | std::string_view false_value) { | ||
| 428 | NotImplemented(); | ||
| 429 | } | ||
| 430 | |||
| 431 | void EmitSelectU32(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 432 | std::string_view false_value) { | ||
| 433 | NotImplemented(); | ||
| 434 | } | ||
| 435 | |||
| 436 | void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 437 | std::string_view false_value) { | ||
| 438 | NotImplemented(); | ||
| 439 | } | ||
| 440 | |||
| 441 | void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 442 | std::string_view false_value) { | ||
| 443 | NotImplemented(); | ||
| 444 | } | ||
| 445 | |||
| 446 | void EmitSelectF32(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 447 | std::string_view false_value) { | ||
| 448 | NotImplemented(); | ||
| 449 | } | ||
| 450 | |||
| 451 | void EmitSelectF64(EmitContext& ctx, std::string_view cond, std::string_view true_value, | ||
| 452 | std::string_view false_value) { | ||
| 453 | NotImplemented(); | ||
| 454 | } | ||
| 455 | |||
| 456 | void EmitPackUint2x32(EmitContext& ctx, std::string_view value) { | 416 | void EmitPackUint2x32(EmitContext& ctx, std::string_view value) { |
| 457 | NotImplemented(); | 417 | NotImplemented(); |
| 458 | } | 418 | } |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp index e69de29bb..636cbe8a0 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string_view> | ||
| 6 | |||
| 7 | #include "shader_recompiler/backend/glasm/emit_context.h" | ||
| 8 | #include "shader_recompiler/backend/glasm/emit_glasm_instructions.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/value.h" | ||
| 10 | |||
| 11 | namespace Shader::Backend::GLASM { | ||
| 12 | |||
| 13 | void EmitSelectU1(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 14 | throw NotImplementedException("GLASM instruction"); | ||
| 15 | } | ||
| 16 | |||
| 17 | void EmitSelectU8(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 18 | throw NotImplementedException("GLASM instruction"); | ||
| 19 | } | ||
| 20 | |||
| 21 | void EmitSelectU16(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 22 | throw NotImplementedException("GLASM instruction"); | ||
| 23 | } | ||
| 24 | |||
| 25 | void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | ||
| 26 | std::string_view true_value, std::string_view false_value) { | ||
| 27 | ctx.Add("MOV.U.CC RC,{};", cond); | ||
| 28 | ctx.Add("IF NE.x;"); | ||
| 29 | ctx.Add("MOV.U {},{};", inst, true_value); | ||
| 30 | ctx.Add("ELSE;"); | ||
| 31 | ctx.Add("MOV.U {},{};", inst, false_value); | ||
| 32 | ctx.Add("ENDIF;"); | ||
| 33 | } | ||
| 34 | |||
| 35 | void EmitSelectU64(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 36 | throw NotImplementedException("GLASM instruction"); | ||
| 37 | } | ||
| 38 | |||
| 39 | void EmitSelectF16(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 40 | throw NotImplementedException("GLASM instruction"); | ||
| 41 | } | ||
| 42 | |||
| 43 | void EmitSelectF32(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 44 | throw NotImplementedException("GLASM instruction"); | ||
| 45 | } | ||
| 46 | |||
| 47 | void EmitSelectF64(EmitContext&, std::string_view, std::string_view, std::string_view) { | ||
| 48 | throw NotImplementedException("GLASM instruction"); | ||
| 49 | } | ||
| 50 | } // namespace Shader::Backend::GLASM | ||