[clang] 6ff41e8 - [Flang][LoongArch] Emit target features for Loongarch64. (#114735)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 00:34:37 PST 2024
Author: Zhaoxin Yang
Date: 2024-11-13T16:34:34+08:00
New Revision: 6ff41e860fdb69bb9e234e003255aae9accff79a
URL: https://github.com/llvm/llvm-project/commit/6ff41e860fdb69bb9e234e003255aae9accff79a
DIFF: https://github.com/llvm/llvm-project/commit/6ff41e860fdb69bb9e234e003255aae9accff79a.diff
LOG: [Flang][LoongArch] Emit target features for Loongarch64. (#114735)
Added:
Modified:
clang/lib/Driver/ToolChains/Flang.cpp
flang/test/Driver/target-cpu-features.f90
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index f9d2fdffe3b2fc..11070c23c75f4a 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -414,6 +414,9 @@ void Flang::addTargetOptions(const ArgList &Args,
case llvm::Triple::ppc64le:
AddPPCTargetArgs(Args, CmdArgs);
break;
+ case llvm::Triple::loongarch64:
+ getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
+ break;
}
if (Arg *A = Args.getLastArg(options::OPT_fveclib)) {
diff --git a/flang/test/Driver/target-cpu-features.f90 b/flang/test/Driver/target-cpu-features.f90
index e3eb8491058c7f..5a3fd0d8380027 100644
--- a/flang/test/Driver/target-cpu-features.f90
+++ b/flang/test/Driver/target-cpu-features.f90
@@ -41,6 +41,9 @@
! RUN: %flang --target=r600-unknown-unknown -mcpu=cayman -nogpulib -c %s -### 2>&1 \
! RUN: | FileCheck %s -check-prefix=CHECK-AMDGPU-R600
+! RUN: %flang --target=loongarch64-linux-gnu -c %s -### 2>&1 \
+! RUN: | FileCheck %s -check-prefix=CHECK-LOONGARCH64
+
! CHECK-A57: "-fc1" "-triple" "aarch64-unknown-linux-gnu"
! CHECK-A57-SAME: "-target-cpu" "cortex-a57"
! CHECK-A57-SAME: "-target-feature" "+v8a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+perfmon" "-target-feature" "+sha2
@@ -86,3 +89,6 @@
! CHECK-AMDGPU-R600: "-fc1" "-triple" "r600-unknown-unknown"
! CHECK-AMDGPU-R600-SAME: "-target-cpu" "cayman"
+
+! CHECK-LOONGARCH64: "-fc1" "-triple" "loongarch64-unknown-linux-gnu"
+! CHECK-LOONGARCH64-SAME: "-target-cpu" "loongarch64" "-target-feature" "+lsx" "-target-feature" "+64bit" "-target-feature" "+f" "-target-feature" "+d" "-target-feature" "+ual"
More information about the cfe-commits
mailing list