Infineon TriCore TC1797 assembly instruction JGE

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
FranCruzarianic
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

I am looking at TriCore TC1797 code, and matching Instruction set manual TriCore V1.3.1 Instruction set.

My question is trivial, yet the Tasking compiler generated assembly code is puzzling me. The code looks like it will loop forever, yet it doesn't, the code works. How is it possible?

Lets take these instruction lines (the comments are my understanding of operation):

MOVH.A a12, #@HIS(VAR_ADDRESS)
LEA a12, [a12]@LOS(VAR_ADDRESS)
LD.H d15, [a12]0 ; d15 = 4 (half-word) passed to this function
; values passed are either 0x04 or 0x10 or 0xA8

loop_addr:
ADD d15, d15, #-0x10 ; d15 = 4 - 0x10 = 0xFFFFFFF4
EXTR d9, d15, #0, #16 ; d9 = 0x0000FFF4
; edit: THIS IS MY MISTAKE
; correct is d9 = 0xFFFFFFF4
...
other code here, never touching d9
...
ST.H [a12], d9 ; store decremented value back
JGE d9, #1, loop_addr ; ???? comparing 0x0000FFF4 to 1
; will it loop forever?

What I do not understand, since the d9 is always a positive number omeglz (right?), which is never going to be a zero, how is it possible, that the loop omegle.2yu.co exits?

0 Likes
0 Replies