-
Notifications
You must be signed in to change notification settings - Fork 14.1k
[Driver][X86] Add flang visibility for -mapx-features= #97525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-flang-driver @llvm/pr-subscribers-clang Author: Shengchen Kan (KanRobert) ChangesFull diff: https://github.com/llvm/llvm-project/pull/97525.diff 2 Files Affected:
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 1c2b8cfeef6ce..e1e6a6e3a0fcd 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6319,7 +6319,7 @@ def mno_gather : Flag<["-"], "mno-gather">, Group<m_Group>,
def mno_scatter : Flag<["-"], "mno-scatter">, Group<m_Group>,
HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
def mapx_features_EQ : CommaJoined<["-"], "mapx-features=">, Group<m_x86_Features_Group>,
- HelpText<"Enable features of APX">, Values<"egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu">;
+ HelpText<"Enable features of APX">, Values<"egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu">, Visibility<[ClangOption, CLOption, FlangOption]>;
def mno_apx_features_EQ : CommaJoined<["-"], "mno-apx-features=">, Group<m_x86_Features_Group>,
HelpText<"Disable features of APX">, Values<"egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu">;
// For stability, we only add a feature to -mapxf after it passes the validation of llvm-test-suite && cpu2017 on Intel SDE.
diff --git a/flang/test/Driver/target-cpu-features.f90 b/flang/test/Driver/target-cpu-features.f90
index e78c3516db45a..2728fb90afa41 100644
--- a/flang/test/Driver/target-cpu-features.f90
+++ b/flang/test/Driver/target-cpu-features.f90
@@ -17,6 +17,9 @@
! RUN: %flang --target=x86_64-linux-gnu -march=skylake -c %s -### 2>&1 \
! RUN: | FileCheck %s -check-prefix=CHECK-SKYLAKE
+! RUN: %flang --target=x86_64-linux-gnu -mapx-features=egpr -c %s -### 2>&1 \
+! RUN: | FileCheck %s -check-prefix=CHECK-APX
+
! RUN: %flang --target=x86_64h-linux-gnu -c %s -### 2>&1 \
! RUN: | FileCheck %s -check-prefix=CHECK-X86_64H
@@ -51,6 +54,9 @@
! CHECK-SKYLAKE: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
! CHECK-SKYLAKE-SAME: "-target-cpu" "skylake"
+! CHECK-APX: "-fc1" "-triple" "x86_64-unknown-linux-gnu"
+! CHECK-APX-SAME: "-target-feature" "+egpr"
+
! 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"
|
phoebewang
approved these changes
Jul 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Also, AArch64 also exposes the tuning flag |
lravenclaw
pushed a commit
to lravenclaw/llvm-project
that referenced
this pull request
Jul 3, 2024
The default visibility of `m_x86_Features_Group` is `ClangOption, CLOption`. For x86, we expose `-march` to flang but not `-m<cpuid>`. `apxf` is special b/c it contains several independent features like `egpr, ndd, ppx, push2pop2, ccmp, nf, cf` and `zu`. Users may would like to turn on part of features in different cases 1. enable `ndd` only when writing a code-size sensitive library 2. disable `ccmp`, `cf` when building component has strong security request on caches Hence, we expose `-mapx-features=` to flang for Fortran users.
kbluck
pushed a commit
to kbluck/llvm-project
that referenced
this pull request
Jul 6, 2024
The default visibility of `m_x86_Features_Group` is `ClangOption, CLOption`. For x86, we expose `-march` to flang but not `-m<cpuid>`. `apxf` is special b/c it contains several independent features like `egpr, ndd, ppx, push2pop2, ccmp, nf, cf` and `zu`. Users may would like to turn on part of features in different cases 1. enable `ndd` only when writing a code-size sensitive library 2. disable `ccmp`, `cf` when building component has strong security request on caches Hence, we expose `-mapx-features=` to flang for Fortran users.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang
Clang issues not falling into any other category
flang:driver
flang
Flang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The default visibility of
m_x86_Features_Group
isClangOption, CLOption
. For x86, we expose-march
to flang but not-m<cpuid>
.apxf
is special b/c it contains several independent features likeegpr, ndd, ppx, push2pop2, ccmp, nf, cf
andzu
.Users may would like to turn on part of features in different cases
ndd
only when writing a code-size sensitive libraryccmp
,cf
when building component has strong security request on cachesHence, we expose
-mapx-features=
to flang for Fortran users.