Shader_IR: Implement FLO instruction.
This commit is contained in:
parent
95137a04e1
commit
f3d1b370aa
@ -799,6 +799,12 @@ union Instruction {
|
|||||||
BitField<40, 1, u64> invert;
|
BitField<40, 1, u64> invert;
|
||||||
} popc;
|
} popc;
|
||||||
|
|
||||||
|
union {
|
||||||
|
BitField<41, 1, u64> sh;
|
||||||
|
BitField<40, 1, u64> invert;
|
||||||
|
BitField<48, 1, u64> is_signed;
|
||||||
|
} flo;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
BitField<39, 3, u64> pred;
|
BitField<39, 3, u64> pred;
|
||||||
BitField<42, 1, u64> neg_pred;
|
BitField<42, 1, u64> neg_pred;
|
||||||
|
@ -1472,6 +1472,11 @@ private:
|
|||||||
return GenerateUnary(operation, "bitCount", type, type);
|
return GenerateUnary(operation, "bitCount", type, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <Type type>
|
||||||
|
Expression BitMSB(Operation operation) {
|
||||||
|
return GenerateUnary(operation, "findMSB", type, type);
|
||||||
|
}
|
||||||
|
|
||||||
Expression HNegate(Operation operation) {
|
Expression HNegate(Operation operation) {
|
||||||
const auto GetNegate = [&](std::size_t index) {
|
const auto GetNegate = [&](std::size_t index) {
|
||||||
return VisitOperand(operation, index).AsBool() + " ? -1 : 1";
|
return VisitOperand(operation, index).AsBool() + " ? -1 : 1";
|
||||||
@ -2043,6 +2048,7 @@ private:
|
|||||||
&GLSLDecompiler::BitfieldInsert<Type::Int>,
|
&GLSLDecompiler::BitfieldInsert<Type::Int>,
|
||||||
&GLSLDecompiler::BitfieldExtract<Type::Int>,
|
&GLSLDecompiler::BitfieldExtract<Type::Int>,
|
||||||
&GLSLDecompiler::BitCount<Type::Int>,
|
&GLSLDecompiler::BitCount<Type::Int>,
|
||||||
|
&GLSLDecompiler::BitMSB<Type::Int>,
|
||||||
|
|
||||||
&GLSLDecompiler::Add<Type::Uint>,
|
&GLSLDecompiler::Add<Type::Uint>,
|
||||||
&GLSLDecompiler::Mul<Type::Uint>,
|
&GLSLDecompiler::Mul<Type::Uint>,
|
||||||
@ -2061,6 +2067,7 @@ private:
|
|||||||
&GLSLDecompiler::BitfieldInsert<Type::Uint>,
|
&GLSLDecompiler::BitfieldInsert<Type::Uint>,
|
||||||
&GLSLDecompiler::BitfieldExtract<Type::Uint>,
|
&GLSLDecompiler::BitfieldExtract<Type::Uint>,
|
||||||
&GLSLDecompiler::BitCount<Type::Uint>,
|
&GLSLDecompiler::BitCount<Type::Uint>,
|
||||||
|
&GLSLDecompiler::BitMSB<Type::Uint>,
|
||||||
|
|
||||||
&GLSLDecompiler::Add<Type::HalfFloat>,
|
&GLSLDecompiler::Add<Type::HalfFloat>,
|
||||||
&GLSLDecompiler::Mul<Type::HalfFloat>,
|
&GLSLDecompiler::Mul<Type::HalfFloat>,
|
||||||
|
@ -1390,6 +1390,7 @@ private:
|
|||||||
&SPIRVDecompiler::Quaternary<&Module::OpBitFieldInsert, Type::Int>,
|
&SPIRVDecompiler::Quaternary<&Module::OpBitFieldInsert, Type::Int>,
|
||||||
&SPIRVDecompiler::Ternary<&Module::OpBitFieldSExtract, Type::Int>,
|
&SPIRVDecompiler::Ternary<&Module::OpBitFieldSExtract, Type::Int>,
|
||||||
&SPIRVDecompiler::Unary<&Module::OpBitCount, Type::Int>,
|
&SPIRVDecompiler::Unary<&Module::OpBitCount, Type::Int>,
|
||||||
|
&SPIRVDecompiler::Unary<&Module::OpFindSMsb, Type::Int>,
|
||||||
|
|
||||||
&SPIRVDecompiler::Binary<&Module::OpIAdd, Type::Uint>,
|
&SPIRVDecompiler::Binary<&Module::OpIAdd, Type::Uint>,
|
||||||
&SPIRVDecompiler::Binary<&Module::OpIMul, Type::Uint>,
|
&SPIRVDecompiler::Binary<&Module::OpIMul, Type::Uint>,
|
||||||
@ -1408,6 +1409,7 @@ private:
|
|||||||
&SPIRVDecompiler::Quaternary<&Module::OpBitFieldInsert, Type::Uint>,
|
&SPIRVDecompiler::Quaternary<&Module::OpBitFieldInsert, Type::Uint>,
|
||||||
&SPIRVDecompiler::Ternary<&Module::OpBitFieldUExtract, Type::Uint>,
|
&SPIRVDecompiler::Ternary<&Module::OpBitFieldUExtract, Type::Uint>,
|
||||||
&SPIRVDecompiler::Unary<&Module::OpBitCount, Type::Uint>,
|
&SPIRVDecompiler::Unary<&Module::OpBitCount, Type::Uint>,
|
||||||
|
&SPIRVDecompiler::Unary<&Module::OpFindUMsb, Type::Uint>,
|
||||||
|
|
||||||
&SPIRVDecompiler::Binary<&Module::OpFAdd, Type::HalfFloat>,
|
&SPIRVDecompiler::Binary<&Module::OpFAdd, Type::HalfFloat>,
|
||||||
&SPIRVDecompiler::Binary<&Module::OpFMul, Type::HalfFloat>,
|
&SPIRVDecompiler::Binary<&Module::OpFMul, Type::HalfFloat>,
|
||||||
|
@ -130,6 +130,24 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) {
|
|||||||
SetRegister(bb, instr.gpr0, value);
|
SetRegister(bb, instr.gpr0, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case OpCode::Id::FLO_R:
|
||||||
|
case OpCode::Id::FLO_C:
|
||||||
|
case OpCode::Id::FLO_IMM: {
|
||||||
|
Node value;
|
||||||
|
if (instr.flo.invert) {
|
||||||
|
op_b = Operation(OperationCode::IBitwiseNot, NO_PRECISE, op_b);
|
||||||
|
}
|
||||||
|
if (instr.flo.is_signed) {
|
||||||
|
value = Operation(OperationCode::IBitMSB, NO_PRECISE, op_b);
|
||||||
|
} else {
|
||||||
|
value = Operation(OperationCode::UBitMSB, NO_PRECISE, op_b);
|
||||||
|
}
|
||||||
|
if (instr.flo.sh) {
|
||||||
|
value = Operation(OperationCode::UBitwiseXor, NO_PRECISE, value, Immediate(31));
|
||||||
|
}
|
||||||
|
SetRegister(bb, instr.gpr0, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case OpCode::Id::SEL_C:
|
case OpCode::Id::SEL_C:
|
||||||
case OpCode::Id::SEL_R:
|
case OpCode::Id::SEL_R:
|
||||||
case OpCode::Id::SEL_IMM: {
|
case OpCode::Id::SEL_IMM: {
|
||||||
|
@ -68,6 +68,7 @@ enum class OperationCode {
|
|||||||
IBitfieldInsert, /// (MetaArithmetic, int base, int insert, int offset, int bits) -> int
|
IBitfieldInsert, /// (MetaArithmetic, int base, int insert, int offset, int bits) -> int
|
||||||
IBitfieldExtract, /// (MetaArithmetic, int value, int offset, int offset) -> int
|
IBitfieldExtract, /// (MetaArithmetic, int value, int offset, int offset) -> int
|
||||||
IBitCount, /// (MetaArithmetic, int) -> int
|
IBitCount, /// (MetaArithmetic, int) -> int
|
||||||
|
IBitMSB, /// (MetaArithmetic, int) -> int
|
||||||
|
|
||||||
UAdd, /// (MetaArithmetic, uint a, uint b) -> uint
|
UAdd, /// (MetaArithmetic, uint a, uint b) -> uint
|
||||||
UMul, /// (MetaArithmetic, uint a, uint b) -> uint
|
UMul, /// (MetaArithmetic, uint a, uint b) -> uint
|
||||||
@ -86,6 +87,7 @@ enum class OperationCode {
|
|||||||
UBitfieldInsert, /// (MetaArithmetic, uint base, uint insert, int offset, int bits) -> uint
|
UBitfieldInsert, /// (MetaArithmetic, uint base, uint insert, int offset, int bits) -> uint
|
||||||
UBitfieldExtract, /// (MetaArithmetic, uint value, int offset, int offset) -> uint
|
UBitfieldExtract, /// (MetaArithmetic, uint value, int offset, int offset) -> uint
|
||||||
UBitCount, /// (MetaArithmetic, uint) -> uint
|
UBitCount, /// (MetaArithmetic, uint) -> uint
|
||||||
|
UBitMSB, /// (MetaArithmetic, uint) -> uint
|
||||||
|
|
||||||
HAdd, /// (MetaArithmetic, f16vec2 a, f16vec2 b) -> f16vec2
|
HAdd, /// (MetaArithmetic, f16vec2 a, f16vec2 b) -> f16vec2
|
||||||
HMul, /// (MetaArithmetic, f16vec2 a, f16vec2 b) -> f16vec2
|
HMul, /// (MetaArithmetic, f16vec2 a, f16vec2 b) -> f16vec2
|
||||||
|
Loading…
Reference in New Issue
Block a user