From 2fd98c0acf6ab7725349d26a342003b1bd07e8a0 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 3 Jul 2015 12:25:10 +0000 Subject: [PATCH] Add IA MCU support to x86intrin.h x86intrin.h has useful intrinsics for instructions for IA MCU. This patch adds __iamcu__ check to x86intrin.h and ia32intrin.h. gcc/ PR target/66746. * config/i386/ia32intrin.h (__crc32b): Don't define if __iamcu__ is defined. (__crc32w): Likewise. (__crc32d): Likewise. (__rdpmc): Likewise. (__rdtscp): Likewise. (_rdpmc): Likewise. (_rdtscp): Likewise. * config/i386/x86intrin.h: Only include ia32intrin.h if __iamcu__ is defined. gcc/testsuite/ PR target/66746. * gcc.target/i386/pr66746.c: New file. From-SVN: r225376 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/config/i386/ia32intrin.h | 16 +++++++++++++++- gcc/config/i386/x86intrin.h | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 821ffbc6087..0335921e20e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2015-07-03 H.J. Lu + + PR target/66746. + * config/i386/ia32intrin.h (__crc32b): Don't define if __iamcu__ + is defined. + (__crc32w): Likewise. + (__crc32d): Likewise. + (__rdpmc): Likewise. + (__rdtscp): Likewise. + (_rdpmc): Likewise. + (_rdtscp): Likewise. + * config/i386/x86intrin.h: Only include ia32intrin.h if __iamcu__ + is defined. + 2015-07-03 Richard Biener * fold-const.c (fold_mathfn_compare): Remove. diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h index 1f728c840e1..b8d1c315dd4 100644 --- a/gcc/config/i386/ia32intrin.h +++ b/gcc/config/i386/ia32intrin.h @@ -49,6 +49,8 @@ __bswapd (int __X) return __builtin_bswap32 (__X); } +#ifndef __iamcu__ + #ifndef __SSE4_2__ #pragma GCC push_options #pragma GCC target("sse4.2") @@ -82,6 +84,8 @@ __crc32d (unsigned int __C, unsigned int __V) #pragma GCC pop_options #endif /* __DISABLE_SSE4_2__ */ +#endif /* __iamcu__ */ + /* 32bit popcnt */ extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -90,6 +94,8 @@ __popcntd (unsigned int __X) return __builtin_popcount (__X); } +#ifndef __iamcu__ + /* rdpmc */ extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -98,6 +104,8 @@ __rdpmc (int __S) return __builtin_ia32_rdpmc (__S); } +#endif /* __iamcu__ */ + /* rdtsc */ extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -106,6 +114,8 @@ __rdtsc (void) return __builtin_ia32_rdtsc (); } +#ifndef __iamcu__ + /* rdtscp */ extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -114,6 +124,8 @@ __rdtscp (unsigned int *__A) return __builtin_ia32_rdtscp (__A); } +#endif /* __iamcu__ */ + /* 8bit rol */ extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -290,9 +302,11 @@ __writeeflags (unsigned int X) #define _bit_scan_reverse(a) __bsrd(a) #define _bswap(a) __bswapd(a) #define _popcnt32(a) __popcntd(a) +#ifndef __iamcu__ #define _rdpmc(a) __rdpmc(a) -#define _rdtsc() __rdtsc() #define _rdtscp(a) __rdtscp(a) +#endif /* __iamcu__ */ +#define _rdtsc() __rdtsc() #define _rotwl(a,b) __rolw((a), (b)) #define _rotwr(a,b) __rorw((a), (b)) #define _rotl(a,b) __rold((a), (b)) diff --git a/gcc/config/i386/x86intrin.h b/gcc/config/i386/x86intrin.h index 6f7b1f66a6d..be0a1a14a08 100644 --- a/gcc/config/i386/x86intrin.h +++ b/gcc/config/i386/x86intrin.h @@ -26,6 +26,8 @@ #include +#ifndef __iamcu__ + #include #include @@ -86,4 +88,7 @@ #include #include + +#endif /* __iamcu__ */ + #endif /* _X86INTRIN_H_INCLUDED */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aede20a8e50..05344971c99 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-03 H.J. Lu + + PR target/66746. + * gcc.target/i386/pr66746.c: New file. + 2015-07-03 Christophe Lyon * gcc.target/aarch64/advsimd-intrinsics/vget_lane.c: New testcase. -- 2.30.2