Skip to content

Commit b888842

Browse files
author
Tarun Prabhu
committed
Address reviewer comments.
- Move the options into a commented block. The -print-supported-extensions and related options can be moved into this block in a future PR. - Combine the tests for the different architectures into a single file.
1 parent 924155b commit b888842

File tree

4 files changed

+58
-52
lines changed

4 files changed

+58
-52
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,12 +5888,24 @@ def target : Joined<["--"], "target=">, Flags<[NoXarchOption]>,
58885888
def darwin_target_variant : Separate<["-"], "darwin-target-variant">,
58895889
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption]>,
58905890
HelpText<"Generate code for an additional runtime variant of the deployment target">;
5891+
5892+
//===----------------------------------------------------------------------===//
5893+
// Print CPU info options (clang, clang-cl, flang)
5894+
//===----------------------------------------------------------------------===//
5895+
5896+
let Visibility = [ClangOption, CC1Option, CLOption, FlangOption, FC1Option] in {
5897+
58915898
def print_supported_cpus : Flag<["-", "--"], "print-supported-cpus">,
58925899
Group<CompileOnly_Group>,
5893-
Visibility<[ClangOption, CC1Option, CLOption, FlangOption, FC1Option]>,
5894-
HelpText<"Print supported cpu models for the given target (if target is not specified,"
5895-
" it will print the supported cpus for the default target)">,
5900+
HelpText<"Print supported cpu models for the given target (if target is not "
5901+
"specified,it will print the supported cpus for the default target)">,
58965902
MarshallingInfoFlag<FrontendOpts<"PrintSupportedCPUs">>;
5903+
5904+
def : Flag<["-"], "mcpu=help">, Alias<print_supported_cpus>;
5905+
def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>;
5906+
5907+
} // let Visibility = [ClangOption, CC1Option, CLOption, FlangOption, FC1Option]
5908+
58975909
def print_supported_extensions : Flag<["-", "--"], "print-supported-extensions">,
58985910
Visibility<[ClangOption, CC1Option, CLOption]>,
58995911
HelpText<"Print supported -march extensions (RISC-V, AArch64 and ARM only)">,
@@ -5903,10 +5915,6 @@ def print_enabled_extensions : Flag<["-", "--"], "print-enabled-extensions">,
59035915
HelpText<"Print the extensions enabled by the given target and -march/-mcpu options."
59045916
" (AArch64 and RISC-V only)">,
59055917
MarshallingInfoFlag<FrontendOpts<"PrintEnabledExtensions">>;
5906-
def : Flag<["-"], "mcpu=help">, Alias<print_supported_cpus>,
5907-
Visibility<[ClangOption, CC1Option, CLOption, FlangOption, FC1Option]>;
5908-
def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>,
5909-
Visibility<[ClangOption, CC1Option, CLOption, FlangOption, FC1Option]>;
59105918
def time : Flag<["-"], "time">,
59115919
HelpText<"Time individual commands">;
59125920
def traditional_cpp : Flag<["-", "--"], "traditional-cpp">,

flang/test/Driver/print-supported-cpus-aarch64.f90

Lines changed: 0 additions & 23 deletions
This file was deleted.

flang/test/Driver/print-supported-cpus-x86.f90

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
! Test --print-supported-cpus and associated aliases, -mcpu=help and
2+
! -mtune=help
3+
4+
! RUN: %if x86-registered-target %{ \
5+
! RUN: %flang --target=x86_64-unknown-linux-gnu --print-supported-cpus 2>&1 \
6+
! RUN: | FileCheck %s --check-prefixes=X86,CHECK \
7+
! RUN: %}
8+
! RUN: %if x86-registered-target %{ \
9+
! RUN: %flang --target=x86_64-unknown-linux-gnu -mcpu=help 2>&1 \
10+
! RUN: | FileCheck %s --check-prefixes=X86,CHECK \
11+
! RUN: %}
12+
! RUN: %if x86-registered-target %{ \
13+
! RUN: %flang --target=x86_64-unknown-linux-gnu -mtune=help 2>&1 \
14+
! RUN: | FileCheck %s --check-prefixes=X86,CHECK \
15+
! RUN: %}
16+
17+
! RUN: %if aarch64-registered-target %{ \
18+
! RUN: %flang --target=aarch64-unknown-linux-gnu --print-supported-cpus 2>&1 \
19+
! RUN: | FileCheck %s --check-prefixes=AARCH64,CHECK \
20+
! RUN: %}
21+
! RUN: %if x86-registered-target %{ \
22+
! RUN: %flang --target=aarch64-unknown-linux-gnu -mcpu=help 2>&1 \
23+
! RUN: | FileCheck %s --check-prefixes=AARCH64,CHECK \
24+
! RUN: %}
25+
! RUN: %if x86-registered-target %{ \
26+
! RUN: %flang --target=aarch64-unknown-linux-gnu -mtune=help 2>&1 \
27+
! RUN: | FileCheck %s --check-prefixes=AARCH64,CHECK \
28+
! RUN: %}
29+
30+
! CHECK-NOT: warning: argument unused during compilation
31+
32+
! X86: Target: x86_64-unknown-linux-gnu
33+
! X86: corei7
34+
35+
! AARCH64: Target: aarch64-unknown-linux-gnu
36+
! AARCH64: cortex-a73
37+
! AARCH64: cortex-a75
38+
39+
! TODO: This is a line that is printed at the end of the output. The full line
40+
! also includes an example that references clang. That needs to be fixed and a
41+
! a check added here to make sure that it references flang, not clang.
42+
43+
! CHECK: Use -mcpu or -mtune to specify the target's processor.

0 commit comments

Comments
 (0)