mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-27 14:31:21 -08:00
glasm: Reimplement bitwise ops and BFI/BFE
This commit is contained in:
parent
4502595bc2
commit
3e10709091
@ -185,10 +185,12 @@ void EmitCompositeInsertF64x4(EmitContext& ctx, Register composite, Register obj
|
||||
void EmitSelectU1(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
|
||||
void EmitSelectU8(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
|
||||
void EmitSelectU16(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
|
||||
void EmitSelectU32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
|
||||
void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, ScalarS32 cond, ScalarS32 true_value,
|
||||
ScalarS32 false_value);
|
||||
void EmitSelectU64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value);
|
||||
void EmitSelectF16(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value);
|
||||
void EmitSelectF32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value);
|
||||
void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, ScalarS32 cond, ScalarS32 true_value,
|
||||
ScalarS32 false_value);
|
||||
void EmitSelectF64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value);
|
||||
void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
|
||||
void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
|
||||
@ -313,15 +315,15 @@ void EmitShiftRightArithmetic64(EmitContext& ctx, Register base, Register shift)
|
||||
void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
|
||||
void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
|
||||
void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b);
|
||||
void EmitBitFieldInsert(EmitContext& ctx, ScalarS32 base, ScalarS32 insert, ScalarS32 offset,
|
||||
ScalarS32 count);
|
||||
void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, ScalarS32 base, ScalarS32 insert,
|
||||
ScalarS32 offset, ScalarS32 count);
|
||||
void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, ScalarS32 base, ScalarS32 offset,
|
||||
ScalarS32 count);
|
||||
void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, ScalarU32 base, ScalarU32 offset,
|
||||
ScalarU32 count);
|
||||
void EmitBitReverse32(EmitContext& ctx, ScalarS32 value);
|
||||
void EmitBitReverse32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value);
|
||||
void EmitBitCount32(EmitContext& ctx, ScalarS32 value);
|
||||
void EmitBitwiseNot32(EmitContext& ctx, ScalarS32 value);
|
||||
void EmitBitwiseNot32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value);
|
||||
void EmitFindSMsb32(EmitContext& ctx, ScalarS32 value);
|
||||
void EmitFindUMsb32(EmitContext& ctx, ScalarU32 value);
|
||||
void EmitSMin32(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
|
||||
@ -330,16 +332,16 @@ void EmitSMax32(EmitContext& ctx, ScalarS32 a, ScalarS32 b);
|
||||
void EmitUMax32(EmitContext& ctx, ScalarU32 a, ScalarU32 b);
|
||||
void EmitSClamp32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value, ScalarS32 min, ScalarS32 max);
|
||||
void EmitUClamp32(EmitContext& ctx, IR::Inst& inst, ScalarU32 value, ScalarU32 min, ScalarU32 max);
|
||||
void EmitSLessThan(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitULessThan(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitIEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitSLessThanEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitULessThanEqual(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitSGreaterThan(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitUGreaterThan(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitINotEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitSGreaterThanEqual(EmitContext& ctx, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitUGreaterThanEqual(EmitContext& ctx, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitSLessThan(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitULessThan(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitIEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitSLessThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitULessThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitSGreaterThan(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitUGreaterThan(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitINotEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitSGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs);
|
||||
void EmitUGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs);
|
||||
void EmitSharedAtomicIAdd32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
|
||||
void EmitSharedAtomicSMin32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarS32 value);
|
||||
void EmitSharedAtomicUMin32(EmitContext& ctx, ScalarU32 pointer_offset, ScalarU32 value);
|
||||
|
@ -87,34 +87,34 @@ void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b
|
||||
ctx.Add("XOR.S {}.x,{},{};", inst, a, b);
|
||||
}
|
||||
|
||||
void EmitBitFieldInsert([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 base,
|
||||
[[maybe_unused]] ScalarS32 insert, [[maybe_unused]] ScalarS32 offset,
|
||||
[[maybe_unused]] ScalarS32 count) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, ScalarS32 base, ScalarS32 insert,
|
||||
ScalarS32 offset, ScalarS32 count) {
|
||||
ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
|
||||
ctx.Add("BFI.S {},RC,{},{};", inst, insert, base);
|
||||
}
|
||||
|
||||
void EmitBitFieldSExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
|
||||
[[maybe_unused]] ScalarS32 base, [[maybe_unused]] ScalarS32 offset,
|
||||
[[maybe_unused]] ScalarS32 count) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitBitFieldSExtract(EmitContext& ctx, IR::Inst& inst, ScalarS32 base, ScalarS32 offset,
|
||||
ScalarS32 count) {
|
||||
ctx.Add("MOV.U RC.x,{};MOV.U RC.y,{};", count, offset);
|
||||
ctx.Add("BFE.S {},RC,{};", inst, base);
|
||||
}
|
||||
|
||||
void EmitBitFieldUExtract([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,
|
||||
[[maybe_unused]] ScalarU32 base, [[maybe_unused]] ScalarU32 offset,
|
||||
[[maybe_unused]] ScalarU32 count) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitBitFieldUExtract(EmitContext& ctx, IR::Inst& inst, ScalarU32 base, ScalarU32 offset,
|
||||
ScalarU32 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]] ScalarS32 value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitBitReverse32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value) {
|
||||
ctx.Add("BFR {},{};", inst, value);
|
||||
}
|
||||
|
||||
void EmitBitCount32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitBitwiseNot32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitBitwiseNot32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value) {
|
||||
ctx.Add("NOT.S {},{};", inst, value);
|
||||
}
|
||||
|
||||
void EmitFindSMsb32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 value) {
|
||||
@ -157,54 +157,44 @@ void EmitUClamp32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst&
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitSLessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
|
||||
[[maybe_unused]] ScalarS32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitSLessThan(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs) {
|
||||
ctx.Add("SLT.S {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitULessThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
|
||||
[[maybe_unused]] ScalarU32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitULessThan(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs) {
|
||||
ctx.Add("SLT.U {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitIEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
|
||||
[[maybe_unused]] ScalarS32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitIEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs) {
|
||||
ctx.Add("SEQ.S {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitSLessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
|
||||
[[maybe_unused]] ScalarS32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitSLessThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs) {
|
||||
ctx.Add("SLE.S {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitULessThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
|
||||
[[maybe_unused]] ScalarU32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitULessThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs) {
|
||||
ctx.Add("SLE.U {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitSGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
|
||||
[[maybe_unused]] ScalarS32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitSGreaterThan(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs) {
|
||||
ctx.Add("SGT.S {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitUGreaterThan([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
|
||||
[[maybe_unused]] ScalarU32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitUGreaterThan(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs) {
|
||||
ctx.Add("SGT.U {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitINotEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
|
||||
[[maybe_unused]] ScalarS32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitINotEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs) {
|
||||
ctx.Add("SNE.U {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitSGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 lhs,
|
||||
[[maybe_unused]] ScalarS32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitSGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarS32 lhs, ScalarS32 rhs) {
|
||||
ctx.Add("SGE.S {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
void EmitUGreaterThanEqual([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarU32 lhs,
|
||||
[[maybe_unused]] ScalarU32 rhs) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
void EmitUGreaterThanEqual(EmitContext& ctx, IR::Inst& inst, ScalarU32 lhs, ScalarU32 rhs) {
|
||||
ctx.Add("SGE.U {},{},{};", inst, lhs, rhs);
|
||||
}
|
||||
|
||||
} // namespace Shader::Backend::GLASM
|
||||
|
@ -249,35 +249,11 @@ void EmitWriteSharedU128(EmitContext& ctx, ScalarU32 offset, Register value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectU1(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
|
||||
void EmitPackDouble2x32(EmitContext& ctx, Register value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectU8(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectU16(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectU32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectU64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectF16(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectF32(EmitContext& ctx, ScalarS32 cond, ScalarS32 true_value, ScalarS32 false_value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
void EmitSelectF64(EmitContext& ctx, ScalarS32 cond, Register true_value, Register false_value) {
|
||||
void EmitUnpackDouble2x32(EmitContext& ctx, Register value) {
|
||||
NotImplemented();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
|
||||
// Copyright 2021 yuzu Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#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([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond,
|
||||
[[maybe_unused]] ScalarS32 true_value, [[maybe_unused]] ScalarS32 false_value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitSelectU8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond,
|
||||
[[maybe_unused]] ScalarS32 true_value, [[maybe_unused]] ScalarS32 false_value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond,
|
||||
[[maybe_unused]] ScalarS32 true_value, [[maybe_unused]] ScalarS32 false_value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, ScalarS32 cond, ScalarS32 true_value,
|
||||
ScalarS32 false_value) {
|
||||
ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value);
|
||||
}
|
||||
|
||||
void EmitSelectU64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond,
|
||||
[[maybe_unused]] Register true_value, [[maybe_unused]] Register false_value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond,
|
||||
[[maybe_unused]] Register true_value, [[maybe_unused]] Register false_value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, ScalarS32 cond, ScalarS32 true_value,
|
||||
ScalarS32 false_value) {
|
||||
ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value);
|
||||
}
|
||||
|
||||
void EmitSelectF64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] ScalarS32 cond,
|
||||
[[maybe_unused]] Register true_value, [[maybe_unused]] Register false_value) {
|
||||
throw NotImplementedException("GLASM instruction");
|
||||
}
|
||||
|
||||
} // namespace Shader::Backend::GLASM
|
Loading…
Reference in New Issue
Block a user