G 5 10 etc mips decision instruc4ons c decisions if

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: array element to 5 li $t1, 12 sw $t1, 4($t0) # set the second array element into 12 2 More Instruc4ons •  Load Address la $t0, var1 Copy address of var1 (presumably a label defined in the program .text sec4on) into $t0 In previous page: la $t0 array1 •  Load Immediate li $t0, imm Set the value of $t0 as the value of imm (e.g. 5,  ­10) etc. MIPS Decision Instruc4ons C Decisions: if Statements •  2 kinds of if statements in C –  if (condi4on) clause –  if (condi4on) clause1 else clause2 •  Rearrange 2nd if into following: –  if (condi4on) goto L1; clause2; goto L2; L1: clause1; L2: –  Not as elegant as if ­else, but same meaning Decision Instruc4ons MIPS C Program beq register1, register2, L1 (condi4onal branch) if (register1==registe...
View Full Document

This note was uploaded on 12/27/2011 for the course CMPSC 64 taught by Professor Zheng during the Fall '09 term at UCSB.

Ask a homework question - tutors are online