mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
shader: implement s_bfe_i32
This commit is contained in:
@@ -11164,6 +11164,36 @@ TestCase ScalarBrevB32PreservesScc() {
|
||||
O::BufferStoreDword, O::SEndpgm}};
|
||||
}
|
||||
|
||||
TestCase ScalarBfeI32CapturedRawSignExtends() {
|
||||
using O = ShaderOpcode;
|
||||
|
||||
std::vector<u32> code;
|
||||
AppendBufferLoadDword(&code, 0, 30);
|
||||
code.push_back(EncodeVop1(0x02, 20, Vgpr(0)));
|
||||
code.push_back(0x946aff14u); // s_bfe_i32 vcc_lo, s20, literal
|
||||
code.push_back(0x0004001cu); // offset 28, width 4
|
||||
code.push_back(EncodeSop2(0x0a, 21, InlineU32(1), InlineU32(0)));
|
||||
code.push_back(EncodeSop2(0x28, 22, 20, 255u));
|
||||
code.push_back(0u); // zero width produces zero and clears SCC
|
||||
code.push_back(EncodeSop2(0x0a, 23, InlineU32(1), InlineU32(0)));
|
||||
AppendStoreSgpr(&code, 106, 1);
|
||||
AppendStoreSgpr(&code, 21, 2);
|
||||
AppendStoreSgpr(&code, 22, 3);
|
||||
AppendStoreSgpr(&code, 23, 4);
|
||||
AppendEnd(&code);
|
||||
|
||||
TestCase test;
|
||||
test.name = "ScalarBfeI32CapturedRawSignExtends";
|
||||
test.code = std::move(code);
|
||||
test.initial = {0xf0000000u, 0, 0, 0, 0};
|
||||
test.expected = {0xf0000000u, 0xffffffffu, 1, 0, 0};
|
||||
test.opcodes = {O::BufferLoadDword, O::VReadfirstlaneB32, O::SBfeI32,
|
||||
O::SCselectB32, O::VMovB32, O::BufferStoreDword,
|
||||
O::SEndpgm};
|
||||
test.required_spirv = {"OpBitFieldSExtract"};
|
||||
return test;
|
||||
}
|
||||
|
||||
TestCase BitfieldExtractWidthPastEndEdges() {
|
||||
using O = ShaderOpcode;
|
||||
|
||||
@@ -16981,6 +17011,7 @@ std::vector<TestCase> MakeCases() {
|
||||
AddCase(ScalarGetpcWritesNextInstructionPc);
|
||||
AddCase(ScalarBitfieldPack);
|
||||
AddCase(ScalarBrevB32PreservesScc);
|
||||
AddCase(ScalarBfeI32CapturedRawSignExtends);
|
||||
AddCase(BitfieldExtractWidthPastEndEdges);
|
||||
AddCase(Scalar64BitOps);
|
||||
AddCase(ScalarAndn2B64SccBranch);
|
||||
|
||||
@@ -3356,6 +3356,20 @@ void TestNewShaderDecoderArchitecture() {
|
||||
Check(literal.word_count == 2u && literal.src0.value == 0x12345678u,
|
||||
"single-instruction decoder lost a compact literal extension");
|
||||
|
||||
const uint32_t scalar_signed_bfe[] = {
|
||||
0x946aff14u, // s_bfe_i32 vcc_lo, s20, 0x0004001c
|
||||
0x0004001cu,
|
||||
};
|
||||
Instruction signed_bfe;
|
||||
Check(DecodeInstruction(scalar_signed_bfe, 0u, signed_bfe, &error),
|
||||
error.c_str());
|
||||
Check(signed_bfe.family == Family::SOP2 &&
|
||||
signed_bfe.opcode == Opcode::SBfeI32 &&
|
||||
signed_bfe.word_count == 2u &&
|
||||
signed_bfe.dst.kind == OperandKind::VccLo &&
|
||||
signed_bfe.src0.reg == 20u && signed_bfe.src1.value == 0x0004001cu,
|
||||
"decoder rejected or misdecoded captured S_BFE_I32 instruction");
|
||||
|
||||
const uint32_t mimg_nsa[] = {EncodeMimg0(0x20, 0xf) | (3u << 1u),
|
||||
EncodeMimg1(4, 0, 1, 8), 0x03020100u,
|
||||
0x07060504u, 0x0b0a0908u};
|
||||
|
||||
Reference in New Issue
Block a user