summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBradley Smith <bradley.smith@arm.com>2014-10-13 10:16:06 +0000
committerBradley Smith <bradley.smith@arm.com>2014-10-13 10:16:06 +0000
commit9ff64332a00baafa2c2de901ea4948369b625177 (patch)
tree817b44e9b2ef63b1ec1ee92d6270bad46bf42417 /clang/lib
parentf2a801d8ac8c83f21ea50e1b23fb3f3496ab9ff2 (diff)
downloadbcm5719-llvm-9ff64332a00baafa2c2de901ea4948369b625177.tar.gz
bcm5719-llvm-9ff64332a00baafa2c2de901ea4948369b625177.zip
[AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is possible for a 64-bit multiply-accumulate instruction in AArch64 state to generate an incorrect result. The details are quite complex and hard to determine statically, since branches in the code may exist in some circumstances, but all cases end with a memory (load, store, or prefetch) instruction followed immediately by the multiply-accumulate operation. The safest work-around for this issue is to make the compiler avoid emitting multiply-accumulate instructions immediately after memory instructions and the simplest way to do this is to insert a NOP. This patch implements clang options to enable this workaround in the backend. The work-around code generation is not enabled by default. llvm-svn: 219604
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 0bbc964838d..c0607284e3c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -913,6 +913,15 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
CmdArgs.push_back("-aarch64-no-strict-align");
}
+ if (Arg *A = Args.getLastArg(options::OPT_mfix_cortex_a53_835769,
+ options::OPT_mno_fix_cortex_a53_835769)) {
+ CmdArgs.push_back("-backend-option");
+ if (A->getOption().matches(options::OPT_mfix_cortex_a53_835769))
+ CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1");
+ else
+ CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0");
+ }
+
// Setting -mno-global-merge disables the codegen global merge pass. Setting
// -mglobal-merge has no effect as the pass is enabled by default.
if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
OpenPOWER on IntegriCloud