I've got the instruction to understand a MIPS - code. One line of it is the following one:
and $t6, $zero, $zero
Which purpose does it have ? There is the and - instruction of two zero - constants. So the result should also be zero ? But why is the and - command in usuage here ?
Thanks a lot !
I've tried the MARS - Simulator for MIPS - Processors and watched the registers. But the register never reaches a different value than zero after the and - command.
The and instruction (
and rd, rs, rt) performs a bitwise logical AND betweenrsandrtand stores the result inrd.So in your example,
and $t6, $zero, $zerowould perform a logical and between 0 and 0 yielding also 0 and that value is stored in $t6 (overwriting its previous value).Example: