mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-09 13:19:00 +00:00
Implement V_CMP_GT_U64 (#3352)
* Implement V_CMP_GT_U64 * Add GroupAny * Use GroupAny * Add assert * clang
This commit is contained in:
@@ -536,6 +536,7 @@ Id EmitReadLane(EmitContext& ctx, Id value, Id lane);
|
||||
Id EmitWriteLane(EmitContext& ctx, Id value, Id write_value, u32 lane);
|
||||
Id EmitBallot(EmitContext& ctx, Id bit);
|
||||
Id EmitBallotFindLsb(EmitContext& ctx, Id mask);
|
||||
Id EmitGroupAny(EmitContext& ctx, Id bit);
|
||||
Id EmitDataAppend(EmitContext& ctx, u32 gds_addr, u32 binding);
|
||||
Id EmitDataConsume(EmitContext& ctx, u32 gds_addr, u32 binding);
|
||||
|
||||
|
||||
@@ -42,4 +42,8 @@ Id EmitBallotFindLsb(EmitContext& ctx, Id mask) {
|
||||
return ctx.OpGroupNonUniformBallotFindLSB(ctx.U32[1], SubgroupScope(ctx), mask);
|
||||
}
|
||||
|
||||
Id EmitGroupAny(EmitContext& ctx, Id bit) {
|
||||
return ctx.OpGroupNonUniformAny(ctx.U1[1], SubgroupScope(ctx), bit);
|
||||
}
|
||||
|
||||
} // namespace Shader::Backend::SPIRV
|
||||
|
||||
@@ -331,6 +331,8 @@ void Translator::EmitVectorAlu(const GcnInst& inst) {
|
||||
return V_CMP_U64(ConditionOp::EQ, false, false, inst);
|
||||
case Opcode::V_CMP_NE_U64:
|
||||
return V_CMP_U64(ConditionOp::LG, false, false, inst);
|
||||
case Opcode::V_CMP_GT_U64:
|
||||
return V_CMP_U64(ConditionOp::GT, false, false, inst);
|
||||
|
||||
case Opcode::V_CMP_CLASS_F32:
|
||||
return V_CMP_CLASS_F32(inst);
|
||||
@@ -1020,6 +1022,12 @@ void Translator::V_CMP_U64(ConditionOp op, bool is_signed, bool set_exec, const
|
||||
return ir.IEqual(src0, src1);
|
||||
case ConditionOp::LG: // NE
|
||||
return ir.INotEqual(src0, src1);
|
||||
case ConditionOp::GT:
|
||||
if (src1.IsImmediate() && src1.U64() == 0) {
|
||||
ASSERT(inst.src[0].field == OperandField::ScalarGPR);
|
||||
return ir.GroupAny(ir.GetThreadBitScalarReg(IR::ScalarReg(inst.src[0].code)));
|
||||
}
|
||||
return ir.IGreaterThan(src0, src1, is_signed);
|
||||
default:
|
||||
UNREACHABLE_MSG("Unsupported V_CMP_U64 condition operation: {}", u32(op));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <source_location>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include "common/assert.h"
|
||||
#include "ir_emitter.h"
|
||||
#include "shader_recompiler/exception.h"
|
||||
#include "shader_recompiler/ir/debug_print.h"
|
||||
#include "shader_recompiler/ir/ir_emitter.h"
|
||||
@@ -668,6 +669,10 @@ U32 IREmitter::BallotFindLsb(const Value& mask) {
|
||||
return Inst<U32>(Opcode::BallotFindLsb, mask);
|
||||
}
|
||||
|
||||
U1 IREmitter::GroupAny(const U1& bit) {
|
||||
return Inst<U1>(Opcode::GroupAny, bit);
|
||||
}
|
||||
|
||||
F32F64 IREmitter::FPAdd(const F32F64& a, const F32F64& b) {
|
||||
if (a.Type() != b.Type()) {
|
||||
UNREACHABLE_MSG("Mismatching types {} and {}", a.Type(), b.Type());
|
||||
|
||||
@@ -177,6 +177,7 @@ public:
|
||||
[[nodiscard]] U32 WriteLane(const U32& value, const U32& write_value, const U32& lane);
|
||||
[[nodiscard]] Value Ballot(const U1& bit);
|
||||
[[nodiscard]] U32 BallotFindLsb(const Value& mask);
|
||||
[[nodiscard]] U1 GroupAny(const U1& bit);
|
||||
|
||||
[[nodiscard]] Value CompositeConstruct(const Value& e1, const Value& e2);
|
||||
[[nodiscard]] Value CompositeConstruct(const Value& e1, const Value& e2, const Value& e3);
|
||||
|
||||
@@ -479,3 +479,4 @@ OPCODE(Ballot, U32x4, U1,
|
||||
OPCODE(BallotFindLsb, U32, U32x4, )
|
||||
OPCODE(DataAppend, U32, U32, U32 )
|
||||
OPCODE(DataConsume, U32, U32, U32 )
|
||||
OPCODE(GroupAny, U1, U1, )
|
||||
|
||||
Reference in New Issue
Block a user