llvm-project/clang/test/Preprocessor/x86_amx_target_features.c
Joe Loser 8998fa6c14 [clang] Change AMX macros to match names from GCC
The current behavior for AMX macros is:

```
gcc -march=native -dM -E - < /dev/null | grep TILE

clang -march=native -dM -E - < /dev/null | grep TILE
```

which is not ideal.  Change `__AMXTILE__` and friends to `__AMX_TILE__` (i.e.
have an underscore in them).  This makes GCC and Clang agree on the naming of
these AMX macros to simplify downstream user code.

Fix this for `__AMXTILE__`, `__AMX_INT8__`, `__AMX_BF16__`, and `__AMX_FP16__`.

Differential Revision: https://reviews.llvm.org/D143094
2023-02-03 07:00:16 -07:00

36 lines
1.5 KiB
C

// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mamx-tile -x c -E -dM -o - %s | FileCheck -check-prefix=AMX-TILE %s
// AMX-TILE: #define __AMX_TILE__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mamx-bf16 -x c -E -dM -o - %s | FileCheck -check-prefix=AMX-BF16 %s
// AMX-BF16: #define __AMX_BF16__ 1
// AMX-BF16: #define __AMX_TILE__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mamx-int8 -x c -E -dM -o - %s | FileCheck -check-prefix=AMX-INT8 %s
// AMX-INT8: #define __AMX_INT8__ 1
// AMX-INT8: #define __AMX_TILE__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-amx-tile -x c -E -dM -o - %s | FileCheck -check-prefix=NOAMX-TILE %s
// NOAMX-TILE-NOT: #define __AMX_TILE__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-amx-bf16 -x c -E -dM -o - %s | FileCheck -check-prefix=NOAMX-BF16 %s
// NOAMX-BF16-NOT: #define __AMX_BF16__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mamx-bf16 -mno-amx-tile -x c -E -dM -o - %s | FileCheck -check-prefix=NOAMX-BF16 %s
// NOAMX-BF16-NOT: #define __AMX_TILE__ 1
// NOAMX-BF16-NOT: #define __AMX_BF16__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-amx-int8 -x c -E -dM -o - %s | FileCheck -check-prefix=NOAMX-INT8 %s
// NOAMX-INT8-NOT: #define __AMX_INT8__ 1
// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mamx-int8 -mno-amx-tile -x c -E -dM -o - %s | FileCheck -check-prefix=NOAMX-INT8 %s
// NOAMX-INT8-NOT: #define __AMX_TILE__ 1
// NOAMX-INT8-NOT: #define __AMX_INT8__ 1