master
 1/*===-------- amxmovrsintrin.h - AMX MOVRS intrinsics -*- C++ -*---------===
 2 *
 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 4 * See https://llvm.org/LICENSE.txt for license information.
 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 6 *
 7 * ===-------------------------------------------------------------------=== */
 8
 9#ifndef __IMMINTRIN_H
10#error "Never use <amxmovrsintrin.h> directly; include <immintrin.h> instead."
11#endif /* __IMMINTRIN_H */
12
13#ifndef __AMXMOVRSINTRIN_H
14#define __AMXMOVRSINTRIN_H
15#ifdef __x86_64__
16
17#define __DEFAULT_FN_ATTRS_MOVRS                                               \
18  __attribute__((__always_inline__, __nodebug__, __target__("amx-movrs")))
19
20#define _tile_loaddrs(dst, base, stride)                                       \
21  __builtin_ia32_tileloaddrs64((dst), ((const void *)(base)),                  \
22                               (__SIZE_TYPE__)(stride))
23#define _tile_stream_loaddrs(dst, base, stride)                                \
24  __builtin_ia32_tileloaddrst164((dst), ((const void *)(base)),                \
25                                 (__SIZE_TYPE__)(stride))
26static __inline__ _tile1024i __DEFAULT_FN_ATTRS_MOVRS
27_tile_loaddrs_internal(unsigned short m, unsigned short n, const void *base,
28                       __SIZE_TYPE__ stride) {
29  return __builtin_ia32_tileloaddrs64_internal(m, n, base,
30                                               (__SIZE_TYPE__)(stride));
31}
32static __inline__ _tile1024i __DEFAULT_FN_ATTRS_MOVRS
33_tile_loaddrst1_internal(unsigned short m, unsigned short n, const void *base,
34                         __SIZE_TYPE__ stride) {
35  return __builtin_ia32_tileloaddrst164_internal(m, n, base,
36                                                 (__SIZE_TYPE__)(stride));
37}
38static __inline__ void __DEFAULT_FN_ATTRS_MOVRS
39__tile_loaddrs(__tile1024i *dst, const void *base, __SIZE_TYPE__ stride) {
40  dst->tile = _tile_loaddrs_internal(dst->row, dst->col, base, stride);
41}
42static __inline__ void __DEFAULT_FN_ATTRS_MOVRS __tile_stream_loaddrs(
43    __tile1024i *dst, const void *base, __SIZE_TYPE__ stride) {
44  dst->tile = _tile_loaddrst1_internal(dst->row, dst->col, base, stride);
45}
46#undef __DEFAULT_FN_ATTRS_MOVRS
47#endif /* __x86_64__ */
48#endif /* __AMXMOVRSINTRIN_H */