Control: Case/Switch Statement
{"Image DocumentName": "Control: Case/Switch Statement", "Image ImageDescription": "Example: switch (k) { case 0: f = i + j; break; case 1: f = g + h; break; case 2: f = g - h; break; case 3: f = i - j; break; } Assume that variables f through k correspond to six registers  s0 through  s5 and the register  t2 contains 4. What\u2019s the MIPS code? Solution: slt  t3,  s5,  zero bne  t3,  zero, Exit slt  t3,  s5,  t2 beq  t3,  zero, Exit add  t1,  s5,  s5 add  t1,  t1,  t1 add  t1,  t1,  t4 lw  t0, 0( t1) jr  t0. \u6aa2\u67e5k\u662f\u5426\u5c0f\u65bc0. \u6aa2\u67e5k\u662f\u5426\u5c0f\u65bc4. L0: add  s0,  s3,  s4 j Exit L1: add  s0,  s1,  s2 j Exit. L2: sub  s0,  s1,  s2 j Exit. L3: sub  s0,  s3,  s4 Exit: \u5047\u8a2dJumpTable\u7684\u8d77\u59cb\u4f4d\u5740\u70ba t4.", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}