Billy
Billy

Reputation: 1293

What PowerPC instructions treat r0 as 0?

When its RA parameter is 0, the addi instruction will consider that to be a value instead of reading from the corresponding register like it would if that parameter were anything else. Load and store instructions behave the same way.

Are there any other instructions that behave like this?

Upvotes: 3

Views: 666

Answers (1)

dja
dja

Reputation: 1503

The official source for this information would be the ISA - here's the one for Power9, the latest released chip.

If you search through the pdf for "RA = 0" you can see instructions whose behaviour depends on RA being 0. I can find:

  • l{b,h,w}z[x]
  • l{h,w}a[x]
  • ld[x]
  • st{b,h,w,d}[x]
  • {l,st}q
  • {l,st}{h,w,d}brx
  • {l,st}mw
  • {l,st}sw{i,x}
  • addi[s]
  • {l,st}f{s,d}[x]
  • lfiw{z,a}x
  • stfiwx
  • {l,st}fdp[x]
  • {l,st}ve{b,h,w}x
  • {l,st}vx[l]
  • lvs{l,r}
  • dcbz
  • copy, paste
  • l{b,h,w,d,q}arx
  • st{b,h,w,d,q}cx.
  • tabort./treclaim., kinda
  • l{b,h,w,d}zcix
  • st{b,h,w,d}cix

Upvotes: 4

Related Questions