Why are the basic instructions bgezal & bltzal and not pseudo instructions in MIPS?

According to this MIPS instruction instruction , there are two instructions ( bgezaland bltzal) that perform a relative jump and link instead of just a relative jump if a branch is taken.

These instructions can be modeled using bgezor, bltzrespectively, followed by jal, which means that both bgezaland bltzalshould be classified as pseudo-instructions. However, both have transaction codes assigned to them, so they are classified as basic instructions.

What is the point of adding them to the base set of instructions, and not to their pseudo-instructions? Also, why only bgezaland bltzalare included in the set of commands, and not, for example blezal, bgzaletc.

+4
source share
3 answers

The main reason is efficiency.

Your initial assumption (the execution bgezthat follows jalcan be modeled or functionally equivalent to the execution beqzal), but it is probably less effective for this.

? , . , MIPS. MIPS - . ISA, . ( ), MIPS ISA. , .

, ​​ la, . la , lui ori. 32- MIPS , 32 . , 32- , . la .

bgezal bltzal psudoinstructions, . , . jal , , , .

:

+2

bgez bltz .

bgezal bltzal , .

RISC, . , , , , , ?

+1

, -?

, , , . , RISC, - .

, , , , , , .


Also, why only bgezaland bltzalare included in the set of commands, and not, for example blezal, bgzaletc.

The simplest explanation I can give for this is that these instructions are easiest to implement: for bgezaland bltzalonly the signed bit should be checked.

+1
source

All Articles