|
17 | 17 |
|
18 | 18 | #include "misc.h"
|
19 | 19 |
|
| 20 | +// This file is included by mlvalues.h, so should be visible |
| 21 | +// to all user-defined C bindings. When compiling C stubs to |
| 22 | +// x86_64/ELF, this detects which ISA extensions are enabled and |
| 23 | +// requests the OCaml runtime to check for support at startup. |
| 24 | + |
| 25 | +#if defined __x86_64__ && defined __ELF__ |
| 26 | + |
| 27 | +#define CAML_REQUIRE_ARCH_POPCNT \ |
| 28 | + CAMLweakdef intnat caml_arch_popcnt; |
| 29 | + |
| 30 | +#define CAML_REQUIRE_ARCH_PREFETCHW \ |
| 31 | + CAMLweakdef intnat caml_arch_prefetchw; |
| 32 | + |
| 33 | +#define CAML_REQUIRE_ARCH_PREFETCHWT1 \ |
| 34 | + CAMLweakdef intnat caml_arch_prefetchwt1; |
| 35 | + |
| 36 | +#define CAML_REQUIRE_ARCH_SSE3 \ |
| 37 | + CAMLweakdef intnat caml_arch_sse3; |
| 38 | + |
| 39 | +#define CAML_REQUIRE_ARCH_SSSE3 \ |
| 40 | + CAMLweakdef intnat caml_arch_ssse3; |
| 41 | + |
| 42 | +#define CAML_REQUIRE_ARCH_SSE4_1 \ |
| 43 | + CAMLweakdef intnat caml_arch_sse4_1; |
| 44 | + |
| 45 | +#define CAML_REQUIRE_ARCH_SSE4_2 \ |
| 46 | + CAMLweakdef intnat caml_arch_sse4_2; |
| 47 | + |
| 48 | +#define CAML_REQUIRE_ARCH_CLMUL \ |
| 49 | + CAMLweakdef intnat caml_arch_clmul; |
| 50 | + |
| 51 | +#define CAML_REQUIRE_ARCH_LZCNT \ |
| 52 | + CAMLweakdef intnat caml_arch_lzcnt; |
| 53 | + |
| 54 | +#define CAML_REQUIRE_ARCH_BMI \ |
| 55 | + CAMLweakdef intnat caml_arch_bmi; |
| 56 | + |
| 57 | +#define CAML_REQUIRE_ARCH_BMI2 \ |
| 58 | + CAMLweakdef intnat caml_arch_bmi2; |
| 59 | + |
| 60 | +#ifdef __POPCNT__ |
| 61 | +CAML_REQUIRE_ARCH_POPCNT |
| 62 | +#endif |
| 63 | + |
| 64 | +#ifdef __PRFCHW__ |
| 65 | +CAML_REQUIRE_ARCH_PREFETCHW |
| 66 | +#endif |
| 67 | + |
| 68 | +#ifdef __PREFETCHWT1__ |
| 69 | +CAML_REQUIRE_ARCH_PREFETCHWT1 |
| 70 | +#endif |
| 71 | + |
| 72 | +#ifdef __SSE3__ |
| 73 | +CAML_REQUIRE_ARCH_SSE3 |
| 74 | +#endif |
| 75 | + |
| 76 | +#ifdef __SSSE3__ |
| 77 | +CAML_REQUIRE_ARCH_SSSE3 |
| 78 | +#endif |
| 79 | + |
| 80 | +#ifdef __SSE4_1__ |
| 81 | +CAML_REQUIRE_ARCH_SSE4_1 |
| 82 | +#endif |
| 83 | + |
| 84 | +#ifdef __SSE4_2__ |
| 85 | +CAML_REQUIRE_ARCH_SSE4_2 |
| 86 | +#endif |
| 87 | + |
| 88 | +#ifdef __PCLMUL__ |
| 89 | +CAML_REQUIRE_ARCH_CLMUL |
| 90 | +#endif |
| 91 | + |
| 92 | +#ifdef __LZCNT__ |
| 93 | +CAML_REQUIRE_ARCH_LZCNT |
| 94 | +#endif |
| 95 | + |
| 96 | +#ifdef __BMI__ |
| 97 | +CAML_REQUIRE_ARCH_BMI |
| 98 | +#endif |
| 99 | + |
| 100 | +#ifdef __BMI2__ |
| 101 | +CAML_REQUIRE_ARCH_BMI2 |
| 102 | +#endif |
| 103 | + |
| 104 | +#endif |
| 105 | + |
20 | 106 | #ifdef CAML_INTERNALS
|
21 | 107 | CAMLextern void caml_assert_arch_extensions(void);
|
22 | 108 | extern uintnat caml_skip_arch_extension_check;
|
|
0 commit comments