This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] A new meta intrinsic header file for current and future x86 instrinsics.


Hi,

This patch will replace gmmintrin.h with avxintrin.h. And implement a new file named immintrin.h. And from now on never use avxintrin.h directly, include immintrin.h instead. OK for mainline?

Thanks,
Xuepeng Guo

2008-11-05  H.J. Lu  <hongjiu.lu@intel.com>
            Xuepeng Guo  <xuepeng.guo@intel.com>
       
       * config.gcc (extra_headers): For x86 and x86-64, remove
       gmmintrin.h, add immintrin.h and avxintrin.h.
       * config/i386/avxintrin.h: New.
       * config/i386/immintrin.h: Likewise.
       * config/i386/gmmintrin.h: Removed.
       * config/i386/avxintrin.h: Don't include intrinsics if
        _IMMINTRIN_H_INCLUDED is undedined.
       * gcc.target/i386/avx-1.c: Include <immintrin.h> instead of
       <gmmintrin.h>.
       * g++.dg/other/i386-5.C: Likewise.
       * g++.dg/other/i386-6.C: Likewise.
       * gcc.target/i386/avx-2.c: Likewise.
       * gcc.target/i386/m256-check.h: Likewise.

I quoted the related mails here for your reference:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi,

Icc will introduce <immintrin.h> to support intrinsics for current and
future instruction sets,
starting with AVX. We will submit a patch to implement <immintrin.h>,
which will look like:

---
#ifndef _IMMINTRIN_H_INCLUDED
#define _IMMINTRIN_H_INCLUDED

#ifdef __MMX__
#include <mmintrin.h>
#endif

#ifdef __SSE__
#include <xmmintrin.h>
#endif

#ifdef __SSE2__
#include <emmintrin.h>
#endif

#ifdef __SSE3__
#include <pmmintrin.h>
#endif

#ifdef __SSSE3__
#include <tmmintrin.h>
#endif

#if defined (__SSE4_2__) || defined (__SSE4_1__)
#include <smmintrin.h>
#endif

#if defined (__AES__) || defined (__PCLMUL__)
#include <wmmintrin.h>
#endif

#ifdef __AVX__
AVX intrinsics
#endif

#endif /* _IMMINTRIN_H_INCLUDED */
---

My question is if we should put AVX intrinsics directly in immintrin.h or in
a separate file. If we put AVX and future intrinsics directly in immintrin.h,
immintrin.h may become very large and harder to maintain. Another
choice is to put AVX intrinsics in a separate file, saying avxintrin.h:

#ifndef _IMMINTRIN_H_INCLUDED
# error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
#else
AVX intrinsics
#endif /* _IMMINTRIN_H_INCLUDED */

Any comments?

Thanks.


-- 
H.J.


On Mon, Nov 03, 2008 at 02:17:40PM -0800, H.J. Lu wrote:
> My question is if we should put AVX intrinsics directly in immintrin.h or in
> a separate file. If we put AVX and future intrinsics directly in immintrin.h,
> immintrin.h may become very large and harder to maintain. Another
> choice is to put AVX intrinsics in a separate file, saying avxintrin.h:
> 
> #ifndef _IMMINTRIN_H_INCLUDED
> # error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
> #else
> AVX intrinsics
> #endif /* _IMMINTRIN_H_INCLUDED */

I think a separate header with such an error is better.
Note, you can just #endif right after the error and put AVX intrinsics in
the file, no need to have everything inside of the #else.

	Jakub

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Attachment: immintrin.patch
Description: immintrin.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]