~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/lib/zstd/common/portability_macros.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (c) Facebook, Inc.
  3  * All rights reserved.
  4  *
  5  * This source code is licensed under both the BSD-style license (found in the
  6  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
  7  * in the COPYING file in the root directory of this source tree).
  8  * You may select, at your option, one of the above-listed licenses.
  9  */
 10 
 11 #ifndef ZSTD_PORTABILITY_MACROS_H
 12 #define ZSTD_PORTABILITY_MACROS_H
 13 
 14 /*
 15  * This header file contains macro defintions to support portability.
 16  * This header is shared between C and ASM code, so it MUST only
 17  * contain macro definitions. It MUST not contain any C code.
 18  *
 19  * This header ONLY defines macros to detect platforms/feature support.
 20  *
 21  */
 22 
 23 
 24 /* compat. with non-clang compilers */
 25 #ifndef __has_attribute
 26   #define __has_attribute(x) 0
 27 #endif
 28 
 29 /* compat. with non-clang compilers */
 30 #ifndef __has_builtin
 31 #  define __has_builtin(x) 0
 32 #endif
 33 
 34 /* compat. with non-clang compilers */
 35 #ifndef __has_feature
 36 #  define __has_feature(x) 0
 37 #endif
 38 
 39 /* detects whether we are being compiled under msan */
 40 
 41 /* detects whether we are being compiled under asan */
 42 
 43 /* detects whether we are being compiled under dfsan */
 44 
 45 /* Mark the internal assembly functions as hidden  */
 46 #ifdef __ELF__
 47 # define ZSTD_HIDE_ASM_FUNCTION(func) .hidden func
 48 #else
 49 # define ZSTD_HIDE_ASM_FUNCTION(func)
 50 #endif
 51 
 52 /* Enable runtime BMI2 dispatch based on the CPU.
 53  * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
 54  */
 55 #ifndef DYNAMIC_BMI2
 56   #if ((defined(__clang__) && __has_attribute(__target__)) \
 57       || (defined(__GNUC__) \
 58           && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
 59       && (defined(__x86_64__) || defined(_M_X64)) \
 60       && !defined(__BMI2__)
 61   #  define DYNAMIC_BMI2 1
 62   #else
 63   #  define DYNAMIC_BMI2 0
 64   #endif
 65 #endif
 66 
 67 /*
 68  * Only enable assembly for GNUC comptabile compilers,
 69  * because other platforms may not support GAS assembly syntax.
 70  *
 71  * Only enable assembly for Linux / MacOS, other platforms may
 72  * work, but they haven't been tested. This could likely be
 73  * extended to BSD systems.
 74  *
 75  * Disable assembly when MSAN is enabled, because MSAN requires
 76  * 100% of code to be instrumented to work.
 77  */
 78 #define ZSTD_ASM_SUPPORTED 1
 79 
 80 /*
 81  * Determines whether we should enable assembly for x86-64
 82  * with BMI2.
 83  *
 84  * Enable if all of the following conditions hold:
 85  * - ASM hasn't been explicitly disabled by defining ZSTD_DISABLE_ASM
 86  * - Assembly is supported
 87  * - We are compiling for x86-64 and either:
 88  *   - DYNAMIC_BMI2 is enabled
 89  *   - BMI2 is supported at compile time
 90  */
 91 #define ZSTD_ENABLE_ASM_X86_64_BMI2 0
 92 
 93 #endif /* ZSTD_PORTABILITY_MACROS_H */
 94 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php