2023-06-05 07:37:25 +00:00
|
|
|
#if defined(__x86_64__) && !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
#ifndef _X86GPRINTRIN_H_INCLUDED
|
|
|
|
#define _X86GPRINTRIN_H_INCLUDED
|
Release Cosmopolitan v3.3
This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker
appears to have changed things so that only a single de-duplicated str
table is present in the binary, and it gets placed wherever the linker
wants, regardless of what the linker script says. To cope with that we
need to stop using .ident to embed licenses. As such, this change does
significant work to revamp how third party licenses are defined in the
codebase, using `.section .notice,"aR",@progbits`.
This new GCC 12.3 toolchain has support for GNU indirect functions. It
lets us support __target_clones__ for the first time. This is used for
optimizing the performance of libc string functions such as strlen and
friends so far on x86, by ensuring AVX systems favor a second codepath
that uses VEX encoding. It shaves some latency off certain operations.
It's a useful feature to have for scientific computing for the reasons
explained by the test/libcxx/openmp_test.cc example which compiles for
fifteen different microarchitectures. Thanks to the upgrades, it's now
also possible to use newer instruction sets, such as AVX512FP16, VNNI.
Cosmo now uses the %gs register on x86 by default for TLS. Doing it is
helpful for any program that links `cosmo_dlopen()`. Such programs had
to recompile their binaries at startup to change the TLS instructions.
That's not great, since it means every page in the executable needs to
be faulted. The work of rewriting TLS-related x86 opcodes, is moved to
fixupobj.com instead. This is great news for MacOS x86 users, since we
previously needed to morph the binary every time for that platform but
now that's no longer necessary. The only platforms where we need fixup
of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On
Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc
assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the
kernels do not allow us to specify a value for the %gs register.
OpenBSD users are now required to use APE Loader to run Cosmo binaries
and assimilation is no longer possible. OpenBSD kernel needs to change
to allow programs to specify a value for the %gs register, or it needs
to stop marking executable pages loaded by the kernel as mimmutable().
This release fixes __constructor__, .ctor, .init_array, and lastly the
.preinit_array so they behave the exact same way as glibc.
We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 19:12:09 +00:00
|
|
|
#if !defined _SOFT_FLOAT || defined __MMX__ || defined __SSE__
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("general-regs-only")
|
|
|
|
#define __DISABLE_GENERAL_REGS_ONLY__
|
|
|
|
#endif
|
2023-06-05 07:37:25 +00:00
|
|
|
#include "third_party/intel/ia32intrin.internal.h"
|
|
|
|
#ifndef __iamcu__
|
|
|
|
#include "third_party/intel/adxintrin.internal.h"
|
|
|
|
#include "third_party/intel/bmiintrin.internal.h"
|
|
|
|
#include "third_party/intel/bmi2intrin.internal.h"
|
|
|
|
#include "third_party/intel/cetintrin.internal.h"
|
|
|
|
#include "third_party/intel/cldemoteintrin.internal.h"
|
|
|
|
#include "third_party/intel/clflushoptintrin.internal.h"
|
|
|
|
#include "third_party/intel/clwbintrin.internal.h"
|
|
|
|
#include "third_party/intel/clzerointrin.internal.h"
|
|
|
|
#include "third_party/intel/enqcmdintrin.internal.h"
|
|
|
|
#include "third_party/intel/fxsrintrin.internal.h"
|
|
|
|
#include "third_party/intel/lzcntintrin.internal.h"
|
|
|
|
#include "third_party/intel/lwpintrin.internal.h"
|
|
|
|
#include "third_party/intel/movdirintrin.internal.h"
|
Release Cosmopolitan v3.3
This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker
appears to have changed things so that only a single de-duplicated str
table is present in the binary, and it gets placed wherever the linker
wants, regardless of what the linker script says. To cope with that we
need to stop using .ident to embed licenses. As such, this change does
significant work to revamp how third party licenses are defined in the
codebase, using `.section .notice,"aR",@progbits`.
This new GCC 12.3 toolchain has support for GNU indirect functions. It
lets us support __target_clones__ for the first time. This is used for
optimizing the performance of libc string functions such as strlen and
friends so far on x86, by ensuring AVX systems favor a second codepath
that uses VEX encoding. It shaves some latency off certain operations.
It's a useful feature to have for scientific computing for the reasons
explained by the test/libcxx/openmp_test.cc example which compiles for
fifteen different microarchitectures. Thanks to the upgrades, it's now
also possible to use newer instruction sets, such as AVX512FP16, VNNI.
Cosmo now uses the %gs register on x86 by default for TLS. Doing it is
helpful for any program that links `cosmo_dlopen()`. Such programs had
to recompile their binaries at startup to change the TLS instructions.
That's not great, since it means every page in the executable needs to
be faulted. The work of rewriting TLS-related x86 opcodes, is moved to
fixupobj.com instead. This is great news for MacOS x86 users, since we
previously needed to morph the binary every time for that platform but
now that's no longer necessary. The only platforms where we need fixup
of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On
Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc
assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the
kernels do not allow us to specify a value for the %gs register.
OpenBSD users are now required to use APE Loader to run Cosmo binaries
and assimilation is no longer possible. OpenBSD kernel needs to change
to allow programs to specify a value for the %gs register, or it needs
to stop marking executable pages loaded by the kernel as mimmutable().
This release fixes __constructor__, .ctor, .init_array, and lastly the
.preinit_array so they behave the exact same way as glibc.
We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 19:12:09 +00:00
|
|
|
#include "third_party/intel/mwaitintrin.internal.h"
|
2023-06-05 07:37:25 +00:00
|
|
|
#include "third_party/intel/mwaitxintrin.internal.h"
|
|
|
|
#include "third_party/intel/pconfigintrin.internal.h"
|
|
|
|
#include "third_party/intel/popcntintrin.internal.h"
|
|
|
|
#include "third_party/intel/pkuintrin.internal.h"
|
|
|
|
#include "third_party/intel/rdseedintrin.internal.h"
|
|
|
|
#include "third_party/intel/rtmintrin.internal.h"
|
|
|
|
#include "third_party/intel/serializeintrin.internal.h"
|
|
|
|
#include "third_party/intel/sgxintrin.internal.h"
|
|
|
|
#include "third_party/intel/tbmintrin.internal.h"
|
|
|
|
#include "third_party/intel/tsxldtrkintrin.internal.h"
|
|
|
|
#include "third_party/intel/uintrintrin.internal.h"
|
|
|
|
#include "third_party/intel/waitpkgintrin.internal.h"
|
|
|
|
#include "third_party/intel/wbnoinvdintrin.internal.h"
|
|
|
|
#include "third_party/intel/xsaveintrin.internal.h"
|
|
|
|
#include "third_party/intel/xsavecintrin.internal.h"
|
|
|
|
#include "third_party/intel/xsaveoptintrin.internal.h"
|
|
|
|
#include "third_party/intel/xsavesintrin.internal.h"
|
|
|
|
#include "third_party/intel/xtestintrin.internal.h"
|
|
|
|
#include "third_party/intel/hresetintrin.internal.h"
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_wbinvd (void)
|
|
|
|
{
|
|
|
|
__builtin_ia32_wbinvd ();
|
|
|
|
}
|
|
|
|
#ifndef __RDRND__
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("rdrnd")
|
|
|
|
#define __DISABLE_RDRND__
|
|
|
|
#endif
|
|
|
|
extern __inline int
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_rdrand16_step (unsigned short *__P)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdrand16_step (__P);
|
|
|
|
}
|
|
|
|
extern __inline int
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_rdrand32_step (unsigned int *__P)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdrand32_step (__P);
|
|
|
|
}
|
|
|
|
#ifdef __DISABLE_RDRND__
|
|
|
|
#undef __DISABLE_RDRND__
|
|
|
|
#pragma GCC pop_options
|
|
|
|
#endif
|
|
|
|
#ifndef __RDPID__
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("rdpid")
|
|
|
|
#define __DISABLE_RDPID__
|
|
|
|
#endif
|
|
|
|
extern __inline unsigned int
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_rdpid_u32 (void)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdpid ();
|
|
|
|
}
|
|
|
|
#ifdef __DISABLE_RDPID__
|
|
|
|
#undef __DISABLE_RDPID__
|
|
|
|
#pragma GCC pop_options
|
|
|
|
#endif
|
|
|
|
#ifdef __x86_64__
|
|
|
|
#ifndef __FSGSBASE__
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("fsgsbase")
|
|
|
|
#define __DISABLE_FSGSBASE__
|
|
|
|
#endif
|
|
|
|
extern __inline unsigned int
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_readfsbase_u32 (void)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdfsbase32 ();
|
|
|
|
}
|
|
|
|
extern __inline unsigned long long
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_readfsbase_u64 (void)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdfsbase64 ();
|
|
|
|
}
|
|
|
|
extern __inline unsigned int
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_readgsbase_u32 (void)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdgsbase32 ();
|
|
|
|
}
|
|
|
|
extern __inline unsigned long long
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_readgsbase_u64 (void)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdgsbase64 ();
|
|
|
|
}
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_writefsbase_u32 (unsigned int __B)
|
|
|
|
{
|
|
|
|
__builtin_ia32_wrfsbase32 (__B);
|
|
|
|
}
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_writefsbase_u64 (unsigned long long __B)
|
|
|
|
{
|
|
|
|
__builtin_ia32_wrfsbase64 (__B);
|
|
|
|
}
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_writegsbase_u32 (unsigned int __B)
|
|
|
|
{
|
|
|
|
__builtin_ia32_wrgsbase32 (__B);
|
|
|
|
}
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_writegsbase_u64 (unsigned long long __B)
|
|
|
|
{
|
|
|
|
__builtin_ia32_wrgsbase64 (__B);
|
|
|
|
}
|
|
|
|
#ifdef __DISABLE_FSGSBASE__
|
|
|
|
#undef __DISABLE_FSGSBASE__
|
|
|
|
#pragma GCC pop_options
|
|
|
|
#endif
|
|
|
|
#ifndef __RDRND__
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("rdrnd")
|
|
|
|
#define __DISABLE_RDRND__
|
|
|
|
#endif
|
|
|
|
extern __inline int
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_rdrand64_step (unsigned long long *__P)
|
|
|
|
{
|
|
|
|
return __builtin_ia32_rdrand64_step (__P);
|
|
|
|
}
|
|
|
|
#ifdef __DISABLE_RDRND__
|
|
|
|
#undef __DISABLE_RDRND__
|
|
|
|
#pragma GCC pop_options
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef __PTWRITE__
|
|
|
|
#pragma GCC push_options
|
|
|
|
#pragma GCC target("ptwrite")
|
|
|
|
#define __DISABLE_PTWRITE__
|
|
|
|
#endif
|
|
|
|
#ifdef __x86_64__
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_ptwrite64 (unsigned long long __B)
|
|
|
|
{
|
|
|
|
__builtin_ia32_ptwrite64 (__B);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
extern __inline void
|
|
|
|
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
|
|
|
_ptwrite32 (unsigned __B)
|
|
|
|
{
|
|
|
|
__builtin_ia32_ptwrite32 (__B);
|
|
|
|
}
|
|
|
|
#ifdef __DISABLE_PTWRITE__
|
|
|
|
#undef __DISABLE_PTWRITE__
|
|
|
|
#pragma GCC pop_options
|
|
|
|
#endif
|
|
|
|
#endif
|
Release Cosmopolitan v3.3
This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker
appears to have changed things so that only a single de-duplicated str
table is present in the binary, and it gets placed wherever the linker
wants, regardless of what the linker script says. To cope with that we
need to stop using .ident to embed licenses. As such, this change does
significant work to revamp how third party licenses are defined in the
codebase, using `.section .notice,"aR",@progbits`.
This new GCC 12.3 toolchain has support for GNU indirect functions. It
lets us support __target_clones__ for the first time. This is used for
optimizing the performance of libc string functions such as strlen and
friends so far on x86, by ensuring AVX systems favor a second codepath
that uses VEX encoding. It shaves some latency off certain operations.
It's a useful feature to have for scientific computing for the reasons
explained by the test/libcxx/openmp_test.cc example which compiles for
fifteen different microarchitectures. Thanks to the upgrades, it's now
also possible to use newer instruction sets, such as AVX512FP16, VNNI.
Cosmo now uses the %gs register on x86 by default for TLS. Doing it is
helpful for any program that links `cosmo_dlopen()`. Such programs had
to recompile their binaries at startup to change the TLS instructions.
That's not great, since it means every page in the executable needs to
be faulted. The work of rewriting TLS-related x86 opcodes, is moved to
fixupobj.com instead. This is great news for MacOS x86 users, since we
previously needed to morph the binary every time for that platform but
now that's no longer necessary. The only platforms where we need fixup
of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On
Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc
assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the
kernels do not allow us to specify a value for the %gs register.
OpenBSD users are now required to use APE Loader to run Cosmo binaries
and assimilation is no longer possible. OpenBSD kernel needs to change
to allow programs to specify a value for the %gs register, or it needs
to stop marking executable pages loaded by the kernel as mimmutable().
This release fixes __constructor__, .ctor, .init_array, and lastly the
.preinit_array so they behave the exact same way as glibc.
We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 19:12:09 +00:00
|
|
|
#ifdef __DISABLE_GENERAL_REGS_ONLY__
|
|
|
|
#undef __DISABLE_GENERAL_REGS_ONLY__
|
|
|
|
#pragma GCC pop_options
|
|
|
|
#endif
|
2023-06-05 07:37:25 +00:00
|
|
|
#endif
|
|
|
|
#endif
|