Results 1 to 6 of 6

Thread: [Resolved]MIPS32 (ASM) greater than or equal too, pseudo instruction question

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member voidflux's Avatar
    Join Date
    Jun 2003
    Location
    Brockway, PA
    Posts
    290

    [Resolved]MIPS32 (ASM) greater than or equal too, pseudo instruction question

    Hello everyone.

    I'm trying to figure this questoin out, it says:
    We want to tr4anslate the pseduo instruction "bge $s1, $s2, Lb1" into two real MIPS assembly instructions. Which one is correct.
    Code:
    A:
    slt $t0, $s2, $s1
    beq $t0, $zero, Lb1
    
    B:
    slt $t0, $s2, $s1
    bne $t0, $zero, Lb1
    
    C:
    slt $t0, $s1, $s2
    beq $t0, $zero, Lb1
    
    D:
    slt $t0, $s1, $s2
    bne $t0, $zero, Lb1
    slt stands for set on less than
    bne means branch if not equal
    beq means branch if equal
    and bge is the pseudo instruction that means branch if greater than or equal.

    I translated each of the following and none seem to be "if greather than or equal too" i only see, if greather than.
    Code:
    A:
    slt $t0, $s2, $s1
    if($s2 < $s1) $t0 = 1
    else $t0 = 0
    beq $t0, $zero, Lb1
    if($t0 == 0) goto Lb1
    
    B:
    slt $t0, $s2, $s1
    if($s2 < $s1) $t0 = 1
    else $t0 = 0
    bne $t0,$zero, Lbl
    if( $t0 != 0) goto Lb1
    
    C:
    if($s1 < $s2) $t0 = 1
    else $t0 = 0;
    if($t0 == 0) goto Lb1
    
    D:
    if($s1 < $s2) $t0 = 1
    else $t0 = 0
    if($t0 != 0) goto Lb1;
    None of these seem to work, but B looks like it operates as the branch if $s1 > $s2, but not greather than or equal to. ANy help would be great!

    thanks!
    Last edited by voidflux; Sep 28th, 2006 at 10:22 AM.
    C¤ry Sanchez
    Computer Science/Engineering
    @ Penn State
    IBM.zSeries Intern
    Mandriva 2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width