spin2cpp icon indicating copy to clipboard operation
spin2cpp copied to clipboard

Jumping to function return on P1 always generates long jump

Open Wuerfel21 opened this issue 1 year ago • 0 comments


PRI {+noinline} test(a,b)
  if a > 0
    if b > 0
      return 1
    else
      return 2
  else
    if b > 0
      return 3
    else
      return 4
      'return test(b,a) + 1


PUB main
  outa := test(cnt,ina)

generates a lot of

 if_ae	rdlong	__pc,__pc
	long	@@@_test_ret

-style branches. If the function has an epilogue (see the commented out line), the problem disappears because everything jumps into the epilogue instead.

Wuerfel21 avatar Feb 05 '24 20:02 Wuerfel21