[patch 2/2][arm]: redefine aes patterns
Kyrill Tkachov
kyrylo.tkachov@foss.arm.com
Tue Jul 9 09:33:00 GMT 2019
Hi Sylvia,
On 7/5/19 12:32 PM, Sylvia Taylor wrote:
> Greetings,
>
> This patch removes the arch-common aese/aesmc and aesd/aesimc fusions
> (i.e. aes fusion) implemented in the scheduling phase through the
> aarch_crypto_can_dual function. The reason is due to observing
> undesired behaviour in cases such as:
> - when register allocation goes bad (e.g. extra movs)
> - aes operations with xor and zeroed keys among interleaved operations
>
> A more stable version should be provided by instead doing the aes fusion
> during the combine pass. As such, new combine patterns have been added to
> enable this.
>
> The second change is the aese and aesd patterns have been rewritten as
> encapsulating a xor operation. The purpose is to simplify the need of
> having additional combine patterns for cases like the ones below:
>
> For AESE (though it also applies to AESD as both have a xor operation):
>
> Â Â Â data = data ^ key;
> Â Â Â data = vaeseq_u8(data, zero);
> Â Â Â ---
>    veor       q1, q0, q1
> Â Â Â aese.8Â Â Â Â Â q1, q9
>
> Should mean and generate the same as:
>
> Â Â Â data = vaeseq_u8(data, key);
> Â Â Â ---
> Â Â Â aese.8Â Â Â Â Â Â q1, q0
>
> Bootstrapped and tested on arm-none-linux-gnueabihf.
>
Thanks! This looks much cleaner now.
Committed on your behalf with r273296.
Kyrill
> Cheers,
> Syl
>
> gcc/ChangeLog:
>
> 2019-07-05 Sylvia Taylor <sylvia.taylor@arm.com>
>
> Â Â Â Â Â Â Â * config/arm/crypto.md:
> Â Â Â Â Â Â Â (crypto_<crypto_pattern>): Redefine aese/aesd pattern with xor.
> Â Â Â Â Â Â Â (crypto_<crypto_pattern>): Remove attribute enabled for aesmc.
> Â Â Â Â Â Â Â (crypto_<crypto_pattern>): Split CRYPTO_BINARY into 2 patterns.
> Â Â Â Â Â Â Â (*aarch32_crypto_aese_fused, *aarch32_crypto_aesd_fused): New.
> Â Â Â Â Â Â Â * config/arm/arm.c
> Â Â Â Â Â Â Â (aarch_macro_fusion_pair_p): Remove aes/aesmc fusion check.
> Â Â Â Â Â Â Â * config/arm/aarch-common-protos.h
> Â Â Â Â Â Â Â (aarch_crypto_can_dual_issue): Remove.
> Â Â Â Â Â Â Â * config/arm/aarch-common.c
> Â Â Â Â Â Â Â (aarch_crypto_can_dual_issue): Likewise.
> Â Â Â Â Â Â Â * config/arm/exynos-m1.md: Remove aese/aesmc fusion.
> Â Â Â Â Â Â Â * config/arm/cortex-a53.md: Likewise.
> Â Â Â Â Â Â Â * config/arm/cortex-a57.md: Likewise.
> Â Â Â Â Â Â Â * config/arm/iterators.md:
> Â Â Â Â Â Â Â (CRYPTO_BINARY): Redefine.
> Â Â Â Â Â Â Â (CRYPTO_UNARY): Removed.
> Â Â Â Â Â Â Â (CRYPTO_AES, CRYPTO_AESMC): New.
>
> gcc/testsuite/ChangeLog:
>
> 2019-07-05 Sylvia Taylor <sylvia.taylor@arm.com>
>
> Â Â Â Â Â Â Â * gcc.target/arm/aes-fuse-1.c: New.
> Â Â Â Â Â Â Â * gcc.target/arm/aes-fuse-2.c: New.
> Â Â Â Â Â Â Â * gcc.target/arm/aes_xor_combine.c: New.
More information about the Gcc-patches
mailing list