| 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 |
#ifndef _IMMINTRIN_H_INCLUDED |
| 25 |
#error "Never use <amxmovrsintrin.h> directly; include <immintrin.h> instead." |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifndef _AMX_MOVRSINTRIN_H_INCLUDED |
| 29 |
#define _AMX_MOVRSINTRIN_H_INCLUDED |
| 30 |
|
| 31 |
#if defined(__x86_64__) |
| 32 |
|
| 33 |
#if !defined(__AMX_MOVRS__) |
| 34 |
#pragma GCC push_options |
| 35 |
#pragma GCC target("amx-movrs") |
| 36 |
#define __DISABLE_AMX_MOVRS__ |
| 37 |
#endif /* __AMX_MOVRS__ */ |
| 38 |
|
| 39 |
#define _tile_loaddrs_internal(tdst, base, stride) \ |
| 40 |
__asm__ volatile \ |
| 41 |
("{tileloaddrs\t(%0,%1,1), %%tmm%c[_tdst] \ |
| 42 |
|tileloaddrs\ttmm%c[_tdst], [%0+%1*1]}" \ |
| 43 |
:: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)), [_tdst]"i"(tdst)) |
| 44 |
|
| 45 |
#define _tile_loaddrst1_internal(tdst, base, stride) \ |
| 46 |
__asm__ volatile \ |
| 47 |
("{tileloaddrst1\t(%0,%1,1), %%tmm%c[_tdst] \ |
| 48 |
|tileloaddrst1\ttmm%c[_tdst], [%0+%1*1]}" \ |
| 49 |
:: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)), [_tdst]"i"(tdst)) |
| 50 |
|
| 51 |
#define _tile_loaddrs(tdst, base, stride) \ |
| 52 |
_tile_loaddrs_internal(tdst, base, stride) |
| 53 |
|
| 54 |
#define _tile_loaddrst1(tdst, base, stride) \ |
| 55 |
_tile_loaddrst1_internal(tdst, base, stride) |
| 56 |
|
| 57 |
#ifdef __DISABLE_AMX_MOVRS__ |
| 58 |
#undef __DISABLE_AMX_MOVRS__ |
| 59 |
#pragma GCC pop_options |
| 60 |
#endif /* __DISABLE_AMX_MOVRS__ */ |
| 61 |
|
| 62 |
#if !defined(__AMX_MOVRS__) || !defined (__AMX_TRANSPOSE__) |
| 63 |
#pragma GCC push_options |
| 64 |
#pragma GCC target("amx-movrs,amx-transpose") |
| 65 |
#define __DISABLE_AMX_MOVRS_TRANSPOSE__ |
| 66 |
#endif /* __AMX_MOVRS_TRANSPOSE__ */ |
| 67 |
|
| 68 |
#define _tile_2rpntlvwz0rs_internal(tdst, base, stride) \ |
| 69 |
__asm__ volatile \ |
| 70 |
("{t2rpntlvwz0rs\t(%0,%1,1), %%tmm"#tdst \ |
| 71 |
"|t2rpntlvwz0rs\ttmm"#tdst", [%0+%1*1]}" \ |
| 72 |
:: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) |
| 73 |
|
| 74 |
#define _tile_2rpntlvwz0rst1_internal(tdst, base, stride) \ |
| 75 |
__asm__ volatile \ |
| 76 |
("{t2rpntlvwz0rst1\t(%0,%1,1), %%tmm"#tdst \ |
| 77 |
"|t2rpntlvwz0rst1\ttmm"#tdst", [%0+%1*1]}" \ |
| 78 |
:: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) |
| 79 |
|
| 80 |
#define _tile_2rpntlvwz1rs_internal(tdst, base, stride) \ |
| 81 |
__asm__ volatile \ |
| 82 |
("{t2rpntlvwz1rs\t(%0,%1,1), %%tmm"#tdst \ |
| 83 |
"|t2rpntlvwz1rs\ttmm"#tdst", [%0+%1*1]}" \ |
| 84 |
:: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) |
| 85 |
|
| 86 |
#define _tile_2rpntlvwz1rst1_internal(tdst, base, stride) \ |
| 87 |
__asm__ volatile \ |
| 88 |
("{t2rpntlvwz1rst1\t(%0,%1,1), %%tmm"#tdst \ |
| 89 |
"|t2rpntlvwz1rst1\ttmm"#tdst", [%0+%1*1]}" \ |
| 90 |
:: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride))) |
| 91 |
|
| 92 |
#define _tile_2rpntlvwz0rs(tdst, base, stride) \ |
| 93 |
_tile_2rpntlvwz0rs_internal(tdst, base, stride) |
| 94 |
|
| 95 |
#define _tile_2rpntlvwz0rst1(tdst, base, stride) \ |
| 96 |
_tile_2rpntlvwz0rst1_internal(tdst, base, stride) |
| 97 |
|
| 98 |
#define _tile_2rpntlvwz1rs(tdst, base, stride) \ |
| 99 |
_tile_2rpntlvwz1rs_internal(tdst, base, stride) |
| 100 |
|
| 101 |
#define _tile_2rpntlvwz1rst1(tdst, base, stride) \ |
| 102 |
_tile_2rpntlvwz1rst1_internal(tdst, base, stride) |
| 103 |
|
| 104 |
#ifdef __DISABLE_AMX_MOVRS_TRANSPOSE__ |
| 105 |
#undef __DISABLE_AMX_MOVRS_TRANSPOSE__ |
| 106 |
#pragma GCC pop_options |
| 107 |
#endif /* __DISABLE_AMX_MOVRS_TRANSPOSE__ */ |
| 108 |
|
| 109 |
#endif /* __x86_64__ */ |
| 110 |
|
| 111 |
#endif /* _AMX_MOVRSINTRIN_H_INCLUDED */ |