Skip to content

Commit a48820a

Browse files
committed
clang driver: enable fast unaligned access for Android on RISCV64
Android CTS test already requires fast unaligned access https://android-review.googlesource.com/c/platform/cts/+/2675633
1 parent d0d9839 commit a48820a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Driver/ToolChains/Arch/RISCV.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
167167
Features.push_back("-relax");
168168
}
169169

170+
// Android requires fast unaligned access on RISCV64.
171+
if (Triple.isAndroid())
172+
Features.push_back("+fast-unaligned-access");
173+
170174
// -mstrict-align is default, unless -mno-strict-align is specified.
171175
AddTargetFeature(Args, Features, options::OPT_mno_strict_align,
172176
options::OPT_mstrict_align, "fast-unaligned-access");

clang/test/Driver/riscv-features.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang --target=riscv32-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
22
// RUN: %clang --target=riscv64-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
33
// RUN: %clang --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
4-
// RUN: %clang -mabi=lp64d --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
4+
// RUN: %clang -mabi=lp64d --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT,FAST-UNALIGNED-ACCESS
55

66
// CHECK: fno-signed-char
77

0 commit comments

Comments
 (0)