Skip to content

Commit db2fb3d

Browse files
authored
[X86] Define __APX_F__ when APX is enabled. (#88343)
Relate gcc patch: https://gcc.gnu.org/pipermail/gcc-patches/2024-April/648789.html
1 parent 5c9315f commit db2fb3d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Basic/Targets/X86.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
954954
Builder.defineMacro("__CCMP__");
955955
if (HasCF)
956956
Builder.defineMacro("__CF__");
957+
// Condition here is aligned with the feature set of mapxf in Options.td
958+
if (HasEGPR && HasPush2Pop2 && HasPPX && HasNDD)
959+
Builder.defineMacro("__APX_F__");
957960

958961
// Each case falls through to the previous one here.
959962
switch (SSELevel) {

clang/test/Preprocessor/x86_target_features.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@
803803
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapx-features=ndd -x c -E -dM -o - %s | FileCheck --check-prefix=NDD %s
804804
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapx-features=ccmp -x c -E -dM -o - %s | FileCheck --check-prefix=CCMP %s
805805
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapx-features=cf -x c -E -dM -o - %s | FileCheck --check-prefix=CF %s
806-
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapxf -x c -E -dM -o - %s | FileCheck --check-prefixes=EGPR,PUSH2POP2,PPX,NDD %s
806+
// RUN: %clang -target x86_64-unknown-unknown -march=x86-64 -mapxf -x c -E -dM -o - %s | FileCheck --check-prefixes=EGPR,PUSH2POP2,PPX,NDD,APXF %s
807+
// APXF: #define __APX_F__ 1
807808
// CCMP: #define __CCMP__ 1
808809
// CF: #define __CF__ 1
809810
// EGPR: #define __EGPR__ 1

0 commit comments

Comments
 (0)