Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions clang/lib/Driver/ToolChains/Arch/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,18 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
Features.push_back("+fix-cortex-a53-835769");
else
Features.push_back("-fix-cortex-a53-835769");
} else if (Triple.isAndroid() || Triple.isOHOSFamily()) {
// Enabled A53 errata (835769) workaround by default on android
Features.push_back("+fix-cortex-a53-835769");
} else if (Triple.isOSFuchsia()) {
std::string CPU = getCPUName(D, Args, Triple);
if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
} else if (Extensions.BaseArch &&
Extensions.BaseArch->Version.getMajor() == 8 &&
Extensions.BaseArch->Version.getMinor() == 0) {
if (Triple.isAndroid() || Triple.isOHOSFamily()) {
// Enabled A53 errata (835769) workaround by default on android, providing
// that the architecture allows running on a cortex-a53.
Features.push_back("+fix-cortex-a53-835769");
} else if (Triple.isOSFuchsia()) {
std::string CPU = getCPUName(D, Args, Triple);
if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
Features.push_back("+fix-cortex-a53-835769");
}
}

if (Args.getLastArg(options::OPT_mno_bti_at_return_twice))
Expand Down
8 changes: 8 additions & 0 deletions clang/test/CodeGen/AArch64/fix-cortex-a53-835769.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
// RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s
// RUN: %clang -O3 -target aarch64-linux-ohos %s -S -o- \
// RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s
// RUN: %clang -O3 --target=aarch64-linux-androideabi -march=armv8.1-a %s -S -o- \
// RUN: | FileCheck --check-prefix=CHECK-NO --check-prefix=CHECK %s
// RUN: %clang -O3 -target aarch64-linux-ohos -march=armv8.1-a %s -S -o- \
// RUN: | FileCheck --check-prefix=CHECK-NO --check-prefix=CHECK %s
// RUN: %clang -O3 --target=aarch64-linux-androideabi -mcpu=cortex-a55 %s -S -o- \
// RUN: | FileCheck --check-prefix=CHECK-NO --check-prefix=CHECK %s
// RUN: %clang -O3 -target aarch64-linux-ohos -mcpu=cortex-a55 %s -S -o- \
// RUN: | FileCheck --check-prefix=CHECK-NO --check-prefix=CHECK %s
// RUN: %clang -O3 --target=aarch64-linux-androideabi -mfix-cortex-a53-835769 %s -S -o- \
// RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s
// RUN: %clang -O3 --target=aarch64-linux-androideabi -mno-fix-cortex-a53-835769 %s -S -o- \
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Driver/aarch64-fix-cortex-a53-835769.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@

// RUN: %clang --target=aarch64-linux-androideabi %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-YES %s
// RUN: %clang --target=aarch64-linux-androideabi -march=armv8.1-a %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-DEF %s

// RUN: %clang --target=aarch64-fuchsia %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-YES %s
// RUN: %clang --target=aarch64-fuchsia -march=armv8.1-a %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-DEF %s

// RUN: %clang --target=aarch64-fuchsia -mcpu=cortex-a73 %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-DEF %s
Expand Down
Loading