[Bug target/93177] PPC: Missing many useful platform intrinsics

segher at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 11 10:40:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93177

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Matt Emmerton from comment #4)
> The intrinsics that we would find useful, having used them as provided by
> the IBM XL C/C++ compiler, are the following:
> 
> __sync()
> __isync()
> __lwsync()

The sync intrinsics need to be tied to some other code.  A volatile asm with
a "memory" clobber is not good enough, in many cases.

> __dcbt()
> __dcbtst()

Those are builtin_prefetch().

> __lwarx()
> __ldarx()
> __stwcx()
> __stdcx()

The compiler can always insert memory accesses in between those two, if you
have them as separate intrinsics (and it will, simply stack accesses for
temporaries will do, already).  If those accesses hit the same reservation
granule as the larx/stcx. uses, you lose.

You need to write the whole sequence in one piece of assembler code.

> __protected_stream_set()
> __protected_stream_count()
> __protected_stream_count_depth() // currently not implemented in gcc
> __protected_stream_go()

Those are pretty specific to CBE I think?

> The implementation of stwcx() and stdcx() need revision on PPC.
> As I understand it, there is no need the mfocrf instruction nor the
> mask-and-shift on result.

How else would you output the CR0.EQ bit?

mfocrf does not exist on all ISA versions we support though.


More information about the Gcc-bugs mailing list