github.com/primecitizens/pcz/std@v0.2.1/core/yield/asm_ppc64x.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2014 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build ppc64 || ppc64le
     9  
    10  TEXT ·Proc(SB),NOSPLIT|NOFRAME,$0-4
    11  	MOVW cycles+0(FP), R7
    12  	// POWER does not have a pause/yield instruction equivalent.
    13  	// Instead, we can lower the program priority by setting the
    14  	// Program Priority Register prior to the wait loop and set it
    15  	// back to default afterwards. On Linux, the default priority is
    16  	// medium-low. For details, see page 837 of the ISA 3.0.
    17  	OR R1, R1, R1 // Set PPR priority to low
    18  LOOP:
    19  	SUB $1, R7
    20  	CMP $0, R7
    21  	BNE LOOP
    22  	OR R6, R6, R6 // Set PPR priority back to medium-low
    23  	RET