HomePhabricator

[ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature

Authored by dnsampaio on Sep 11 2019, 2:06 AM.

Description

[ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature

Submittin in behalf of krisb (Kristina Bessonova) <ch.bessonova@gmail.com>

Summary:
'+crypto' means '+aes' and '+sha2' for arch >= ARMv8 when they were
not disabled explicitly. But this is correctly handled only in case of
'-march' option, though the feature may also be specified through
the '-mcpu' or '-mfpu' options. In the following example:

$ clang -mcpu=cortex-a57 -mfpu=crypto-neon-fp-armv8

'aes' and 'sha2' are disabled that is quite unexpected:

$ clang -cc1 -triple armv8--- -target-cpu cortex-a57
  <...> -target-feature -sha2 -target-feature -aes -target-feature +crypto

This exposed by https://reviews.llvm.org/D63936 that makes
the 'aes' and 'sha2' features disabled by default.

So, while handling the 'crypto' feature we need to take into account:

  • a CPU name, as it provides the information about architecture (if no '-march' option specified),
  • features, specified by the '-mcpu' and '-mfpu' options.

Reviewers: SjoerdMeijer, ostannard, labrinea, dnsampaio

Reviewed By: dnsampaio

Subscribers: ikudrin, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66018

Author: krisb
llvm-svn: 371597