glasm: Implement BFI, BFE

Along with implementations of common instructions along the way
This commit is contained in:
ameerj 2021-05-08 18:50:10 -04:00
parent 3e841f6441
commit 941c6dc740
4 changed files with 178 additions and 152 deletions

View File

@ -208,8 +208,8 @@ void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true
std::string_view false_value);
void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value);
void EmitSelectU32(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value);
void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
std::string_view true_value, std::string_view false_value);
void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value);
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);
void EmitFPIsNan32(EmitContext& ctx, std::string_view value);
void EmitFPIsNan64(EmitContext& ctx, std::string_view value);
void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitIAdd64(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitISub32(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitISub64(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitIMul32(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitINeg32(EmitContext& ctx, std::string_view value);
void EmitINeg64(EmitContext& ctx, std::string_view value);
void EmitIAbs32(EmitContext& ctx, std::string_view value);
void EmitIAbs64(EmitContext& ctx, std::string_view value);
void EmitIAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitISub32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitISub64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitIMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitINeg32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitINeg64(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitIAbs32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitIAbs64(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitShiftLeftLogical32(EmitContext& ctx, std::string_view base, std::string_view shift);
void EmitShiftLeftLogical64(EmitContext& ctx, std::string_view base, std::string_view shift);
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
void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitBitFieldInsert(EmitContext& ctx, std::string_view base, std::string_view insert,
std::string_view offset, std::string_view count);
void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base,
std::string_view insert, std::string_view offset, std::string_view count);
void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
std::string_view offset, std::string_view count);
void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
std::string_view offset, std::string_view count);
void EmitBitReverse32(EmitContext& ctx, std::string_view value);
void EmitBitCount32(EmitContext& ctx, std::string_view value);
void EmitBitwiseNot32(EmitContext& ctx, std::string_view value);
void EmitFindSMsb32(EmitContext& ctx, std::string_view value);
void EmitFindUMsb32(EmitContext& ctx, std::string_view value);
void EmitSMin32(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitUMin32(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitSMax32(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitUMax32(EmitContext& ctx, std::string_view a, std::string_view b);
void EmitBitReverse32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitBitCount32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitBitwiseNot32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitFindSMsb32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitFindUMsb32(EmitContext& ctx, IR::Inst& inst, std::string_view value);
void EmitSMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitUMin32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitSMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitUMax32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b);
void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min,
std::string_view max);
void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, std::string_view value, std::string_view min,
std::string_view max);
void EmitSLessThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitULessThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitIEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitSLessThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitULessThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitSGreaterThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitUGreaterThan(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitINotEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitSGreaterThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitUGreaterThanEqual(EmitContext& ctx, std::string_view lhs, std::string_view rhs);
void EmitSLessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
void EmitULessThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
void EmitIEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
void EmitSLessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs);
void EmitULessThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs);
void EmitSGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
void EmitUGreaterThan(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
void EmitINotEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string_view rhs);
void EmitSGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs);
void EmitUGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, std::string_view lhs,
std::string_view rhs);
void EmitSharedAtomicIAdd32(EmitContext& ctx, std::string_view pointer_offset,
std::string_view value);
void EmitSharedAtomicSMin32(EmitContext& ctx, std::string_view pointer_offset,

View File

@ -12,42 +12,46 @@ namespace Shader::Backend::GLASM {
void EmitIAdd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
ctx.Add("ADD {},{},{};", inst, a, b);
}
void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitIAdd64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
ctx.Add("SUB {},{},{};", inst, a, b);
}
void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitISub32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitISub64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitIMul32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitINeg32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitINeg64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitIAbs32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
void EmitIAbs64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
@ -94,7 +98,7 @@ void EmitBitwiseAnd32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In
void EmitBitwiseOr32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
ctx.Add("OR {},{},{};", inst, a, b);
}
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
throw NotImplementedException("GLASM instruction");
}
void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view base,
[[maybe_unused]] std::string_view insert,
[[maybe_unused]] std::string_view offset,
[[maybe_unused]] std::string_view count) {
void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base,
std::string_view insert, std::string_view offset, std::string_view count) {
ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
ctx.Add("BFI.U {},RC,{},{};", inst, insert, base);
}
void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
std::string_view offset, std::string_view count) {
ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
ctx.Add("BFE.S {},RC,{};", inst, base);
}
void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, std::string_view base,
std::string_view offset, std::string_view count) {
ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
ctx.Add("BFE.U {},RC,{};", inst, base);
}
void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
ctx.Add("BFR {},{};", inst, value);
}
void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view base,
[[maybe_unused]] std::string_view offset,
[[maybe_unused]] std::string_view count) {
void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view base,
[[maybe_unused]] std::string_view offset,
[[maybe_unused]] std::string_view count) {
void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitBitReverse32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitFindUMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view value) {
throw NotImplementedException("GLASM instruction");
}
void EmitSMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitUMin32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitSMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view a,
[[maybe_unused]] std::string_view b) {
void EmitUMax32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view a, [[maybe_unused]] std::string_view b) {
throw NotImplementedException("GLASM instruction");
}
@ -175,54 +181,60 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst&
throw NotImplementedException("GLASM instruction");
}
void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
ctx.Add("SLT.S {},{},{};", inst, lhs, rhs);
}
void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
ctx.Add("SLT.U {},{},{};", inst, lhs, rhs);
}
void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
ctx.Add("SEQ {},{},{};", inst, lhs, rhs);
}
void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
ctx.Add("SLE.S {},{},{};", inst, lhs, rhs);
}
void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
ctx.Add("SLE.U {},{},{};", inst, lhs, rhs);
}
void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
ctx.Add("SGT.S {},{},{};", inst, lhs, rhs);
}
void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
ctx.Add("SGT.U {},{},{};", inst, lhs, rhs);
}
void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs, [[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
ctx.Add("SGE.S {},{},{};", inst, lhs, rhs);
}
void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
[[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
}
void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view lhs,
[[maybe_unused]] std::string_view rhs) {
throw NotImplementedException("GLASM instruction");
ctx.Add("SGE.U {},{},{};", inst, lhs, rhs);
}
} // namespace Shader::Backend::GLASM

View File

@ -413,46 +413,6 @@ void EmitCompositeInsertF64x4(EmitContext& ctx, std::string_view composite, std:
NotImplemented();
}
void EmitSelectU1(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectU8(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectU16(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectU32(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectU64(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectF16(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectF32(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitSelectF64(EmitContext& ctx, std::string_view cond, std::string_view true_value,
std::string_view false_value) {
NotImplemented();
}
void EmitPackUint2x32(EmitContext& ctx, std::string_view value) {
NotImplemented();
}

View File

@ -0,0 +1,50 @@
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <string_view>
#include "shader_recompiler/backend/glasm/emit_context.h"
#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
#include "shader_recompiler/frontend/ir/value.h"
namespace Shader::Backend::GLASM {
void EmitSelectU1(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
void EmitSelectU8(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
void EmitSelectU16(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
std::string_view true_value, std::string_view false_value) {
ctx.Add("MOV.U.CC RC,{};", cond);
ctx.Add("IF NE.x;");
ctx.Add("MOV.U {},{};", inst, true_value);
ctx.Add("ELSE;");
ctx.Add("MOV.U {},{};", inst, false_value);
ctx.Add("ENDIF;");
}
void EmitSelectU64(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
void EmitSelectF16(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
void EmitSelectF32(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
void EmitSelectF64(EmitContext&, std::string_view, std::string_view, std::string_view) {
throw NotImplementedException("GLASM instruction");
}
} // namespace Shader::Backend::GLASM