comparison gcc/config/i386/smmintrin.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 1 /* Copyright (C) 2007-2017 Free Software Foundation, Inc.
2 2
3 This file is part of GCC. 3 This file is part of GCC.
4 4
5 GCC is free software; you can redistribute it and/or modify 5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
17 3.1, as published by the Free Software Foundation. 17 3.1, as published by the Free Software Foundation.
18 18
19 You should have received a copy of the GNU General Public License and 19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program; 20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>. */
23
24 23
25 /* Implemented from the specification included in the Intel C++ Compiler 24 /* Implemented from the specification included in the Intel C++ Compiler
26 User Guide and Reference, version 10.0. */ 25 User Guide and Reference, version 10.0. */
27 26
28 #ifndef _SMMINTRIN_H_INCLUDED 27 #ifndef _SMMINTRIN_H_INCLUDED
29 #define _SMMINTRIN_H_INCLUDED 28 #define _SMMINTRIN_H_INCLUDED
30
31 #ifndef __SSE4_1__
32 # error "SSE4.1 instruction set not enabled"
33 #else
34 29
35 /* We need definitions from the SSSE3, SSE3, SSE2 and SSE header 30 /* We need definitions from the SSSE3, SSE3, SSE2 and SSE header
36 files. */ 31 files. */
37 #include <tmmintrin.h> 32 #include <tmmintrin.h>
33
34 #ifndef __SSE4_1__
35 #pragma GCC push_options
36 #pragma GCC target("sse4.1")
37 #define __DISABLE_SSE4_1__
38 #endif /* __SSE4_1__ */
38 39
39 /* Rounding mode macros. */ 40 /* Rounding mode macros. */
40 #define _MM_FROUND_TO_NEAREST_INT 0x00 41 #define _MM_FROUND_TO_NEAREST_INT 0x00
41 #define _MM_FROUND_TO_NEG_INF 0x01 42 #define _MM_FROUND_TO_NEG_INF 0x01
42 #define _MM_FROUND_TO_POS_INF 0x02 43 #define _MM_FROUND_TO_POS_INF 0x02
264 /* Packed integer 64-bit comparison, zeroing or filling with ones 265 /* Packed integer 64-bit comparison, zeroing or filling with ones
265 corresponding parts of result. */ 266 corresponding parts of result. */
266 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 267 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
267 _mm_cmpeq_epi64 (__m128i __X, __m128i __Y) 268 _mm_cmpeq_epi64 (__m128i __X, __m128i __Y)
268 { 269 {
269 return (__m128i) __builtin_ia32_pcmpeqq ((__v2di)__X, (__v2di)__Y); 270 return (__m128i) ((__v2di)__X == (__v2di)__Y);
270 } 271 }
271 272
272 /* Min/max packed integer instructions. */ 273 /* Min/max packed integer instructions. */
273 274
274 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 275 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
322 /* Packed integer 32-bit multiplication with truncation of upper 323 /* Packed integer 32-bit multiplication with truncation of upper
323 halves of results. */ 324 halves of results. */
324 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 325 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
325 _mm_mullo_epi32 (__m128i __X, __m128i __Y) 326 _mm_mullo_epi32 (__m128i __X, __m128i __Y)
326 { 327 {
327 return (__m128i) __builtin_ia32_pmulld128 ((__v4si)__X, (__v4si)__Y); 328 return (__m128i) ((__v4su)__X * (__v4su)__Y);
328 } 329 }
329 330
330 /* Packed integer 32-bit multiplication of 2 pairs of operands 331 /* Packed integer 32-bit multiplication of 2 pairs of operands
331 with two 64-bit results. */ 332 with two 64-bit results. */
332 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 333 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
581 _mm_stream_load_si128 (__m128i *__X) 582 _mm_stream_load_si128 (__m128i *__X)
582 { 583 {
583 return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __X); 584 return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __X);
584 } 585 }
585 586
586 #ifdef __SSE4_2__ 587 #ifndef __SSE4_2__
588 #pragma GCC push_options
589 #pragma GCC target("sse4.2")
590 #define __DISABLE_SSE4_2__
591 #endif /* __SSE4_2__ */
587 592
588 /* These macros specify the source data format. */ 593 /* These macros specify the source data format. */
589 #define _SIDD_UBYTE_OPS 0x00 594 #define _SIDD_UBYTE_OPS 0x00
590 #define _SIDD_UWORD_OPS 0x01 595 #define _SIDD_UWORD_OPS 0x01
591 #define _SIDD_SBYTE_OPS 0x02 596 #define _SIDD_SBYTE_OPS 0x02
595 #define _SIDD_CMP_EQUAL_ANY 0x00 600 #define _SIDD_CMP_EQUAL_ANY 0x00
596 #define _SIDD_CMP_RANGES 0x04 601 #define _SIDD_CMP_RANGES 0x04
597 #define _SIDD_CMP_EQUAL_EACH 0x08 602 #define _SIDD_CMP_EQUAL_EACH 0x08
598 #define _SIDD_CMP_EQUAL_ORDERED 0x0c 603 #define _SIDD_CMP_EQUAL_ORDERED 0x0c
599 604
600 /* These macros specify the the polarity. */ 605 /* These macros specify the polarity. */
601 #define _SIDD_POSITIVE_POLARITY 0x00 606 #define _SIDD_POSITIVE_POLARITY 0x00
602 #define _SIDD_NEGATIVE_POLARITY 0x10 607 #define _SIDD_NEGATIVE_POLARITY 0x10
603 #define _SIDD_MASKED_POSITIVE_POLARITY 0x20 608 #define _SIDD_MASKED_POSITIVE_POLARITY 0x20
604 #define _SIDD_MASKED_NEGATIVE_POLARITY 0x30 609 #define _SIDD_MASKED_NEGATIVE_POLARITY 0x30
605 610
788 /* Packed integer 64-bit comparison, zeroing or filling with ones 793 /* Packed integer 64-bit comparison, zeroing or filling with ones
789 corresponding parts of result. */ 794 corresponding parts of result. */
790 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 795 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
791 _mm_cmpgt_epi64 (__m128i __X, __m128i __Y) 796 _mm_cmpgt_epi64 (__m128i __X, __m128i __Y)
792 { 797 {
793 return (__m128i) __builtin_ia32_pcmpgtq ((__v2di)__X, (__v2di)__Y); 798 return (__m128i) ((__v2di)__X > (__v2di)__Y);
794 } 799 }
795 800
796 #ifdef __POPCNT__ 801 #ifdef __DISABLE_SSE4_2__
802 #undef __DISABLE_SSE4_2__
803 #pragma GCC pop_options
804 #endif /* __DISABLE_SSE4_2__ */
805
806 #ifdef __DISABLE_SSE4_1__
807 #undef __DISABLE_SSE4_1__
808 #pragma GCC pop_options
809 #endif /* __DISABLE_SSE4_1__ */
810
797 #include <popcntintrin.h> 811 #include <popcntintrin.h>
798 #endif 812
813 #ifndef __SSE4_1__
814 #pragma GCC push_options
815 #pragma GCC target("sse4.1")
816 #define __DISABLE_SSE4_1__
817 #endif /* __SSE4_1__ */
818
819 #ifndef __SSE4_2__
820 #pragma GCC push_options
821 #pragma GCC target("sse4.2")
822 #define __DISABLE_SSE4_2__
823 #endif /* __SSE4_1__ */
799 824
800 /* Accumulate CRC32 (polynomial 0x11EDC6F41) value. */ 825 /* Accumulate CRC32 (polynomial 0x11EDC6F41) value. */
801 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 826 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
802 _mm_crc32_u8 (unsigned int __C, unsigned char __V) 827 _mm_crc32_u8 (unsigned int __C, unsigned char __V)
803 { 828 {
822 { 847 {
823 return __builtin_ia32_crc32di (__C, __V); 848 return __builtin_ia32_crc32di (__C, __V);
824 } 849 }
825 #endif 850 #endif
826 851
827 #endif /* __SSE4_2__ */ 852 #ifdef __DISABLE_SSE4_2__
828 853 #undef __DISABLE_SSE4_2__
829 #endif /* __SSE4_1__ */ 854 #pragma GCC pop_options
855 #endif /* __DISABLE_SSE4_2__ */
856
857 #ifdef __DISABLE_SSE4_1__
858 #undef __DISABLE_SSE4_1__
859 #pragma GCC pop_options
860 #endif /* __DISABLE_SSE4_1__ */
830 861
831 #endif /* _SMMINTRIN_H_INCLUDED */ 862 #endif /* _SMMINTRIN_H_INCLUDED */