[ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature
authorDiogo N. Sampaio <diogo.sampaio@arm.com>
Wed, 11 Sep 2019 09:06:17 +0000 (09:06 +0000)
committerDiogo N. Sampaio <diogo.sampaio@arm.com>
Wed, 11 Sep 2019 09:06:17 +0000 (09:06 +0000)
commit73ec745793acdddc505610ae6a1087ada3140ef2
tree05f696205b8b2ec69bc07bbd8a2a682ae2b6d3f2
parentb250d5ff5e7c5ebd9f3f5da6776ffc91cd01c614
[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
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/test/Driver/arm-features.c