Spark assembly and% y register
I am currently working with a sparc computer and I am trying to find out if the number is prime or not.
here is a piece of code:
mov 0,%y
mov 3, %l1
nop
nop
nop
sdiv %l1,2,%l3
rd %y, %l6
cmp %l6, 0
So the main thing we have is 3/2. So there should be reminder 1. This reminder should be placed in the% Y register. But when I look at% Y, it is still 0. Why is% Y still at 0 while it should show me a reminder of 1?
+2
Drahakar
source
to share
2 answers
According to the SPARC Architecture Guide , page 116, this is an implementation option, whether or not to install% y in sdiv. Apparently, this is also an implementation option, be it to implement in hardware or software, so it seems that some software implementations don't set% y.
+4
Martin v. Löwis
source
to share
Refer to the SPARC V8 manual on page 115 for the sdiv instruction, the CPU will discard the remainder.
0
Hardy feng
source
to share