koldewb
koldewb

Reputation: 462

gcc; Aarch64; Armv8; enable crypto; -mcpu=cortex-a53+crypto

I am trying to optimize an Arm processor (Corte-A53) with an Armv8 architecture for crypto purposes.

The problem is that however the compiler accepts -mcpu=cortex-a53+crypto etc it doesn't change the output (I checked the assembly output).

Changing mfpu, mcpu add futures like crypto or simd, it doesn't matter, it is completely ignored.

To enable Neon code -ftree-vectorize is needed, how to make use of crypto?

(I checked the -O(1,2,3) flags, it won't help).

Edit: I realized I made a mistake by thinking the crypto flag works like an optimization flag solved by the compiler. My bad.

Upvotes: 4

Views: 3989

Answers (1)

James Greenhalgh
James Greenhalgh

Reputation: 2491

You had two questions...

Why does -mcpu=cortex-a53+crypto not change code output?

The crypto extensions are an optional feature under the AArch64 state of ARMv8-A. The +crypto feature flag indicates to the compiler that these instructions are available use. From a practical perspective, in GCC 4.8/4.9/5.1, this defines the macro __ARM_FEATURE_CRYPTO, and controls whether or not you can use the crypto intrinsics defined in ACLE, for example:

uint8x16_t vaeseq_u8 (uint8x16_t data, uint8x16_t key)

There is no optimisation in current GCC which will automatically convert a sequence of C code to use the cryptography instructions. If you want to make this transformation, you have to do it by hand (and guard it by the appropriate feature macro).

Why do the +fpu and +simd flags not change code output?

For -mcpu=cortex-a53 the +fp and +simd flags are implied by default (for some configurations of GCC +crypto may also be implied by default). Adding these feature flags will therefore not change code generation.

Upvotes: 5

Related Questions