https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102166
Bug ID: 102166
Summary: [i386] AMX intrinsics and macros not defined in C++
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: thiago at kde dot org
Target Milestone: ---
$ cat test.cpp
#include <immintrin.h>
__attribute__((target("avx"))) void avx()
{
_mm256_zeroall();
}
__attribute__((target("amx-tile"))) void amx()
{
_tile_loadd(0, 0, 0);
_tile_release();
}
$ gcc -c test.cpp
test.cpp: In function ‘void amx()’:
test.cpp:10:5: error: ‘_tile_loadd’ was not declared in this scope
10 | _tile_loadd(0, 0, 0);
| ^~~~~~~~~~~
test.cpp:11:5: error: ‘_tile_release’ was not declared in this scope
11 | _tile_release();
| ^~~~~~~~~~~~~
That's because the macros and intrinsics in amxtileintrin.h are only defined
behind:
#if defined(__x86_64__) && defined(__AMX_TILE__)
The __AMX_TILE__ macro isn't defined and doesn't need to be. None of the other
itnrinsics require compiling with -m options. In fact, code shouldn't use -m
options for things that are detected at runtime, like AMX inevitably has to be.