Skip to content

Commit 99a1d5f

Browse files
authored
[X86][APX] Remove CF feature from APXF and Diamond Rapids (#153751)
Due to it results in more losses than gains.
1 parent c940c24 commit 99a1d5f

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6820,10 +6820,10 @@ def mapx_features_EQ : CommaJoined<["-"], "mapx-features=">, Group<m_x86_Feature
68206820
def mno_apx_features_EQ : CommaJoined<["-"], "mno-apx-features=">, Group<m_x86_Features_Group>,
68216821
HelpText<"Disable features of APX">, Values<"egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu">, Visibility<[ClangOption, CLOption, FlangOption]>;
68226822
def mapxf : Flag<["-"], "mapxf">, Alias<mapx_features_EQ>,
6823-
AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>,
6823+
AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","zu"]>,
68246824
Group<m_x86_Features_Group>;
68256825
def mno_apxf : Flag<["-"], "mno-apxf">, Alias<mno_apx_features_EQ>,
6826-
AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","cf","zu"]>,
6826+
AliasArgs<["egpr","push2pop2","ppx","ndd","ccmp","nf","zu"]>,
68276827
Group<m_x86_Features_Group>;
68286828
def mapx_inline_asm_use_gpr32 : Flag<["-"], "mapx-inline-asm-use-gpr32">, Group<m_Group>,
68296829
HelpText<"Enable use of GPR32 in inline assembly for APX">;

clang/lib/Basic/Targets/X86.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,8 +1029,7 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
10291029
Builder.defineMacro("__CF__");
10301030
if (HasZU)
10311031
Builder.defineMacro("__ZU__");
1032-
if (HasEGPR && HasPush2Pop2 && HasPPX && HasNDD && HasCCMP && HasNF &&
1033-
HasCF && HasZU)
1032+
if (HasEGPR && HasPush2Pop2 && HasPPX && HasNDD && HasCCMP && HasNF && HasZU)
10341033
Builder.defineMacro("__APX_F__");
10351034
if (HasEGPR && HasInlineAsmUseGPR32)
10361035
Builder.defineMacro("__APX_INLINE_ASM_USE_GPR32__");

clang/test/Driver/cl-x86-flags.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ void f(void) {
145145

146146
// RUN: %clang_cl --target=x86_64-pc-windows -mapxf -### -- 2>&1 %s | FileCheck -check-prefix=APXF %s
147147
// RUN: %clang_cl --target=x86_64-pc-windows -mapxf -mno-apxf -### -- 2>&1 %s | FileCheck -check-prefix=NO-APXF %s
148-
// RUN: %clang_cl --target=x86_64-pc-windows -mapx-features=egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu -### -- 2>&1 %s | FileCheck -check-prefix=APXF %s
149-
// 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"
150-
// 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"
148+
// RUN: %clang_cl --target=x86_64-pc-windows -mapx-features=egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu -### -- 2>&1 %s | FileCheck -check-prefix=APXALL %s
149+
// APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+zu"
150+
// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu"
151+
// APXALL: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+cf" "-target-feature" "+zu"

clang/test/Driver/x86-target-features.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@
476476
// RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apxf -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s
477477
// RUN: %clang --target=x86_64-unknown-linux-gnu -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s
478478
//
479-
// 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"
480-
// 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"
479+
// APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+zu"
480+
// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu"
481481

482482
// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s
483483
// RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s

clang/test/Preprocessor/predefined-arch-macros.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,6 @@
19071907
// CHECK_GNR_M32: #define __BMI2__ 1
19081908
// CHECK_GNR_M32: #define __BMI__ 1
19091909
// CHECK_DMR_M32: #define __CCMP__ 1
1910-
// CHECK_DMR_M32: #define __CF__ 1
19111910
// CHECK_GNR_M32: #define __CLDEMOTE__ 1
19121911
// CHECK_GNR_M32: #define __CLFLUSHOPT__ 1
19131912
// CHECK_GNR_M32: #define __CLWB__ 1
@@ -2017,7 +2016,6 @@
20172016
// CHECK_GNR_M64: #define __BMI2__ 1
20182017
// CHECK_GNR_M64: #define __BMI__ 1
20192018
// CHECK_DMR_M64: #define __CCMP__ 1
2020-
// CHECK_DMR_M64: #define __CF__ 1
20212019
// CHECK_GNR_M64: #define __CLDEMOTE__ 1
20222020
// CHECK_GNR_M64: #define __CLFLUSHOPT__ 1
20232021
// CHECK_GNR_M64: #define __CLWB__ 1

clang/test/Preprocessor/x86_target_features.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@
795795
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapx-features=nf -x c -E -dM -o - %s | FileCheck --check-prefix=NF %s
796796
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapx-features=cf -x c -E -dM -o - %s | FileCheck --check-prefix=CF %s
797797
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapx-features=zu -x c -E -dM -o - %s | FileCheck --check-prefix=ZU %s
798-
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapxf -x c -E -dM -o - %s | FileCheck --check-prefixes=EGPR,PUSH2POP2,PPX,NDD,CCMP,NF,CF,ZU,APXF %s
798+
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapxf -x c -E -dM -o - %s | FileCheck --check-prefixes=EGPR,PUSH2POP2,PPX,NDD,CCMP,NF,ZU,APXF %s
799799
// APXF: #define __APX_F__ 1
800800
// CCMP: #define __CCMP__ 1
801801
// CF: #define __CF__ 1

llvm/lib/Target/X86/X86.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ def FeatureCCMP : SubtargetFeature<"ccmp", "HasCCMP", "true",
355355
"Support conditional cmp & test instructions">;
356356
def FeatureNF : SubtargetFeature<"nf", "HasNF", "true",
357357
"Support status flags update suppression">;
358+
// FeatureCF is not enabled by default for APXF and targets that support APXF
359+
// due to performance reason, though it is part of APXF. Users need to enable it
360+
// manually.
358361
def FeatureCF : SubtargetFeature<"cf", "HasCF", "true",
359362
"Support conditional faulting">;
360363
def FeatureZU : SubtargetFeature<"zu", "HasZU", "true",
@@ -1169,7 +1172,6 @@ def ProcessorFeatures {
11691172
FeaturePPX,
11701173
FeatureNDD,
11711174
FeatureNF,
1172-
FeatureCF,
11731175
FeatureMOVRS,
11741176
FeatureAMXMOVRS,
11751177
FeatureAMXAVX512,

llvm/lib/TargetParser/X86TargetParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ constexpr FeatureBitset FeaturesDiamondRapids =
143143
FeatureCMPCCXADD | FeatureAVXIFMA | FeatureAVXNECONVERT |
144144
FeatureAVXVNNIINT8 | FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 |
145145
FeatureSM4 | FeatureEGPR | FeatureZU | FeatureCCMP | FeaturePush2Pop2 |
146-
FeaturePPX | FeatureNDD | FeatureNF | FeatureCF | FeatureMOVRS |
147-
FeatureAMX_MOVRS | FeatureAMX_AVX512 | FeatureAMX_FP8 | FeatureAMX_TF32 |
146+
FeaturePPX | FeatureNDD | FeatureNF | FeatureMOVRS | FeatureAMX_MOVRS |
147+
FeatureAMX_AVX512 | FeatureAMX_FP8 | FeatureAMX_TF32 |
148148
FeatureAMX_TRANSPOSE | FeatureUSERMSR;
149149

150150
// Intel Atom processors.

0 commit comments

Comments
 (0)