Debian Codegraph @

gcc/config/i386/amxavx512intrin.h

raw
1 /* Copyright (C) 2024-2025 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
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)
8 any later version.
9
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.
14
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.
18
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/>. */
23
24 #if !defined _IMMINTRIN_H_INCLUDED
25 #error "Never use <amxavx512intrin.h> directly; include <immintrin.h> instead."
26 #endif
27
28 #ifndef _AMXAVX512INTRIN_H_INCLUDED
29 #define _AMXAVX512INTRIN_H_INCLUDED
30
31 #if !defined(__AMX_AVX512__)
32 #pragma GCC push_options
33 #pragma GCC target("amx-avx512")
34 #define __DISABLE_AMX_AVX512__
35 #endif /* __AMX_AVX512__ */
36
37 #if defined(__x86_64__)
38 #define _tile_cvtrowd2ps_internal(src,A) \
39 ({ \
40 __m512 dst; \
41 __asm__ volatile \
42 ("{tcvtrowd2ps\t%1, %%tmm%c[_src], %0 \
43 |tcvtrowd2ps\t%0, tmm%c[_src], %1}" \
44 : "=v" (dst) : "r" ((unsigned) (A)), [_src]"i"(src)); \
45 dst; \
46 })
47
48 #define _tile_cvtrowd2psi_internal(src,imm) \
49 ({ \
50 __m512 dst; \
51 __asm__ volatile \
52 ("{tcvtrowd2ps\t%[_imm], %%tmm%c[_src], %0 \
53 |tcvtrowd2ps\t%0, tmm%c[_src], %[_imm]}" \
54 : "=v" (dst) : [_src]"i"(src), [_imm]"i"(imm)); \
55 dst; \
56 })
57
58 #define _tile_cvtrowps2bf16h_internal(src,A) \
59 ({ \
60 __m512bh dst; \
61 __asm__ volatile \
62 ("{tcvtrowps2bf16h\t%1, %%tmm%c[_src], %0 \
63 |tcvtrowps2bf16h\t%0, tmm%c[_src], %1}" \
64 : "=v" (dst) : "r" ((unsigned) (A)), [_src]"i"(src)); \
65 dst; \
66 })
67
68 #define _tile_cvtrowps2bf16hi_internal(src,imm) \
69 ({ \
70 __m512bh dst; \
71 __asm__ volatile \
72 ("{tcvtrowps2bf16h\t%[_imm], %%tmm%c[_src], %0 \
73 |tcvtrowps2bf16h\t%0, tmm%c[_src], %[_imm]}" \
74 : "=v" (dst) : [_src]"i"(src), [_imm]"i"(imm)); \
75 dst; \
76 })
77
78 #define _tile_cvtrowps2bf16l_internal(src,A) \
79 ({ \
80 __m512bh dst; \
81 __asm__ volatile \
82 ("{tcvtrowps2bf16l\t%1, %%tmm%c[_src], %0 \
83 |tcvtrowps2bf16l\t%0, tmm%c[_src], %1}" \
84 : "=v" (dst) : "r" ((unsigned) (A)), [_src]"i"(src)); \
85 dst; \
86 })
87
88 #define _tile_cvtrowps2bf16li_internal(src,imm) \
89 ({ \
90 __m512bh dst; \
91 __asm__ volatile \
92 ("{tcvtrowps2bf16l\t%[_imm], %%tmm%c[_src], %0 \
93 |tcvtrowps2bf16l\t%0, tmm%c[_src], "#imm"}" \
94 : "=v" (dst) : [_src]"i"(src), [_imm]"i"(imm)); \
95 dst; \
96 })
97
98 #define _tile_cvtrowps2phh_internal(src,A) \
99 ({ \
100 __m512h dst; \
101 __asm__ volatile \
102 ("{tcvtrowps2phh\t%1, %%tmm%c[_src], %0|tcvtrowps2phh\t%0, tmm%c[_src], %1}" \
103 : "=v" (dst) : "r" ((unsigned) (A)), [_src]"i"(src)); \
104 dst; \
105 })
106
107 #define _tile_cvtrowps2phhi_internal(src,imm) \
108 ({ \
109 __m512h dst; \
110 __asm__ volatile \
111 ("{tcvtrowps2phh\t%[_imm], %%tmm%c[_src], %0 \
112 |tcvtrowps2phh\t%0, tmm%c[_src], "#imm"}" \
113 : "=v" (dst) : [_src]"i"(src), [_imm]"i"(imm)); \
114 dst; \
115 })
116
117 #define _tile_cvtrowps2phl_internal(src,A) \
118 ({ \
119 __m512h dst; \
120 __asm__ volatile \
121 ("{tcvtrowps2phl\t%1, %%tmm%c[_src], %0|tcvtrowps2phl\t%0, tmm%c[_src], %1}" \
122 : "=v" (dst) : "r" ((unsigned) (A)), [_src]"i"(src)); \
123 dst; \
124 })
125
126 #define _tile_cvtrowps2phli_internal(src,imm) \
127 ({ \
128 __m512h dst; \
129 __asm__ volatile \
130 ("{tcvtrowps2phl\t%[_imm], %%tmm%c[_src], %0 \
131 |tcvtrowps2phl\t%0, tmm%c[_src], "#imm"}" \
132 : "=v" (dst) : [_src]"i"(src), [_imm]"i"(imm)); \
133 dst; \
134 })
135
136 #define _tile_movrow_internal(src,A) \
137 ({ \
138 __m512 dst; \
139 __asm__ volatile \
140 ("{tilemovrow\t%1, %%tmm%c[_src], %0|tilemovrow\t%0, tmm%c[_src], %1}" \
141 : "=v" (dst) : "r" ((unsigned) (A)), [_src]"i"(src)); \
142 dst; \
143 })
144
145 #define _tile_movrowi_internal(src,imm) \
146 ({ \
147 __m512 dst; \
148 __asm__ volatile \
149 ("{tilemovrow\t%[_imm], %%tmm%c[_src], %0 \
150 |tilemovrow\t%0, tmm%c[_src], "#imm"}" \
151 : "=v" (dst) : [_src]"i"(src), [_imm]"i"(imm)); \
152 dst; \
153 })
154
155 #define _tile_cvtrowd2ps(src,A) \
156 _tile_cvtrowd2ps_internal (src,A)
157
158 #define _tile_cvtrowd2psi(src,imm) \
159 _tile_cvtrowd2psi_internal (src,imm)
160
161 #define _tile_cvtrowps2bf16h(src,A) \
162 _tile_cvtrowps2bf16h_internal (src,A)
163
164 #define _tile_cvtrowps2bf16hi(src,imm) \
165 _tile_cvtrowps2bf16hi_internal (src,imm)
166
167 #define _tile_cvtrowps2bf16l(src,A) \
168 _tile_cvtrowps2bf16l_internal (src,A)
169
170 #define _tile_cvtrowps2bf16li(src,imm) \
171 _tile_cvtrowps2bf16li_internal (src,imm)
172
173 #define _tile_cvtrowps2phh(src,A) \
174 _tile_cvtrowps2phh_internal (src,A)
175
176 #define _tile_cvtrowps2phhi(src,imm) \
177 _tile_cvtrowps2phhi_internal (src,imm)
178
179 #define _tile_cvtrowps2phl(src,A) \
180 _tile_cvtrowps2phl_internal (src,A)
181
182 #define _tile_cvtrowps2phli(src,imm) \
183 _tile_cvtrowps2phli_internal (src,imm)
184
185 #define _tile_movrow(src,A) \
186 _tile_movrow_internal (src,A)
187
188 #define _tile_movrowi(src,imm) \
189 _tile_movrowi_internal (src,imm)
190
191 #endif
192
193 #ifdef __DISABLE_AMX_AVX512__
194 #undef __DISABLE_AMX_AVX512__
195 #pragma GCC pop_options
196 #endif /* __DISABLE_AMX_AVX512__ */
197
198 #endif /* _AMXAVX512INTRIN_H_INCLUDED */