Possible bug with `test` instruction
VickyMerzOwn opened this issue · 0 comments
VickyMerzOwn commented
Was going through threads-intro/loop.s
.
This is what it looks like:
.main
.top
sub $1,%dx
test $0,%dx
jgte .top
halt
If I run: ./x86.py -p loop.s -t 1 -i 100 -R dx -c
, I get the following output:
dx Thread 0
0
-1 1000 sub $1,%dx
-1 1001 test $0,%dx
-1 1002 jgte .top
-1 1003 halt
My doubt is the following:
If dx
is initialised to 0
.
By 1001 test $0, %dx
, it becomes -1
, and here the constant 0
is greater than -1
.
So in 1002 jgte .top
should send the process in a loop, shouldn't it?
Or am I missing something?