Does there exist an equivalent of the x86 PAUSE instruction, which is placed within busy waiting loops to improve performance, particularly on SMT machines, on PowerPC?
3 Answers
In the Linux kernel we have this in arch/powerpc/include/asm/processor.h
/* Macros for adjusting thread priority (hardware multi-threading) */
#define HMT_very_low() asm volatile("or 31,31,31 # very low priority")
#define HMT_low() asm volatile("or 1,1,1 # low priority")
#define HMT_medium_low() asm volatile("or 6,6,6 # medium low priority")
#define HMT_medium() asm volatile("or 2,2,2 # medium priority")
#define HMT_medium_high() asm volatile("or 5,5,5 # medium high priority")
#define HMT_high() asm volatile("or 3,3,3 # high priority")
I'm not familiar with x86 PAUSE, but sounds like "or 31,31,31" is what you want.
Which powerpc processor are you doing this on? For SMT it must be POWER5, 6 or 7?

- 951,095
- 183
- 1,149
- 1,285

- 136
- 3
The PowerPC inside of Cell will recognize certain NOP encodings as indication to adjust the relative priority of the two physical threads in the core. The documentation lists the cctpl
, cctpm
, and cctph
extended mnemonics for these special NOPs.
From the look of other Google results, it looks like perhaps the IBM RS64 line had similar special NOP instructions, so this functionality has probably been in "Book IV" of various IBM PowerPC chips for quite some time.
The Power ISA 2.06 document has additional special NOP definitions in chapter 3 with extended mnemonics like yield
, mdoio
, and mdoom
. It also defines the same NOPs as cctpl
and cctpm
from Cell.

- 1,799
- 14
- 16

- 368
- 3
- 9
-
It'd be better to reproduce this in text to guard against link rot. – Sep 29 '11 at 12:17
-
@0A0D, actually, he's using `imgur` which is what SO uses for an image server, so it should never see linkrot. – Lance Roberts Sep 29 '11 at 17:44
-
@LanceRoberts: Fair enough. I just used Firebug to inspect the element and saw it is using imgur. – Sep 29 '11 at 17:48
-
@0A0d, you can just hit the `edit` link and see the link for the image also. – Lance Roberts Sep 29 '11 at 17:49
-
1The accepted answer is correct but it lacks the explanations about what those magical numbers do. Plus the code itself is GPL. So you better ignore it and use information that I pasted directly from IBM documentation. P.S mdoom -- awesome mnemonics ;-) – Iouri Goussev Sep 30 '11 at 02:01