]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Builtins for AES acceleration instructions [RFC02657]
authorAvinash Jayakar <avinashd@linux.ibm.com>
Wed, 4 Mar 2026 10:00:24 +0000 (05:00 -0500)
committerAvinash Jayakar <avinashd@linux.ibm.com>
Thu, 7 May 2026 10:33:59 +0000 (16:03 +0530)
commit68481add48bed6e0ee7b3cdf37e07dce445b425b
tree1c9d9406d957514d4e2df02cd8d06d9b3925a62c
parent5154144864a669c722fbb2170e79416c3ae5ff50
rs6000: Builtins for AES acceleration instructions [RFC02657]

This patch adds new builtins for AES acceleration instructions which
may or may not be supported in a future processor. Note, the names of
the builtins may change in future.

The following new builtins for AES acceleration can be used with
-mcpu=future option:
__vector_pair  __builtin_aes_encrypt_paired (__vector_pair,
     __vector_pair, uint2);
__vector_pair  __builtin_aes128_encrypt_paired (__vector_pair,
__vector_pair);
__vector_pair  __builtin_aes192_encrypt_paired (__vector_pair,
__vector_pair);
__vector_pair  __builtin_aes256_encrypt_paired (__vector_pair,
__vector_pair);
__vector_pair  __builtin_aes_decrypt_paired (__vector_pair,
     __vector_pair, uint2);
__vector_pair  __builtin_aes128_decrypt_paired (__vector_pair,
__vector_pair);
__vector_pair  __builtin_aes192_decrypt_paired (__vector_pair,
__vector_pair);
__vector_pair  __builtin_aes256_decrypt_paired (__vector_pair,
__vector_pair);
__vector_pair  __builtin_aes_genlastkey_paired (__vector_pair, uint2);
__vector_pair  __builtin_aes128_genlastkey_paired (__vector_pair);
__vector_pair  __builtin_aes192_genlastkey_paired (__vector_pair);
__vector_pair  __builtin_aes256_genlastkey_paired (__vector_pair);
vec_t __builtin_galois_field_mult (vec_t, vec_t, uint1);
vec_t __builtin_galois_field_mult_gcm (vec_t, vec_t);
vec_t __builtin_galois_field_mult_xts (vec_t, vec_t);

2026-05-07  Avinash Jayakar  <avinashd@linux.ibm.com>

gcc/ChangeLog:
* config/rs6000/crypto.md (UNSPEC_XXAESENCP): New unspec entry.
(UNSPEC_XXAES128ENCP): Likewise.
(UNSPEC_XXAES192ENCP): Likewise.
(UNSPEC_XXAES256ENCP): Likewise.
(UNSPEC_XXAESDECP): Likewise.
(UNSPEC_XXAES128DECP): Likewise.
(UNSPEC_XXAES192DECP): Likewise.
(UNSPEC_XXAES256DECP): Likewise.
(UNSPEC_XXAESGENLKP): Likewise.
(UNSPEC_XXAES128GENLKP): Likewise.
(UNSPEC_XXAES192GENLKP): Likewise.
(UNSPEC_XXAES256GENLKP): Likewise.
(UNSPEC_XXGFMUL128): Likewise.
(UNSPEC_XXGFMUL128GCM): Likewise.
(UNSPEC_XXGFMUL128XTS): Likewise.
(AESACC_base_code): New iterator for xxaesencp and xxaesdecp base
mnemonics.
(AESACC_code): New iterator for xxaesencp and xxaesdecp extended
mnemonics.
(AESGENLKP_code): New iterator for xxaesgenlkp extended mnemonics.
(AESGF_code): New iterator for xxgfmul128 extended mnemonics.
(AESACC_base_insn): New attribute iterator for xxaesencp and xxaesdecp
base mnemonics.
(AESACC_insn): New attribute iterator for xxaesencp and xxaesdecp
extended mnemonics.
(AESGENLKP_insn): New attribute iterator for xxaesgenlkp extended
mnemonics.
(AESGF_insn): New attribute iterator for xxgfmul128 extended mnemonics.
(<AESACC_base_insn>): New define_insn for xxaesencp and xxaesdecp base
mnemonics.
(<AESACC_insn>): New define_insn for xxaesencp and xxaesdecp extended
mnemonics.
(<AESGENLKP_insn>): New define_insn for xxaesgenlkp extended mnemonics.
(xxaesgenlkp): New define_insn for genlkp base mnemonic.
(<AESGF_insn>): New define_insn for xxgfmul128 extended mnemonics.
(xxgfmul128): New define_insn for xxgfmul128 base mnemonic.
* config/rs6000/rs6000-builtins.def: Added new builtin definitions for
AES acceleration.
* doc/extend.texi: Add new section for AES acceleration builtins
for Future ISA.

gcc/testsuite/ChangeLog:
* gcc.target/powerpc/aes-builtin-1.c: New test.
* gcc.target/powerpc/aes-builtin-2.c: New test.
* gcc.target/powerpc/aes-builtin-3.c: New test.
gcc/config/rs6000/crypto.md
gcc/config/rs6000/rs6000-builtins.def
gcc/doc/extend.texi
gcc/testsuite/gcc.target/powerpc/aes-builtin-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/aes-builtin-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/aes-builtin-3.c [new file with mode: 0644]