Skip to content

Conversation

@cadmic
Copy link
Contributor

@cadmic cadmic commented Feb 24, 2025

Note that there can't be MEM_S64/MEM_U64 macros because the two halves of the 64-bit value would be in the wrong order.

(also fixed swl to be one line because that's what // fdead and // bdead expect)

Copy link
Contributor

@AngheloAlf AngheloAlf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think every comment I left can be answered with "the codebase is already doing this weird thing".

Either way, the PR looks good!

case rabbitizer::InstrId::UniqueId::cpu_lbu:
case rabbitizer::InstrId::UniqueId::cpu_ld:
case rabbitizer::InstrId::UniqueId::cpu_ldl:
// case rabbitizer::InstrId::UniqueId::cpu_ldr:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same treatment as lwr, gotcha

case rabbitizer::InstrId::UniqueId::cpu_sb:
case rabbitizer::InstrId::UniqueId::cpu_sd:
case rabbitizer::InstrId::UniqueId::cpu_sdl:
// case rabbitizer::InstrId::UniqueId::cpu_sdr:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

case rabbitizer::InstrId::UniqueId::cpu_dsub:
case rabbitizer::InstrId::UniqueId::cpu_dsubu:
if (insn.instruction.GetO32_rs() == rabbitizer::Registers::Cpu::GprO32::GPR_O32_zero) {
printf("%s = -%s;\n", r((int)insn.instruction.GetO32_rd()), r((int)insn.instruction.GetO32_rt()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually implementing negu, I see

Comment on lines +2744 to +2749
printf("%s = %s + %d; ", reg, r((int)insn.instruction.GetO32_rs()), imm);
printf("%s = ((uint64_t)MEM_U8(%s) << 56) | ((uint64_t)MEM_U8(%s + 1) << 48) | "
"((uint64_t)MEM_U8(%s + 2) << 40) | ((uint64_t)MEM_U8(%s + 3) << 32) | "
"((uint64_t)MEM_U8(%s + 4) << 24) | ((uint64_t)MEM_U8(%s + 5) << 16) | "
"((uint64_t)MEM_U8(%s + 6) << 8) | (uint64_t)MEM_U8(%s + 7);\n",
reg, reg, reg, reg, reg, reg, reg, reg, reg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting implementation.
So just assume every ldl will have a corresponding ldr?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Oh, that's what recomp is already doing for lwl/lwr... huh. This should be fine I guess

Comment on lines +2899 to +2902
for (int j = 0; j < 8; j++) {
printf("MEM_U8(%s + %d + %d) = (uint8_t)(%s >> %d); ", r((int)insn.instruction.GetO32_rs()), imm, j,
r((int)insn.instruction.GetO32_rt()), (7 - j) * 8);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This codebase definitely has some interesting pieces of code. Inconsistent, but code

@AngheloAlf AngheloAlf merged commit d26c890 into decompals:main Feb 25, 2025
8 checks passed
@cadmic cadmic deleted the 64-bit-instructions branch February 25, 2025 15:39
cadmic added a commit to cadmic/ido-static-recomp that referenced this pull request Mar 19, 2025
AngheloAlf pushed a commit that referenced this pull request Mar 20, 2025
* Revert "Implement 64-bit instructions (#73)"

This reverts commit d26c890.

* Revert "Use 64-bit register values (#72)"

This reverts commit 44f94d9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants