gcc/libgcc/config/i386
H.J. Lu 59a95143dd x86: Add <x86gprintrin.h>
For sources which can't use any vector instructions, <x86intrin.h> and
<immintrin.h> cannot be included for compiler intrinsics:

$ echo "#include <x86intrin.h>" | gcc -S -O2 -mno-sse -mno-mmx -x c -
In file included from /usr/include/stdlib.h:1013,
                 from /usr/lib/gcc/x86_64-redhat-linux/10/include/mm_malloc.h:27,
                 from /usr/lib/gcc/x86_64-redhat-linux/10/include/xmmintrin.h:34,
                 from /usr/lib/gcc/x86_64-redhat-linux/10/include/immintrin.h:29,
                 from /usr/lib/gcc/x86_64-redhat-linux/10/include/x86intrin.h:32,
                 from <stdin>:1:
/usr/include/bits/stdlib-float.h: In function ‘atof’:
/usr/include/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
   26 | {
      | ^
$

libgcc/config/i386/shadow-stack-unwind.h has a workaround:

/* NB: We need _get_ssp and _inc_ssp from <cetintrin.h>.  But we can't
   include <x86intrin.h> which ends up including <mm_malloc.h>, which
   includes <stdlib.h> and <errno.h> unconditionally.  But we can't
   include any libc system headers unconditionally from libgcc.  Avoid
   including <mm_malloc.h> here by defining _IMMINTRIN_H_INCLUDED.  */
 #define _IMMINTRIN_H_INCLUDED
 #include <cetintrin.h>
 #undef _IMMINTRIN_H_INCLUDED

Add a standalone intrinsic header file, <x86gprintrin.h>, to provide
integer only intrinsics.  All integer only intrinsics are placed in
<x86gprintrin.h>.  <x86intrin.h> and <immintrin.h> simply include
<x86gprintrin.h>.

gcc/

	PR target/97148
	* config.gcc (extra_headers): Add x86gprintrin.h.
	* config/i386/adxintrin.h: Check _X86GPRINTRIN_H_INCLUDED for
	<x86gprintrin.h>.
	* config/i386/bmi2intrin.h: Likewise.
	* config/i386/bmiintrin.h: Likewise.
	* config/i386/cetintrin.h: Likewise.
	* config/i386/cldemoteintrin.h: Likewise.
	* config/i386/clflushoptintrin.h: Likewise.
	* config/i386/clwbintrin.h: Likewise.
	* config/i386/enqcmdintrin.h: Likewise.
	* config/i386/fxsrintrin.h: Likewise.
	* config/i386/ia32intrin.h: Likewise.
	* config/i386/lwpintrin.h: Likewise.
	* config/i386/lzcntintrin.h: Likewise.
	* config/i386/movdirintrin.h: Likewise.
	* config/i386/pconfigintrin.h: Likewise.
	* config/i386/pkuintrin.h: Likewise.
	* config/i386/rdseedintrin.h: Likewise.
	* config/i386/rtmintrin.h: Likewise.
	* config/i386/serializeintrin.h: Likewise.
	* config/i386/tbmintrin.h: Likewise.
	* config/i386/tsxldtrkintrin.h: Likewise.
	* config/i386/waitpkgintrin.h: Likewise.
	* config/i386/wbnoinvdintrin.h: Likewise.
	* config/i386/xsavecintrin.h: Likewise.
	* config/i386/xsaveintrin.h: Likewise.
	* config/i386/xsaveoptintrin.h: Likewise.
	* config/i386/xsavesintrin.h: Likewise.
	* config/i386/xtestintrin.h: Likewise.
	* config/i386/immintrin.h: Include <x86gprintrin.h> instead of
	<fxsrintrin.h>, <xsaveintrin.h>, <xsaveoptintrin.h>,
	<xsavesintrin.h>, <xsavecintrin.h>, <lzcntintrin.h>,
	<bmiintrin.h>, <bmi2intrin.h>, <xtestintrin.h>, <cetintrin.h>,
	<movdirintrin.h>, <sgxintrin.h, <pconfigintrin.h>,
	<waitpkgintrin.h>, <cldemoteintrin.h>, <enqcmdintrin.h>,
	<serializeintrin.h>, <tsxldtrkintrin.h>, <adxintrin.h>,
	<clwbintrin.h>, <clflushoptintrin.h>, <wbnoinvdintrin.h> and
	<pkuintrin.h>.
	(_wbinvd): Moved to config/i386/x86gprintrin.h.
	(_rdrand16_step): Likewise.
	(_rdrand32_step): Likewise.
	(_rdpid_u32): Likewise.
	(_readfsbase_u32): Likewise.
	(_readfsbase_u64): Likewise.
	(_readgsbase_u32): Likewise.
	(_readgsbase_u64): Likewise.
	(_writefsbase_u32): Likewise.
	(_writefsbase_u64): Likewise.
	(_writegsbase_u32): Likewise.
	(_writegsbase_u64): Likewise.
	(_rdrand64_step): Likewise.
	(_ptwrite64): Likewise.
	(_ptwrite32): Likewise.
	* config/i386/x86gprintrin.h: New file.
	* config/i386/x86intrin.h: Include <x86gprintrin.h>.  Don't
	include <ia32intrin.h>, <lwpintrin.h>, <tbmintrin.h>,
	<popcntintrin.h>, <mwaitxintrin.h> and <clzerointrin.h>.

gcc/testsuite/

	* gcc.target/i386/avx-1.c (__builtin_ia32_lwpval32): New to
	support <lwpintrin.h> included in <x86gprintrin.h>.
	(__builtin_ia32_lwpval64): Likewise.
	(__builtin_ia32_lwpins32): Likewise.
	(__builtin_ia32_lwpins64): Likewise.
	(__builtin_ia32_bextri_u32): New to support <tbmintrin.h>
	included in <x86gprintrin.h>.
	(__builtin_ia32_bextri_u64): Likewise.
	* gcc.target/i386/x86gprintrin-1.c: New test.
	* gcc.target/i386/x86gprintrin-2.c: Likewise.
	* gcc.target/i386/x86gprintrin-3.c: Likewise.
	* gcc.target/i386/x86gprintrin-4.c: Likewise.
	* gcc.target/i386/x86gprintrin-4a.c: Likewise.
	* gcc.target/i386/x86gprintrin-5.c: Likewise.
	* gcc.target/i386/x86gprintrin-5a.c: Likewise.
	* gcc.target/i386/x86gprintrin-5b.c: Likewise.
	* gcc.target/i386/x86gprintrin-6.c: Likewise.

libgcc/

	PR target/97148
	* config/i386/shadow-stack-unwind.h: Include <x86gprintrin.h>
	instead of <cetintrin.h>.
2020-10-09 05:08:41 -07:00
..
32 Update copyright years. 2020-01-01 12:51:42 +01:00
64
avx_resms64.S
avx_resms64f.S
avx_resms64fx.S
avx_resms64x.S
avx_savms64.S
avx_savms64f.S
cpuinfo.c x86: Move cpuinfo.h from libgcc to common/config/i386 2020-06-24 05:47:34 -07:00
crtfastmath.c Update copyright years. 2020-01-01 12:51:42 +01:00
crti.S Update copyright years. 2020-01-01 12:51:42 +01:00
crtn.S Update copyright years. 2020-01-01 12:51:42 +01:00
crtprec.c Update copyright years. 2020-01-01 12:51:42 +01:00
cygming-crtbegin.c Update copyright years. 2020-01-01 12:51:42 +01:00
cygming-crtend.c Update copyright years. 2020-01-01 12:51:42 +01:00
cygwin.S Update copyright years. 2020-01-01 12:51:42 +01:00
darwin-lib.h Update copyright years. 2020-01-01 12:51:42 +01:00
dragonfly-unwind.h Update copyright years. 2020-01-01 12:51:42 +01:00
elf-lib.h Update copyright years. 2020-01-01 12:51:42 +01:00
enable-execute-stack-mingw32.c Update copyright years. 2020-01-01 12:51:42 +01:00
freebsd-unwind.h Update copyright years. 2020-01-01 12:51:42 +01:00
gnu-unwind.h hurd: libgcc unwinding support over signal trampolines 2020-06-18 00:01:27 +02:00
gthr-win32.c Update copyright years. 2020-01-01 12:51:42 +01:00
gthr-win32.h Update copyright years. 2020-01-01 12:51:42 +01:00
i386-asm.h Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-bsd.ver Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-cygming.ver Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-darwin.10.4.ver Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-darwin.10.5.ver Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-glibc.ver Update copyright years. 2020-01-01 12:51:42 +01:00
libgcc-sol2.ver Update copyright years. 2020-01-01 12:51:42 +01:00
linux-unwind.h Update copyright years. 2020-01-01 12:51:42 +01:00
morestack.S libgcc: increase required stack space for x86_64 -fsplit-stack 2020-08-03 16:01:59 -07:00
resms64.h Update copyright years. 2020-01-01 12:51:42 +01:00
resms64f.h Update copyright years. 2020-01-01 12:51:42 +01:00
resms64fx.h Update copyright years. 2020-01-01 12:51:42 +01:00
resms64x.h Update copyright years. 2020-01-01 12:51:42 +01:00
savms64.h Update copyright years. 2020-01-01 12:51:42 +01:00
savms64f.h Update copyright years. 2020-01-01 12:51:42 +01:00
sfp-exceptions.c i386: Add __attribute__ ((gcc_struct)) to struct fenv [PR95418] 2020-06-01 22:29:20 +02:00
sfp-machine.h
shadow-stack-unwind.h x86: Add <x86gprintrin.h> 2020-10-09 05:08:41 -07:00
sol2-c1.S Update copyright years. 2020-01-01 12:51:42 +01:00
sol2-unwind.h Update copyright years. 2020-01-01 12:51:42 +01:00
sse_resms64.S
sse_resms64f.S
sse_resms64fx.S
sse_resms64x.S
sse_savms64.S
sse_savms64f.S
t-chkstk
t-cpuinfo
t-cpuinfo-static
t-crtpc
t-crtstuff
t-cygming
t-cygwin
t-darwin
t-dlldir
t-dlldir-x
t-dragonfly
t-dw2-eh
t-freebsd
t-gthr-win32
t-linux
t-mingw32
t-mingw-pthread
t-msabi
t-nto
t-seh-eh
t-sjlj-eh
t-slibgcc-cygming
t-softfp
t-sol2
t-stack-i386
value-unwind.h Update copyright years. 2020-01-01 12:51:42 +01:00
w32-unwind.h Update copyright years. 2020-01-01 12:51:42 +01:00