https://github.com/fzou1 updated https://github.com/llvm/llvm-project/pull/140874
>From d683302d4768dfb5c618aa1b09553f3b22142aed Mon Sep 17 00:00:00 2001 From: Feng Zou <feng....@intel.com> Date: Tue, 20 May 2025 22:10:07 +0800 Subject: [PATCH 1/4] [Driver][X86] Add -m[no-]apxf to m_x86_Features_Group This is to expose these options to clang-cl on Windows. And add help text for these options. --- clang/include/clang/Driver/Options.td | 9 +++-- clang/test/Driver/cl-x86-flags.c | 50 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 9a4253113488d..ead729342173b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6679,8 +6679,13 @@ def mapx_features_EQ : CommaJoined<["-"], "mapx-features=">, Group<m_x86_Feature 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">, Visibility<[ClangOption, CLOption, FlangOption]>; -def mapxf : Flag<["-"], "mapxf">, Alias<mapx_features_EQ>, AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>; -def mno_apxf : Flag<["-"], "mno-apxf">, Alias<mno_apx_features_EQ>, AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>; +def mapxf : Flag<["-"], "mapxf">, Alias<mapx_features_EQ>, + AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>, + Group<m_x86_Features_Group>, HelpText<"Enable all features of APX">; +def mno_apxf : Flag<["-"], "mno-apxf">, Alias<mno_apx_features_EQ>, + AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>, + Group<m_x86_Features_Group>, + HelpText<"Disable all features of APX">; def mapx_inline_asm_use_gpr32 : Flag<["-"], "mapx-inline-asm-use-gpr32">, Group<m_Group>, HelpText<"Enable use of GPR32 in inline assembly for APX">; } // let Flags = [TargetSpecific] diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c index 51b16f0ce3546..23fe96d604604 100644 --- a/clang/test/Driver/cl-x86-flags.c +++ b/clang/test/Driver/cl-x86-flags.c @@ -135,3 +135,53 @@ void f(void) { } + + +// RUN: not %clang_cl -### --target=i386 -mapx-features=ndd %s 2>&1 | FileCheck --check-prefix=NON-APX %s +// RUN: not %clang_cl -### --target=i386 -mapxf %s 2>&1 | FileCheck --check-prefix=NON-APX %s +// RUN: %clang_cl -### --target=i386 -mno-apxf %s 2>&1 > /dev/null +// NON-APX: error: unsupported option '-mapx-features=|-mapxf' for target 'i386' +// NON-APX-NOT: error: {{.*}} -mapx-features= + +// RUN: %clang_cl -target x86_64-pc-windows -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang_cl -target x86_64-pc-windows -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s +// RUN: %clang_cl -target x86_64-pc-windows -mno-apxf -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang_cl -target x86_64-pc-windows -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s +// +// APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+cf" "-target-feature" "+zu" +// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-cf" "-target-feature" "-zu" + +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=ppx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PPX %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=ccmp %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CCMP %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=nf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NF %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=cf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CF %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=zu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ZU %s +// EGPR: "-target-feature" "+egpr" +// PUSH2POP2: "-target-feature" "+push2pop2" +// PPX: "-target-feature" "+ppx" +// NDD: "-target-feature" "+ndd" +// CCMP: "-target-feature" "+ccmp" +// NF: "-target-feature" "+nf" +// CF: "-target-feature" "+cf" +// ZU: "-target-feature" "+zu" + +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mno-apx-features=egpr -mno-apx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mno-apx-features=egpr -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mno-apx-features=egpr,ndd -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NO-NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr,ndd -mno-apx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NDD %s +// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr -mno-apx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s +// +// EGPR-NDD: "-target-feature" "+egpr" "-target-feature" "+ndd" +// EGPR-NO-NDD: "-target-feature" "-ndd" "-target-feature" "+egpr" +// NO-EGPR-NDD: "-target-feature" "+ndd" "-target-feature" "-egpr" +// NO-EGPR-NO-NDD: "-target-feature" "-egpr" "-target-feature" "-ndd" + +// RUN: not %clang_cl -target x86_64-pc-windows -mapx-features=egpr,foo,bar %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ERROR %s +// +// ERROR: unsupported argument 'foo' to option '-mapx-features=' +// ERROR: unsupported argument 'bar' to option '-mapx-features=' >From c845e220783050532be14154d4ad8ba543f2ec69 Mon Sep 17 00:00:00 2001 From: Feng Zou <feng....@intel.com> Date: Fri, 23 May 2025 10:31:03 +0800 Subject: [PATCH 2/4] Remove help text for m[no_]apxf. --- clang/include/clang/Driver/Options.td | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index ead729342173b..3f8ba71136099 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6681,11 +6681,10 @@ def mno_apx_features_EQ : CommaJoined<["-"], "mno-apx-features=">, Group<m_x86_F HelpText<"Disable features of APX">, Values<"egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu">, Visibility<[ClangOption, CLOption, FlangOption]>; def mapxf : Flag<["-"], "mapxf">, Alias<mapx_features_EQ>, AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>, - Group<m_x86_Features_Group>, HelpText<"Enable all features of APX">; + Group<m_x86_Features_Group>; def mno_apxf : Flag<["-"], "mno-apxf">, Alias<mno_apx_features_EQ>, AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>, - Group<m_x86_Features_Group>, - HelpText<"Disable all features of APX">; + Group<m_x86_Features_Group>; def mapx_inline_asm_use_gpr32 : Flag<["-"], "mapx-inline-asm-use-gpr32">, Group<m_Group>, HelpText<"Enable use of GPR32 in inline assembly for APX">; } // let Flags = [TargetSpecific] >From 213f584c91ec8a6a9fa7ea59a16cf4efc6e6f5e3 Mon Sep 17 00:00:00 2001 From: Feng Zou <feng....@intel.com> Date: Fri, 23 May 2025 12:48:20 +0800 Subject: [PATCH 3/4] Removed some test lines to save run time for LIT tests And updated -target option to --target in cl-x86-flags.c and x86-target-features.c tests as -target option was deprecated. --- clang/test/Driver/cl-x86-flags.c | 43 +--------- clang/test/Driver/x86-target-features.c | 104 ++++++++++++------------ 2 files changed, 55 insertions(+), 92 deletions(-) diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c index 23fe96d604604..b85e8f285b152 100644 --- a/clang/test/Driver/cl-x86-flags.c +++ b/clang/test/Driver/cl-x86-flags.c @@ -143,45 +143,8 @@ void f(void) { // NON-APX: error: unsupported option '-mapx-features=|-mapxf' for target 'i386' // NON-APX-NOT: error: {{.*}} -mapx-features= -// RUN: %clang_cl -target x86_64-pc-windows -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s -// RUN: %clang_cl -target x86_64-pc-windows -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s -// RUN: %clang_cl -target x86_64-pc-windows -mno-apxf -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s -// RUN: %clang_cl -target x86_64-pc-windows -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s -// +// RUN: %clang_cl --target=x86_64-pc-windows -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang_cl --target=x86_64-pc-windows -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s +// RUN: %clang_cl --target=x86_64-pc-windows -mapx-features=egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s // APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+cf" "-target-feature" "+zu" // NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-cf" "-target-feature" "-zu" - -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=ppx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PPX %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=ccmp %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CCMP %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=nf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NF %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=cf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CF %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=zu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ZU %s -// EGPR: "-target-feature" "+egpr" -// PUSH2POP2: "-target-feature" "+push2pop2" -// PPX: "-target-feature" "+ppx" -// NDD: "-target-feature" "+ndd" -// CCMP: "-target-feature" "+ccmp" -// NF: "-target-feature" "+nf" -// CF: "-target-feature" "+cf" -// ZU: "-target-feature" "+zu" - -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mno-apx-features=egpr -mno-apx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mno-apx-features=egpr -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mno-apx-features=egpr,ndd -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NO-NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr,ndd -mno-apx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NDD %s -// RUN: %clang_cl -target x86_64-pc-windows -mapx-features=egpr -mno-apx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s -// -// EGPR-NDD: "-target-feature" "+egpr" "-target-feature" "+ndd" -// EGPR-NO-NDD: "-target-feature" "-ndd" "-target-feature" "+egpr" -// NO-EGPR-NDD: "-target-feature" "+ndd" "-target-feature" "-egpr" -// NO-EGPR-NO-NDD: "-target-feature" "-egpr" "-target-feature" "-ndd" - -// RUN: not %clang_cl -target x86_64-pc-windows -mapx-features=egpr,foo,bar %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ERROR %s -// -// ERROR: unsupported argument 'foo' to option '-mapx-features=' -// ERROR: unsupported argument 'bar' to option '-mapx-features=' diff --git a/clang/test/Driver/x86-target-features.c b/clang/test/Driver/x86-target-features.c index 9c18098c87026..e83b4f3ee78e1 100644 --- a/clang/test/Driver/x86-target-features.c +++ b/clang/test/Driver/x86-target-features.c @@ -131,8 +131,8 @@ // VBMI2: "-target-feature" "+avx512vbmi2" // NO-VBMI2: "-target-feature" "-avx512vbmi2" -// RUN: %clang -target i386-linux-gnu -mavx512vp2intersect %s -### 2>&1 | FileCheck -check-prefix=VP2INTERSECT %s -// RUN: %clang -target i386-linux-gnu -mno-avx512vp2intersect %s -### 2>&1 | FileCheck -check-prefix=NO-VP2INTERSECT %s +// RUN: %clang --target=i386-linux-gnu -mavx512vp2intersect %s -### 2>&1 | FileCheck -check-prefix=VP2INTERSECT %s +// RUN: %clang --target=i386-linux-gnu -mno-avx512vp2intersect %s -### 2>&1 | FileCheck -check-prefix=NO-VP2INTERSECT %s // VP2INTERSECT: "-target-feature" "+avx512vp2intersect" // NO-VP2INTERSECT: "-target-feature" "-avx512vp2intersect" @@ -146,27 +146,27 @@ // RDPRU: "-target-feature" "+rdpru" // NO-RDPRU: "-target-feature" "-rdpru" -// RUN: %clang -target i386-linux-gnu -mretpoline %s -### 2>&1 | FileCheck -check-prefix=RETPOLINE %s -// RUN: %clang -target i386-linux-gnu -mno-retpoline %s -### 2>&1 | FileCheck -check-prefix=NO-RETPOLINE %s +// RUN: %clang --target=i386-linux-gnu -mretpoline %s -### 2>&1 | FileCheck -check-prefix=RETPOLINE %s +// RUN: %clang --target=i386-linux-gnu -mno-retpoline %s -### 2>&1 | FileCheck -check-prefix=NO-RETPOLINE %s // RETPOLINE: "-target-feature" "+retpoline-indirect-calls" "-target-feature" "+retpoline-indirect-branches" // NO-RETPOLINE-NOT: retpoline -// RUN: %clang -target i386-linux-gnu -mretpoline -mretpoline-external-thunk %s -### 2>&1 | FileCheck -check-prefix=RETPOLINE-EXTERNAL-THUNK %s -// RUN: %clang -target i386-linux-gnu -mretpoline -mno-retpoline-external-thunk %s -### 2>&1 | FileCheck -check-prefix=NO-RETPOLINE-EXTERNAL-THUNK %s +// RUN: %clang --target=i386-linux-gnu -mretpoline -mretpoline-external-thunk %s -### 2>&1 | FileCheck -check-prefix=RETPOLINE-EXTERNAL-THUNK %s +// RUN: %clang --target=i386-linux-gnu -mretpoline -mno-retpoline-external-thunk %s -### 2>&1 | FileCheck -check-prefix=NO-RETPOLINE-EXTERNAL-THUNK %s // RETPOLINE-EXTERNAL-THUNK: "-target-feature" "+retpoline-external-thunk" // NO-RETPOLINE-EXTERNAL-THUNK: "-target-feature" "-retpoline-external-thunk" -// RUN: %clang -target i386-linux-gnu -mspeculative-load-hardening %s -### 2>&1 | FileCheck -check-prefix=SLH %s -// RUN: %clang -target i386-linux-gnu -mretpoline -mspeculative-load-hardening %s -### 2>&1 | FileCheck -check-prefix=RETPOLINE %s -// RUN: %clang -target i386-linux-gnu -mno-speculative-load-hardening %s -### 2>&1 | FileCheck -check-prefix=NO-SLH %s +// RUN: %clang --target=i386-linux-gnu -mspeculative-load-hardening %s -### 2>&1 | FileCheck -check-prefix=SLH %s +// RUN: %clang --target=i386-linux-gnu -mretpoline -mspeculative-load-hardening %s -### 2>&1 | FileCheck -check-prefix=RETPOLINE %s +// RUN: %clang --target=i386-linux-gnu -mno-speculative-load-hardening %s -### 2>&1 | FileCheck -check-prefix=NO-SLH %s // SLH-NOT: retpoline // SLH: "-target-feature" "+retpoline-indirect-calls" // SLH-NOT: retpoline // SLH: "-mspeculative-load-hardening" // NO-SLH-NOT: retpoline -// RUN: %clang -target i386-linux-gnu -mlvi-cfi %s -### 2>&1 | FileCheck -check-prefix=LVICFI %s -// RUN: %clang -target i386-linux-gnu -mno-lvi-cfi %s -### 2>&1 | FileCheck -check-prefix=NO-LVICFI %s +// RUN: %clang --target=i386-linux-gnu -mlvi-cfi %s -### 2>&1 | FileCheck -check-prefix=LVICFI %s +// RUN: %clang --target=i386-linux-gnu -mno-lvi-cfi %s -### 2>&1 | FileCheck -check-prefix=NO-LVICFI %s // LVICFI: "-target-feature" "+lvi-cfi" // NO-LVICFI-NOT: lvi-cfi @@ -177,8 +177,8 @@ // RUN: not %clang --target=i386-linux-gnu -mlvi-cfi -mretpoline-external-thunk %s -### 2>&1 | FileCheck -check-prefix=LVICFI-RETPOLINE-EXTERNAL-THUNK %s // LVICFI-RETPOLINE-EXTERNAL-THUNK: error: invalid argument 'mretpoline-external-thunk' not allowed with 'mlvi-cfi' -// RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### 2>&1 | FileCheck -check-prefix=LVIHARDENING %s -// RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s +// RUN: %clang --target=i386-linux-gnu -mlvi-hardening %s -### 2>&1 | FileCheck -check-prefix=LVIHARDENING %s +// RUN: %clang --target=i386-linux-gnu -mno-lvi-hardening %s -### 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" "+lvi-cfi" // NO-LVIHARDENING-NOT: "+lvi- @@ -189,14 +189,14 @@ // RUN: not %clang --target=i386-linux-gnu -mlvi-hardening -mretpoline-external-thunk %s -### 2>&1 | FileCheck -check-prefix=LVIHARDENING-RETPOLINE-EXTERNAL-THUNK %s // LVIHARDENING-RETPOLINE-EXTERNAL-THUNK: error: invalid argument 'mretpoline-external-thunk' not allowed with 'mlvi-hardening' -// RUN: %clang -target i386-linux-gnu -mseses %s -### 2>&1 | FileCheck -check-prefix=SESES %s -// RUN: %clang -target i386-linux-gnu -mno-seses %s -### 2>&1 | FileCheck -check-prefix=NO-SESES %s +// RUN: %clang --target=i386-linux-gnu -mseses %s -### 2>&1 | FileCheck -check-prefix=SESES %s +// RUN: %clang --target=i386-linux-gnu -mno-seses %s -### 2>&1 | FileCheck -check-prefix=NO-SESES %s // SESES: "-target-feature" "+seses" // SESES: "-target-feature" "+lvi-cfi" // NO-SESES-NOT: seses // NO-SESES-NOT: lvi-cfi -// RUN: %clang -target i386-linux-gnu -mseses -mno-lvi-cfi %s -### 2>&1 | FileCheck -check-prefix=SESES-NOLVICFI %s +// RUN: %clang --target=i386-linux-gnu -mseses -mno-lvi-cfi %s -### 2>&1 | FileCheck -check-prefix=SESES-NOLVICFI %s // SESES-NOLVICFI: "-target-feature" "+seses" // SESES-NOLVICFI-NOT: lvi-cfi @@ -210,8 +210,8 @@ // RUN: not %clang --target=i386-linux-gnu -mseses -mlvi-hardening %s -### 2>&1 | FileCheck -check-prefix=SESES-LVIHARDENING %s // SESES-LVIHARDENING: error: invalid argument 'mlvi-hardening' not allowed with 'mseses' -// RUN: %clang -target i386-linux-gnu -mwaitpkg %s -### 2>&1 | FileCheck -check-prefix=WAITPKG %s -// RUN: %clang -target i386-linux-gnu -mno-waitpkg %s -### 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s +// RUN: %clang --target=i386-linux-gnu -mwaitpkg %s -### 2>&1 | FileCheck -check-prefix=WAITPKG %s +// RUN: %clang --target=i386-linux-gnu -mno-waitpkg %s -### 2>&1 | FileCheck -check-prefix=NO-WAITPKG %s // WAITPKG: "-target-feature" "+waitpkg" // NO-WAITPKG: "-target-feature" "-waitpkg" @@ -265,13 +265,13 @@ // TSXLDTRK: "-target-feature" "+tsxldtrk" // NO-TSXLDTRK: "-target-feature" "-tsxldtrk" -// RUN: %clang -target i386-linux-gnu -mkl %s -### 2>&1 | FileCheck -check-prefix=KL %s -// RUN: %clang -target i386-linux-gnu -mno-kl %s -### 2>&1 | FileCheck -check-prefix=NO-KL %s +// RUN: %clang --target=i386-linux-gnu -mkl %s -### 2>&1 | FileCheck -check-prefix=KL %s +// RUN: %clang --target=i386-linux-gnu -mno-kl %s -### 2>&1 | FileCheck -check-prefix=NO-KL %s // KL: "-target-feature" "+kl" // NO-KL: "-target-feature" "-kl" -// RUN: %clang -target i386-linux-gnu -mwidekl %s -### 2>&1 | FileCheck -check-prefix=WIDE_KL %s -// RUN: %clang -target i386-linux-gnu -mno-widekl %s -### 2>&1 | FileCheck -check-prefix=NO-WIDE_KL %s +// RUN: %clang --target=i386-linux-gnu -mwidekl %s -### 2>&1 | FileCheck -check-prefix=WIDE_KL %s +// RUN: %clang --target=i386-linux-gnu -mno-widekl %s -### 2>&1 | FileCheck -check-prefix=NO-WIDE_KL %s // WIDE_KL: "-target-feature" "+widekl" // NO-WIDE_KL: "-target-feature" "-widekl" @@ -297,30 +297,30 @@ // AMX-FP16: "-target-feature" "+amx-fp16" // NO-AMX-FP16: "-target-feature" "-amx-fp16" -// RUN: %clang -target x86_64-unknown-linux-gnu -mamx-complex %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mamx-complex %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=AMX-COMPLEX %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-amx-complex %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-amx-complex %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AMX-COMPLEX %s // AMX-COMPLEX: "-target-feature" "+amx-complex" // NO-AMX-COMPLEX: "-target-feature" "-amx-complex" -// RUN: %clang -target x86_64-unknown-linux-gnu -mamx-transpose %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mamx-transpose %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=AMX-TRANSPOSE %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-amx-transpose %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-amx-transpose %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AMX-TRANSPOSE %s // AMX-TRANSPOSE: "-target-feature" "+amx-transpose" // NO-AMX-TRANSPOSE: "-target-feature" "-amx-transpose" -// RUN: %clang -target x86_64-unknown-linux-gnu -mamx-avx512 %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mamx-avx512 %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=AMX-AVX512 %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-amx-avx512 %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-amx-avx512 %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AMX-AVX512 %s // AMX-AVX512: "-target-feature" "+amx-avx512" // NO-AMX-AVX512: "-target-feature" "-amx-avx512" -// RUN: %clang -target x86_64-unknown-linux-gnu -mamx-tf32 %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mamx-tf32 %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=AMX-TF32 %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-amx-tf32 %s \ +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-amx-tf32 %s \ // RUN: -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AMX-TF32 %s // AMX-TF32: "-target-feature" "+amx-tf32" // NO-AMX-TF32: "-target-feature" "-amx-tf32" @@ -355,8 +355,8 @@ // RAOINT: "-target-feature" "+raoint" // NO-RAOINT: "-target-feature" "-raoint" -// RUN: %clang -target i386-linux-gnu -mavxifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=AVXIFMA %s -// RUN: %clang -target i386-linux-gnu -mno-avxifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AVXIFMA %s +// RUN: %clang --target=i386-linux-gnu -mavxifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=AVXIFMA %s +// RUN: %clang --target=i386-linux-gnu -mno-avxifma %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-AVXIFMA %s // AVXIFMA: "-target-feature" "+avxifma" // NO-AVXIFMA: "-target-feature" "-avxifma" @@ -471,22 +471,22 @@ // RUN: touch %t.o // RUN: %clang -fdriver-only -Werror --target=x86_64-pc-linux-gnu -mharden-sls=all %t.o -o /dev/null 2>&1 | count 0 -// RUN: %clang -target x86_64-unknown-linux-gnu -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-apxf -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apxf -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s // // APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+cf" "-target-feature" "+zu" // NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-cf" "-target-feature" "-zu" -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=ppx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PPX %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=ccmp %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CCMP %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=nf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NF %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=cf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CF %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=zu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ZU %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=ppx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PPX %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=ccmp %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CCMP %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=nf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NF %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=cf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CF %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=zu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ZU %s // EGPR: "-target-feature" "+egpr" // PUSH2POP2: "-target-feature" "+push2pop2" // PPX: "-target-feature" "+ppx" @@ -496,20 +496,20 @@ // CF: "-target-feature" "+cf" // ZU: "-target-feature" "+zu" -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=egpr -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-apx-features=egpr -mno-apx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-apx-features=egpr -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mno-apx-features=egpr,ndd -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NO-NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=egpr,ndd -mno-apx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NDD %s -// RUN: %clang -target x86_64-unknown-linux-gnu -mapx-features=egpr -mno-apx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr -mapx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apx-features=egpr -mno-apx-features=ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apx-features=egpr -mapx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apx-features=egpr,ndd -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR-NO-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr,ndd -mno-apx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NDD %s +// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr -mno-apx-features=egpr,ndd %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-EGPR-NO-NDD %s // // EGPR-NDD: "-target-feature" "+egpr" "-target-feature" "+ndd" // EGPR-NO-NDD: "-target-feature" "-ndd" "-target-feature" "+egpr" // NO-EGPR-NDD: "-target-feature" "+ndd" "-target-feature" "-egpr" // NO-EGPR-NO-NDD: "-target-feature" "-egpr" "-target-feature" "-ndd" -// RUN: not %clang -target x86_64-unknown-linux-gnu -mapx-features=egpr,foo,bar %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ERROR %s +// RUN: not %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr,foo,bar %s -### -o %t.o 2>&1 | FileCheck -check-prefix=ERROR %s // // ERROR: unsupported argument 'foo' to option '-mapx-features=' // ERROR: unsupported argument 'bar' to option '-mapx-features=' >From ec996f921b3ab42f49066ffef18469d7006d95f6 Mon Sep 17 00:00:00 2001 From: Feng Zou <feng....@intel.com> Date: Fri, 23 May 2025 13:04:16 +0800 Subject: [PATCH 4/4] Removed "-o t.o" --- clang/test/Driver/cl-x86-flags.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c index b85e8f285b152..0210b5f3cd3f1 100644 --- a/clang/test/Driver/cl-x86-flags.c +++ b/clang/test/Driver/cl-x86-flags.c @@ -143,8 +143,8 @@ void f(void) { // NON-APX: error: unsupported option '-mapx-features=|-mapxf' for target 'i386' // NON-APX-NOT: error: {{.*}} -mapx-features= -// RUN: %clang_cl --target=x86_64-pc-windows -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s -// RUN: %clang_cl --target=x86_64-pc-windows -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s -// RUN: %clang_cl --target=x86_64-pc-windows -mapx-features=egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang_cl --target=x86_64-pc-windows -mapxf %s -### 2>&1 | FileCheck -check-prefix=APXF %s +// RUN: %clang_cl --target=x86_64-pc-windows -mapxf -mno-apxf %s -### 2>&1 | FileCheck -check-prefix=NO-APXF %s +// RUN: %clang_cl --target=x86_64-pc-windows -mapx-features=egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu %s -### 2>&1 | FileCheck -check-prefix=APXF %s // APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+cf" "-target-feature" "+zu" // NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-cf" "-target-feature" "-zu" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits