Skip to content

Commit

Permalink
implement vcmp comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Apr 19, 2024
1 parent 60ed8ce commit 1932266
Show file tree
Hide file tree
Showing 21 changed files with 4,926 additions and 4,535 deletions.
16 changes: 15 additions & 1 deletion adsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,20 @@ def do_vfp3_vcmp():
print(f" .word 0x{VFPU3:08X} | 0x{vfpu0_fmt_tp(i):08X} | 0x{VT:08X} | 0x{VS:08X} | 0x{cond:08X}")
func_end("vcmp_all")

def do_vfp3_vcmp_zero():
func_start("vcmp_zero")
print(" # vcmp zero")

VT = vt(0)
VS = vs(0)

i = 0

for cond in range(1<<4):
for i in range(4):
print(f" .word 0x{VFPU3:08X} | 0x{vfpu0_fmt_tp(i):08X} | 0x{VT:08X} | 0x{VS:08X} | 0x{cond:08X}")
func_end("vcmp_zero")

def do_vfp4_fmt0():
func_start("vfpu4_fmt0_all")
print(" # VFPU4 FMT0")
Expand Down Expand Up @@ -220,4 +234,4 @@ def do_vfpu6():
print(f" .word 0x{VFPU6:08X} | 0x{i << 23:08X} | 0x{VT:08X} | 0x{t << 15:08X} | 0x{VS:08X} | 0x{p << 7:08X} | 0x{VD:08X}")
func_end("vfpu6_all")

do_vfpu6()
do_vfp3_vcmp_zero()
342 changes: 1 addition & 341 deletions asdf.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions cplusplus/include/generated/OperandType_enum_class.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions include/generated/InstrDescriptor_Descriptors_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions include/generated/OperandType_enum.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions include/generated/OperandType_function_declarations.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions include/generated/instrOpercandCallbacks_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions include/instructions/RabbitizerInstructionR4000Allegrex.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ extern "C" {
#define RAB_INSTR_R4000ALLEGREX_GET_vfpu6_fmt7_fmt0_fmt(self) ((SHIFTR((self)->word, 16, 3) << 2) | (SHIFTR((self)->word, 15, 1) << 1) | (SHIFTR((self)->word, 7, 1)))
#define RAB_INSTR_R4000ALLEGREX_GET_vfpu7_fmt(self) (SHIFTR((self)->word, 0, 26))

#define RAB_INSTR_R4000ALLEGREX_GET_vcmp_cond(self) (SHIFTR((self)->word, 0, 4))


#define RAB_INSTR_R4000ALLEGREX_PACK_vt(word, value) (BITREPACK((word), (value), 16, 7))
#define RAB_INSTR_R4000ALLEGREX_PACK_vs(word, value) (BITREPACK((word), (value), 8, 7))
Expand Down Expand Up @@ -89,6 +91,8 @@ extern "C" {
#define RAB_INSTR_R4000ALLEGREX_PACK_vfpu6_fmt7_fmt0_fmt(word, value) (BITREPACK(BITREPACK(BITREPACK((word), (value) >> 2, 16, 3), (value) >> 1, 15, 1), (value), 7, 1))
#define RAB_INSTR_R4000ALLEGREX_PACK_vfpu7_fmt(word, value) (BITREPACK((word), (value), 0, 26))

#define RAB_INSTR_R4000ALLEGREX_PACK_vcmp_cond(word, value) (BITREPACK((word), (value), 0, 4))


NON_NULL(1)
void RabbitizerInstructionR4000Allegrex_init(RabbitizerInstruction *self, uint32_t word, uint32_t vram);
Expand Down
5 changes: 5 additions & 0 deletions rabbitizer/OperandType.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions rust/src/operand_type_enum.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions src/instructions/RabbitizerInstrDescriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,69 @@ bool RabbitizerInstrDescriptor_hasOperandAlias(const RabbitizerInstrDescriptor *
return true;
}
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond:
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond_s_maybe_vs_maybe_vt)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond_p_maybe_vs_maybe_vt)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond_t_maybe_vs_maybe_vt)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond_q_maybe_vs_maybe_vt)) {
return true;
}
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond_s_maybe_vs_maybe_vt:
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_s_vs)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_s_vt)) {
return true;
}
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond_p_maybe_vs_maybe_vt:
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_p_vs)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_p_vt)) {
return true;
}
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond_q_maybe_vs_maybe_vt:
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_t_vs)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_t_vt)) {
return true;
}
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond_t_maybe_vs_maybe_vt:
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_vcmp_cond)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_q_vs)) {
return true;
}
if (RabbitizerInstrDescriptor_hasSpecificOperand(self, RAB_OPERAND_r4000allegrex_q_vt)) {
return true;
}
break;
/* r4000allegrex */

/* r5900 */
Expand Down
12 changes: 12 additions & 0 deletions src/instructions/RabbitizerInstruction/RabbitizerInstruction.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,18 @@ void RabbitizerInstruction_blankOut(RabbitizerInstruction *self) {
self->word = RAB_INSTR_R4000ALLEGREX_PACK_offset14(self->word, 0);
self->word = RAB_INSTR_PACK_rs(self->word, 0);
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond_s_maybe_vs_maybe_vt:
case RAB_OPERAND_r4000allegrex_vcmp_cond_p_maybe_vs_maybe_vt:
case RAB_OPERAND_r4000allegrex_vcmp_cond_q_maybe_vs_maybe_vt:
case RAB_OPERAND_r4000allegrex_vcmp_cond_t_maybe_vs_maybe_vt:
self->word = RAB_INSTR_R4000ALLEGREX_PACK_vs(self->word, 0);
self->word = RAB_INSTR_R4000ALLEGREX_PACK_vt(self->word, 0);
FALLTHROUGH;
case RAB_OPERAND_r4000allegrex_vcmp_cond:
self->word = RAB_INSTR_R4000ALLEGREX_PACK_vcmp_cond(self->word, 0);
break;

/* r4000allegrex */

/* r5900 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,18 @@ uint32_t RabbitizerInstruction_getValidBits(const RabbitizerInstruction *self) {
validbits = RAB_INSTR_R4000ALLEGREX_PACK_offset14(validbits, ~0);
validbits = RAB_INSTR_PACK_rs(validbits, ~0);
break;

case RAB_OPERAND_r4000allegrex_vcmp_cond_s_maybe_vs_maybe_vt:
case RAB_OPERAND_r4000allegrex_vcmp_cond_p_maybe_vs_maybe_vt:
case RAB_OPERAND_r4000allegrex_vcmp_cond_q_maybe_vs_maybe_vt:
case RAB_OPERAND_r4000allegrex_vcmp_cond_t_maybe_vs_maybe_vt:
validbits = RAB_INSTR_R4000ALLEGREX_PACK_vs(validbits, ~0);
validbits = RAB_INSTR_R4000ALLEGREX_PACK_vt(validbits, ~0);
FALLTHROUGH;
case RAB_OPERAND_r4000allegrex_vcmp_cond:
validbits = RAB_INSTR_R4000ALLEGREX_PACK_vcmp_cond(validbits, ~0);
break;

/* r4000allegrex */

/* r5900 */
Expand Down
Loading

0 comments on commit 1932266

Please sign in to comment.