[clang] [flang] [Driver][X86] Add flang visibility for -m[no-]evex512 (PR #109598)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 22 19:45:59 PDT 2024


https://github.com/phoebewang created https://github.com/llvm/llvm-project/pull/109598

The `-m[no-]evex512` are nontrivial options which are used to control vector size of other AVX512 features. Hence we expose both to flang for Fortran users.

>From d9aa2912206bb435bc830a42bc5ddd8b604c7d98 Mon Sep 17 00:00:00 2001
From: "Wang, Phoebe" <phoebe.wang at intel.com>
Date: Mon, 23 Sep 2024 10:36:11 +0800
Subject: [PATCH] [Driver][X86] Add flang visibility for -m[no-]evex512

The `-m[no-]evex512` are nontrivial options which are used to control
vector size of other AVX512 features. Hence we expose both to flang
for Fortran users.
---
 clang/include/clang/Driver/Options.td     |  6 ++++--
 flang/test/Driver/target-cpu-features.f90 | 12 ++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 376d7d4290c0bf..002f60350543d9 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6352,8 +6352,10 @@ def mcx16 : Flag<["-"], "mcx16">, Group<m_x86_Features_Group>;
 def mno_cx16 : Flag<["-"], "mno-cx16">, Group<m_x86_Features_Group>;
 def menqcmd : Flag<["-"], "menqcmd">, Group<m_x86_Features_Group>;
 def mno_enqcmd : Flag<["-"], "mno-enqcmd">, Group<m_x86_Features_Group>;
-def mevex512 : Flag<["-"], "mevex512">, Group<m_x86_Features_Group>;
-def mno_evex512 : Flag<["-"], "mno-evex512">, Group<m_x86_Features_Group>;
+def mevex512 : Flag<["-"], "mevex512">, Group<m_x86_Features_Group>,
+               Visibility<[ClangOption, CLOption, FlangOption]>;
+def mno_evex512 : Flag<["-"], "mno-evex512">, Group<m_x86_Features_Group>,
+                  Visibility<[ClangOption, CLOption, FlangOption]>;
 def mf16c : Flag<["-"], "mf16c">, Group<m_x86_Features_Group>;
 def mno_f16c : Flag<["-"], "mno-f16c">, Group<m_x86_Features_Group>;
 def mfma : Flag<["-"], "mfma">, Group<m_x86_Features_Group>;
diff --git a/flang/test/Driver/target-cpu-features.f90 b/flang/test/Driver/target-cpu-features.f90
index 1c77d4ace5fbc1..e3eb8491058c7f 100644
--- a/flang/test/Driver/target-cpu-features.f90
+++ b/flang/test/Driver/target-cpu-features.f90
@@ -23,6 +23,12 @@
 ! RUN: %flang --target=x86_64-linux-gnu -mno-apx-features=ccmp -c %s -### 2>&1 \
 ! RUN: | FileCheck %s -check-prefix=CHECK-NO-APX
 
+! RUN: %flang --target=x86_64-linux-gnu -mevex512 -c %s -### 2>&1 \
+! RUN: | FileCheck %s -check-prefix=CHECK-EVEX512
+
+! RUN: %flang --target=x86_64-linux-gnu -mno-evex512 -c %s -### 2>&1 \
+! RUN: | FileCheck %s -check-prefix=CHECK-NO-EVEX512
+
 ! RUN: %flang --target=x86_64h-linux-gnu -c %s -### 2>&1 \
 ! RUN: | FileCheck %s -check-prefix=CHECK-X86_64H
 
@@ -63,6 +69,12 @@
 ! CHECK-NO-APX: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
 ! CHECK-NO-APX-SAME: "-target-feature" "-ccmp"
 
+! CHECK-EVEX512: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
+! CHECK-EVEX512-SAME: "-target-feature" "+evex512"
+
+! CHECK-NO-EVEX512: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
+! CHECK-NO-EVEX512-SAME: "-target-feature" "-evex512"
+
 ! CHECK-X86_64H: "-fc1" "-triple" "x86_64h-unknown-linux-gnu"
 ! CHECK-X86_64H-SAME: "-target-cpu" "x86-64" "-target-feature" "-rdrnd" "-target-feature" "-aes" "-target-feature" "-pclmul" "-target-feature" "-rtm" "-target-feature" "-fsgsbase"
 



More information about the cfe-commits mailing list