From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70575 invoked by alias); 3 Jul 2015 06:16:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70565 invoked by uid 89); 3 Jul 2015 06:16:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f169.google.com Received: from mail-ob0-f169.google.com (HELO mail-ob0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 03 Jul 2015 06:16:40 +0000 Received: by obbkm3 with SMTP id km3so63682577obb.1 for ; Thu, 02 Jul 2015 23:16:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.155.132 with SMTP id vw4mr33268685oeb.51.1435904198643; Thu, 02 Jul 2015 23:16:38 -0700 (PDT) Received: by 10.60.147.170 with HTTP; Thu, 2 Jul 2015 23:16:38 -0700 (PDT) In-Reply-To: <20150703035321.GA7420@gmail.com> References: <20150703035321.GA7420@gmail.com> Date: Fri, 03 Jul 2015 06:16:00 -0000 Message-ID: Subject: Re: [PATCH] PR target/66746: Failure to compile #include with -miamcu From: Uros Bizjak To: "H.J. Lu" Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-07/txt/msg00176.txt.bz2 On Fri, Jul 3, 2015 at 5:53 AM, H.J. Lu wrote: > x86intrin.h has useful intrinsics for instructions for IA MCU. This > patch adds __iamcu__ check to x86intrin.h and ia32intrin.h. > > OK for trunk? > > H.J. > --- > 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. OK. Thanks, Uros. > gcc/config/i386/ia32intrin.h | 16 +++++++++++++++- > gcc/config/i386/x86intrin.h | 5 +++++ > gcc/testsuite/gcc.target/i386/pr66746.c | 10 ++++++++++ > 3 files changed, 30 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gcc.target/i386/pr66746.c > > diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h > index 1f728c8..b8d1c31 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 6f7b1f6..be0a1a1 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/gcc.target/i386/pr66746.c b/gcc/testsuite/gcc.target/i386/pr66746.c > new file mode 100644 > index 0000000..3ef77bf > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/pr66746.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile { target ia32 } } */ > +/* { dg-options "-O2 -miamcu" } */ > + > +/* Defining away "extern" and "__inline" results in all of them being > + compiled as proper functions. */ > + > +#define extern > +#define __inline > + > +#include > -- > 2.4.3 >