Skip to content

Commit

Permalink
gpu: shader: fix s_mulk_i32, implement s_addk_i32
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Nov 15, 2024
1 parent ab716b7 commit 315864a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion rpcsx/gpu/lib/gcn-shader/shaders/rdna.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,13 @@ int64_t s_ashr_i64(int64_t x, uint32_t y) { int64_t result = x >> (y & 0x3f); sc
uint32_t s_bfm_b32(uint32_t x, uint32_t y) { uint32_t result = ((1 << (x & 0x1f)) - 1) << (y & 0x1f); scc = result != 0; return result; }
uint64_t s_bfm_b64(uint64_t x, uint64_t y) { uint64_t result = ((uint64_t(1) << (x & 0x1f)) - 1) << (y & 0x1f); scc = result != 0; return result; }
int32_t s_mul_i32(int32_t x, int32_t y) { return x * y; }
int32_t s_mulk_i32(int32_t x, int32_t y) { return x * y; }
void s_mulk_i32(inout int32_t x, int32_t y) { x = x * y; }
void s_addk_i32(inout int32_t x, int32_t y) {
int32_t result = x + y;
scc = sign(x) == sign(y) && sign(result) != sign(x);
x = result;
}

int32_t s_abs_i32(int32_t x) {
int32_t result = abs(x);
scc = result == 0;
Expand Down
4 changes: 2 additions & 2 deletions rpcsx/gpu/lib/gcn-shader/src/GcnConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ static void instructionsToSpv(GcnConverter &converter, gcn::Import &importer,
semanticModuleInfo.findSemanticOf(inst.getInstId()) == nullptr) {
std::println(std::cerr, "unimplemented semantic: ");
inst.print(std::cerr, context.ns);
std::println(std::cerr);
std::println(std::cerr, "\n");

std::vector<ir::Instruction> workList;
std::set<ir::Instruction> removed;
Expand All @@ -1202,7 +1202,7 @@ static void instructionsToSpv(GcnConverter &converter, gcn::Import &importer,

std::println(std::cerr, "removing ");
inst.print(std::cerr, context.ns);
std::println(std::cerr);
std::println(std::cerr, "\n");

if (auto value = inst.cast<ir::Value>()) {
for (auto &use : value.getUseList()) {
Expand Down

0 comments on commit 315864a

Please sign in to comment.