[PATCH] Add Clang support for PPC cryptography builtins

hfinkel at anl.gov hfinkel at anl.gov
Fri Feb 27 12:46:27 PST 2015


In http://reviews.llvm.org/D7951#131459, @wschmidt wrote:

> In http://reviews.llvm.org/D7951#131441, @hfinkel wrote:
>
> > In http://reviews.llvm.org/D7951#131439, @nemanjai wrote:
> >
> > > Note to reviewers: There is currently no macro guard for the builtins that do not require Cagegory:Vector.Crypto. However, the back end will not generate code for them on older CPU's. Perhaps I should guard those with __POWER8_VECTOR__ macro. However, this would imply that -mcrypto needs to imply -mpower8-vector which is probably the correct thing to do since Category:Vector.Crypto is a subset of Category:Vector.
> > >  I can make these changes and upload a revision if everyone agrees with this approach.
> >
> >
> > Why don't we guard them all with __CRYPTO__? It seems somewhat odd to have some, but not all, of the __builtin_crypto_* available when the crypto feature is disabled.
>
>
> Because this is too big of a hammer.  GCC made a mistake with this (I've proposed correcting this and will be working on fixing it in the future).  We need to treat the SHA and AES support instructions as a separate group because Vector.Crypto is an optional implementation feature in the hardware, due to export control restrictions.  POWER8 hardware with such instructions couldn't be transported legally to sensitive countries.  But the other instructions in that section of the ISA are under no such legal restrictions, and as they are part of the Vector feature, they must be implemented for OpenPOWER-compliant implementations.


Understood. Exactly what have you proposed that GCC do?

My preference would be the following: Define intrinsics for these instructions without 'crypto' in the name, and make them available predicated only on __POWER8_VECTOR__. Define aliases (using #define or another inline function) to these with 'crypto' in the name, and have these available predicated on __CRYPTO__. This way the instructions remain generally available, but we don't end up in the confusing situation where __builtin_crypto_* functions are available even when the 'crypto' feature has been disabled.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7951

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list