zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

movrsintrin.h (2024B) - Raw


      1 /*===---------------- movrsintrin.h - MOVRS intrinsics ----------------------===
      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 <movrsintrin.h> directly; include <immintrin.h> instead."
     11 #endif // __IMMINTRIN_H
     12 
     13 #ifndef __MOVRSINTRIN_H
     14 #define __MOVRSINTRIN_H
     15 
     16 #define __DEFAULT_FN_ATTRS                                                     \
     17   __attribute__((__always_inline__, __nodebug__, __target__("movrs")))
     18 
     19 #ifdef __x86_64__
     20 static __inline__ char __DEFAULT_FN_ATTRS _movrs_i8(const void *__A) {
     21   return (char)__builtin_ia32_movrsqi((const void *)__A);
     22 }
     23 
     24 static __inline__ short __DEFAULT_FN_ATTRS _movrs_i16(const void *__A) {
     25   return (short)__builtin_ia32_movrshi((const void *)__A);
     26 }
     27 
     28 static __inline__ int __DEFAULT_FN_ATTRS _movrs_i32(const void *__A) {
     29   return (int)__builtin_ia32_movrssi((const void *)__A);
     30 }
     31 
     32 static __inline__ long long __DEFAULT_FN_ATTRS _movrs_i64(const void *__A) {
     33   return (long long)__builtin_ia32_movrsdi((const void *)__A);
     34 }
     35 #endif // __x86_64__
     36 
     37 // Loads a memory sequence containing the specified memory address into
     38 /// the L3 data cache. Data will be shared (read/written) to by requesting
     39 /// core and other cores.
     40 ///
     41 /// Note that the effect of this intrinsic is dependent on the processor
     42 /// implementation.
     43 ///
     44 /// \headerfile <x86intrin.h>
     45 ///
     46 /// This intrinsic corresponds to the \c PREFETCHRS instruction.
     47 ///
     48 /// \param __P
     49 ///    A pointer specifying the memory address to be prefetched.
     50 static __inline__ void __DEFAULT_FN_ATTRS
     51 _m_prefetchrs(volatile const void *__P) {
     52 #pragma clang diagnostic push
     53 #pragma clang diagnostic ignored "-Wcast-qual"
     54   __builtin_ia32_prefetchrs((const void *)__P);
     55 #pragma clang diagnostic pop
     56 }
     57 
     58 #undef __DEFAULT_FN_ATTRS
     59 #endif // __MOVRSINTRIN_H