(root)/
gcc-13.2.0/
gcc/
config/
i386/
amxtileintrin.h
       1  /* Copyright (C) 2020-2023 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 <amxtileintrin.h> directly; include <immintrin.h> instead."
      26  #endif
      27  
      28  #ifndef _AMXTILEINTRIN_H_INCLUDED
      29  #define _AMXTILEINTRIN_H_INCLUDED
      30  
      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__ */
      36  
      37  #if defined(__x86_64__)
      38  extern __inline void
      39  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
      40  _tile_loadconfig (const void *__config)
      41  {
      42    __asm__ volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config)));
      43  }
      44  
      45  extern __inline void
      46  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
      47  _tile_storeconfig (void *__config)
      48  {
      49    __asm__ volatile ("sttilecfg\t%X0" : "=m" (*((void **)__config)));
      50  }
      51  
      52  extern __inline void
      53  __attribute__((__gnu_inline__, __always_inline__, __artificial__))
      54  _tile_release (void)
      55  {
      56    __asm__ volatile ("tilerelease" ::);
      57  }
      58  
      59  #define _tile_loadd(dst,base,stride)		\
      60    _tile_loadd_internal (dst, base, stride)
      61  
      62  #define _tile_loadd_internal(dst,base,stride)				\
      63    __asm__ volatile							\
      64    ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \
      65     :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)))
      66  
      67  #define _tile_stream_loadd(dst,base,stride)		\
      68    _tile_stream_loadd_internal (dst, base, stride)
      69  
      70  #define _tile_stream_loadd_internal(dst,base,stride)			\
      71    __asm__ volatile							\
      72    ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \
      73     :: "r" ((const void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)))
      74  
      75  #define _tile_stored(dst,base,stride)		\
      76    _tile_stored_internal (dst, base, stride)
      77  
      78  #define _tile_stored_internal(src,base,stride)				\
      79    __asm__ volatile							\
      80    ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \
      81     :: "r" ((void*) (base)), "r" ((__PTRDIFF_TYPE__) (stride)) \
      82     : "memory")
      83  
      84  #define _tile_zero(dst)				\
      85    _tile_zero_internal (dst)
      86  
      87  #define _tile_zero_internal(dst)		\
      88    __asm__ volatile				\
      89    ("tilezero\t%%tmm"#dst ::)
      90  
      91  #endif
      92  
      93  #ifdef __DISABLE_AMX_TILE__
      94  #undef __DISABLE_AMX_TILE__
      95  #pragma GCC pop_options
      96  #endif /* __DISABLE_AMX_TILE__ */
      97  
      98  #endif /* _AMXTILEINTRIN_H_INCLUDED */