[clang] clang driver: enable fast unaligned access for Android on RISCV64 (PR #85704)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 19 13:14:11 PDT 2024
https://github.com/hiraditya updated https://github.com/llvm/llvm-project/pull/85704
>From 0925f52277c558bb1587a75bc10c763603c149f9 Mon Sep 17 00:00:00 2001
From: AdityaK <hiraditya at msn.com>
Date: Mon, 18 Mar 2024 14:09:13 -0700
Subject: [PATCH] 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
---
clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 4 ++++
clang/test/Driver/riscv-features.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
index 5165bccc6d7e30..b1dd7c4372d475 100644
--- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -167,6 +167,10 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
Features.push_back("-relax");
}
+ // Android requires fast unaligned access on RISCV64.
+ if (Triple.isAndroid())
+ Features.push_back("+fast-unaligned-access");
+
// -mstrict-align is default, unless -mno-strict-align is specified.
AddTargetFeature(Args, Features, options::OPT_mno_strict_align,
options::OPT_mstrict_align, "fast-unaligned-access");
diff --git a/clang/test/Driver/riscv-features.c b/clang/test/Driver/riscv-features.c
index fe74ac773ef8ca..2b6a8a72b9fdd3 100644
--- a/clang/test/Driver/riscv-features.c
+++ b/clang/test/Driver/riscv-features.c
@@ -1,7 +1,7 @@
// RUN: %clang --target=riscv32-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
// RUN: %clang --target=riscv64-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s
-// RUN: %clang --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
-// RUN: %clang -mabi=lp64d --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT
+// RUN: %clang --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT,FAST-UNALIGNED-ACCESS
+// RUN: %clang -mabi=lp64d --target=riscv64-linux-android -### %s -fsyntax-only 2>&1 | FileCheck %s -check-prefixes=ANDROID,DEFAULT,FAST-UNALIGNED-ACCESS
// CHECK: fno-signed-char
More information about the cfe-commits
mailing list