TEXT runtime·procyieldAsm(SB),NOSPLIT,$0-0
MOVL cycles+0(FP), AX
+ TESTL AX, AX
+ JZ done
again:
PAUSE
SUBL $1, AX
JNZ again
+done:
RET
TEXT ·publicationBarrier(SB),NOSPLIT,$0-0
TEXT runtime·procyieldAsm(SB),NOSPLIT,$0-0
MOVL cycles+0(FP), AX
+ TESTL AX, AX
+ JZ done
again:
PAUSE
SUBL $1, AX
JNZ again
+done:
RET
TEXT runtime·procyieldAsm(SB),NOSPLIT,$0-0
MOVWU cycles+0(FP), R0
+ CBZ R0, done
again:
YIELD
SUBW $1, R0
CBNZ R0, again
+done:
RET
// Save state of caller into g->sched,
TEXT runtime·procyieldAsm(SB),NOSPLIT|NOFRAME,$0-4
MOVW cycles+0(FP), R7
+ CMP $0, R7
+ BEQ done
// POWER does not have a pause/yield instruction equivalent.
// Instead, we can lower the program priority by setting the
// Program Priority Register prior to the wait loop and set it
CMP $0, R7
BNE again
OR R6, R6, R6 // Set PPR priority back to medium-low
+done:
RET
// Save state of caller into g->sched,
}
// procyieldAsm is the assembly implementation of procyield.
-//
-// It may loop infinitely if called with cycles == 0. Prefer
-// procyield, which will compile down to nothing in such cases,
-// instead.
-//
-// FIXME: The implementation really should not loop infinitely if
-// the number of cycles is 0.
func procyieldAsm(cycles uint32)
type neverCallThisFunction struct{}