Question

I am currently working with a sparc computer and I am trying to know if a number is prime or not.

here is a part of the code :

        mov     0,%y            
        mov     3, %l1
        nop
        nop
        nop

        sdiv    %l1,2,%l3
        rd      %y, %l6         
        cmp     %l6, 0          

So basicaly what we have here is 3/2. So there should be a reminder of 1. This reminder should be putted in the %Y register. But When I look at %Y, it is still at 0. Why is %Y still at 0 while it should show me a reminder of 1?

Was it helpful?

Solution

According to the SPARC Architecture Manual, page 116, it's an implementation option whether or not to set %y in sdiv. Apparently, it's also an implementation option whether to implement it in hardware or software, so it seems that some software implementations don't set %y.

OTHER TIPS

Please refer to SPARC V8 Manual page 115, for sdiv instruction, CPU will discard remainder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top