1 /* Copyright (C) 2020 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
24 #if !defined _IMMINTRIN_H_INCLUDED
25 #error "Never use <amxtileintrin.h> directly; include <immintrin.h> instead."
28 #ifndef _AMXTILEINTRIN_H_INCLUDED
29 #define _AMXTILEINTRIN_H_INCLUDED
31 #if !defined(__AMX_TILE__)
32 #pragma GCC push_options
33 #pragma GCC target("amx-tile")
34 #define __DISABLE_AMX_TILE__
35 #endif /* __AMX_TILE__ */
37 #if defined(__x86_64__) && defined(__AMX_TILE__)
39 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
40 _tile_loadconfig (const void *__config
)
42 __asm__
volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config
)));
46 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
47 _tile_storeconfig (void *__config
)
49 __asm__
volatile ("sttilecfg\t%X0" : "=m" (*((void **)__config
)));
53 __attribute__((__gnu_inline__
, __always_inline__
, __artificial__
))
56 __asm__
volatile ("tilerelease" ::);
59 #define _tile_loadd(dst,base,stride) \
60 _tile_loadd_internal (dst, base, stride)
62 #define _tile_loadd_internal(dst,base,stride) \
64 ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \
65 :: "r" ((const void*) base), "r" ((long) stride))
67 #define _tile_stream_loadd(dst,base,stride) \
68 _tile_stream_loadd_internal (dst, base, stride)
70 #define _tile_stream_loadd_internal(dst,base,stride) \
72 ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \
73 :: "r" ((const void*) base), "r" ((long) stride))
75 #define _tile_stored(dst,base,stride) \
76 _tile_stored_internal (dst, base, stride)
78 #define _tile_stored_internal(src,base,stride) \
80 ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \
81 :: "r" ((void*) base), "r" ((long) stride) \
84 #define _tile_zero(dst) \
85 _tile_zero_internal (dst)
87 #define _tile_zero_internal(dst) \
89 ("tilezero\t%%tmm"#dst ::)
93 #ifdef __DISABLE_AMX_TILE__
94 #undef __DISABLE_AMX_TILE__
95 #pragma GCC pop_options
96 #endif /* __DISABLE_AMX_TILE__ */
98 #endif /* _AMXTILEINTRIN_H_INCLUDED */