A good answer might be:

        lw    $t0,val          # $t0 has the value
        andi  $t8,$t0,1        # one's place is zero or one
        bnez  $t8,odd          # if even
        addu  $t2,$t0,$t0      #     add to even sum
        b     endif
odd:                           # else
        addu  $t1,$t0,$t0      #     add to odd sum
endif:

Immediate Operand in Branch

If a branch instruction has a second operand, it can be an immediate operand or a register. For example, from the table:

bges,t,labelbranch if s>=t signed

Here are examples:

bge    $t1,$t2,spot     # if ( $t1 >= $t2 ) goto spot

bge    $t1,23,spot      # if ( $t1 >= 23  ) goto spot

bge    $t1,-98,spot     # if ( $t1 >= -98 ) goto spot

bge    12,$t1,oops      # WRONG: first op must be a register

bge    $t1,value,oops   # WRONG: second op can't be a symbolic address

Sometimes the mnemonic corresponds to a basic instrucion (for example beq). However if the second operand is an immediate operand then the result is a pseudoinstruction.

QUESTION 6:

Is the following instruction correct?

bge     $t1,-67,spot     # if ( $t1 >= -67 ) goto spot