Skip to content

Commit 73438cc

Browse files
otonomeeclaude
andcommitted
test: add comprehensive pseudo-instruction test cases
Added test-pseudo-cases.txt with comprehensive test coverage for all pseudo-instructions: ble, blt, bge, bgt, move, and li (both 16-bit and 32-bit immediate values). All tests verified working correctly with expected expansions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent da4a60b commit 73438cc

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

test-pseudo-cases.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Pseudo-instruction test cases
2+
// Testing all pseudo-instructions: ble, blt, bge, bgt, move, li
3+
4+
// BLE - Branch if Less Than or Equal
5+
// ble $rs, $rt, label → slt $at, $rt, $rs + beq $at, $0, label
6+
ble $2, $3, target1 -> slt $at, $3, $2 + beq $at, $0, target1
7+
8+
// BLT - Branch if Less Than
9+
// blt $rs, $rt, label → slt $at, $rs, $rt + bne $at, $0, label
10+
blt $4, $5, target2 -> slt $at, $4, $5 + bne $at, $0, target2
11+
12+
// BGE - Branch if Greater Than or Equal
13+
// bge $rs, $rt, label → slt $at, $rs, $rt + beq $at, $0, label
14+
bge $6, $7, target3 -> slt $at, $6, $7 + beq $at, $0, target3
15+
16+
// BGT - Branch if Greater Than
17+
// bgt $rs, $rt, label → slt $at, $rt, $rs + bne $at, $0, label
18+
bgt $8, $9, target4 -> slt $at, $9, $8 + bne $at, $0, target4
19+
20+
// MOVE - Move register to register
21+
// move $rd, $rs → add $rd, $rs, $0
22+
move $10, $11 -> add $10, $11, $0
23+
24+
// LI - Load Immediate (16-bit fits in one instruction)
25+
// li $rt, imm → ori $rt, $0, imm (when -32768 ≤ imm ≤ 32767)
26+
li $12, 100 -> ori $12, $0, 100
27+
28+
// LI - Load Immediate (32-bit requires two instructions)
29+
// li $rt, imm → lui $rt, upper + ori $rt, $rt, lower (when imm > 32767 or imm < -32768)
30+
li $13, 65536 -> lui $13, 1 + ori $13, $13, 0
31+
32+
// Additional test cases for comprehensive coverage
33+
ble $t0, $t1, loop -> slt $at, $t1, $t0 + beq $at, $0, loop
34+
blt $s0, $s1, done -> slt $at, $s0, $s1 + bne $at, $0, done
35+
bge $a0, $a1, skip -> slt $at, $a0, $a1 + beq $at, $0, skip
36+
bgt $v0, $v1, exit -> slt $at, $v1, $v0 + bne $at, $0, exit
37+
move $t2, $t3 -> add $t2, $t3, $0
38+
li $t4, 255 -> ori $t4, $0, 255
39+
li $t5, 1048576 -> lui $t5, 16 + ori $t5, $t5, 0

0 commit comments

Comments
 (0)