Skip to content

Commit

Permalink
[X86] Add AMX_COMPLEX to Graniterapids
Browse files Browse the repository at this point in the history
This patch also rename __AMXCOMPLEX__ to __AMX_COMPLEX__

Reviewed By: skan, xiangzhangllvm

Differential Revision: https://reviews.llvm.org/D147525
  • Loading branch information
FreddyLeaf committed Apr 6, 2023
1 parent 58c296a commit 847abdd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Basic/Targets/X86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
if (HasAMXFP16)
Builder.defineMacro("__AMX_FP16__");
if (HasAMXCOMPLEX)
Builder.defineMacro("__AMXCOMPLEX__");
Builder.defineMacro("__AMX_COMPLEX__");
if (HasCMPCCXADD)
Builder.defineMacro("__CMPCCXADD__");
if (HasRAOINT)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Headers/immintrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ _storebe_i64(void * __P, long long __D) {
#endif

#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
defined(__AMXCOMPLEX__)
defined(__AMX_COMPLEX__)
#include <amxcomplexintrin.h>
#endif

Expand Down
2 changes: 2 additions & 0 deletions clang/test/Preprocessor/predefined-arch-macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,7 @@
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_GNR_M32
// CHECK_GNR_M32: #define __AES__ 1
// CHECK_GNR_M32: #define __AMX_BF16__ 1
// CHECK_GNR_M32: #define __AMX_COMPLEX__ 1
// CHECK_GNR_M32: #define __AMX_FP16__ 1
// CHECK_GNR_M32: #define __AMX_INT8__ 1
// CHECK_GNR_M32: #define __AMX_TILE__ 1
Expand Down Expand Up @@ -1872,6 +1873,7 @@
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_GNR_M64
// CHECK_GNR_M64: #define __AES__ 1
// CHECK_GNR_M64: #define __AMX_BF16__ 1
// CHECK_GNR_M64: #define __AMX_COMPLEX__ 1
// CHECK_GNR_M64: #define __AMX_FP16__ 1
// CHECK_GNR_M64: #define __AMX_INT8__ 1
// CHECK_GNR_M64: #define __AMX_TILE__ 1
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Preprocessor/x86_target_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,14 @@
// RUN: %clang -target x86_64-unknown-linux-gnu -march=x86-64 -mamx-complex -x c \
// RUN: -E -dM -o - %s | FileCheck -check-prefix=AMX-COMPLEX %s

// AMX-COMPLEX: #define __AMXCOMPLEX__ 1
// AMX-COMPLEX: #define __AMX_COMPLEX__ 1

// RUN: %clang -target x86_64-unknown-linux-gnu -march=x86-64 -mno-amx-complex -x c \
// RUN: -E -dM -o - %s | FileCheck -check-prefix=NO-AMX-COMPLEX %s
// RUN: %clang -target x86_64-unknown-linux-gnu -march=x86-64 -mamx-complex -mno-amx-tile \
// RUN: -x c -E -dM -o - %s | FileCheck -check-prefix=NO-AMX-COMPLEX %s

// NO-AMX-COMPLEX-NOT: #define __AMXCOMPLEX__ 1
// NO-AMX-COMPLEX-NOT: #define __AMX_COMPLEX__ 1

// RUN: %clang -target i386-unknown-unknown -march=atom -mavxvnni -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVXVNNI %s

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/X86/X86.td
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,8 @@ def ProcessorFeatures {

// Graniterapids
list<SubtargetFeature> GNRAdditionalFeatures = [FeatureAMXFP16,
FeaturePREFETCHI];
FeaturePREFETCHI,
FeatureAMXCOMPLEX];
list<SubtargetFeature> GNRFeatures =
!listconcat(SPRFeatures, GNRAdditionalFeatures);

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/TargetParser/X86TargetParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ constexpr FeatureBitset FeaturesSapphireRapids =
FeatureSERIALIZE | FeatureSHSTK | FeatureTSXLDTRK | FeatureUINTR |
FeatureWAITPKG;
constexpr FeatureBitset FeaturesGraniteRapids =
FeaturesSapphireRapids | FeatureAMX_FP16 | FeaturePREFETCHI;
FeaturesSapphireRapids | FeatureAMX_FP16 | FeaturePREFETCHI |
FeatureAMX_COMPLEX;

// Intel Atom processors.
// Bonnell has feature parity with Core2 and adds MOVBE.
Expand Down

0 comments on commit 847abdd

Please sign in to comment.