https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92287
--- Comment #5 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
For 32-bit big-endian PowerPC (using the 32-bit ELF ABI), the same code
generation is provided by GCC and Clang. I.e., here's the code generation for
Clang with -O2 -m32 -mbig-endian, using 6.0.0-1ubuntu2:
id_foo: # @id_foo
.Lfunc_begin0:
# %bb.0:
mr 3, 4
blr
The ABI document used to be posted at power.org, which is defunct. However,
the sources are available at github:
https://github.com/ryanarn/powerabi
For the 32-bit ELF ABI, all structs (regardless of size) are passed using a
pointer allowing for call-by-value semantics. This is the source of ZSTs
requiring a register. So it's clear there is an ABI that requires this
behavior. (Look for the Parameter Passing Register Selection Algorithm in
https://github.com/ryanarn/powerabi/blob/master/chap3-elf32abi.sgml.)
The 64-bit ABIs (both ELF V1 and ELF V2) pass structures in registers, and the
parameter passing algorithms won't assign registers for size-0 aggregates.
This is intentional.
I hope this is helpful!
Bill