[ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum
authorArchibald Elliott <archibald.elliott@arm.com>
Fri, 13 May 2022 09:40:43 +0000 (10:40 +0100)
committerArchibald Elliott <archibald.elliott@arm.com>
Fri, 13 May 2022 09:47:33 +0000 (10:47 +0100)
commit3a24df992cf87029ed89c5a4a6be4049b73ff3ab
tree657a2c968bceb0b252bfd8627e64c7e7dde30407
parent7deed49ab9f06f581ced53e06737cbfae626a278
[ARM] Pass for Cortex-A57 and Cortex-A72 Fused AES Erratum

This adds a late Machine Pass to work around a Cortex CPU Erratum
affecting Cortex-A57 and Cortex-A72:
- Cortex-A57 Erratum 1742098
- Cortex-A72 Erratum 1655431

The pass inserts instructions to make the inputs to the fused AES
instruction pairs no longer trigger the erratum. Here the pass errs on
the side of caution, inserting the instructions wherever we cannot prove
that the inputs came from a safe instruction.

The pass is used:
- for Cortex-A57 and Cortex-A72,
- for "generic" cores (which are used when using `-march=`),
- when the user specifies `-mfix-cortex-a57-aes-1742098` or
  `mfix-cortex-a72-aes-1655431` in the command-line arguments to clang.

Reviewed By: dmgreen, simon_tatham

Differential Revision: https://reviews.llvm.org/D119720
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/test/Driver/arm-fix-cortex-a57-aes-1742098.c [new file with mode: 0644]
llvm/lib/Target/ARM/ARM.h
llvm/lib/Target/ARM/ARM.td
llvm/lib/Target/ARM/ARMFixCortexA57AES1742098Pass.cpp [new file with mode: 0644]
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/ARM/CMakeLists.txt
llvm/test/CodeGen/ARM/O3-pipeline.ll
llvm/test/CodeGen/ARM/aes-erratum-fix.ll