From patchwork Mon Aug 23 17:31:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 62500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B4631B6EF7 for ; Tue, 24 Aug 2010 03:31:27 +1000 (EST) Received: (qmail 28499 invoked by alias); 23 Aug 2010 17:31:25 -0000 Received: (qmail 28488 invoked by uid 22791); 23 Aug 2010 17:31:24 -0000 X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL, BAYES_50, KAM_MX3, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD, URIBL_BLACK X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Aug 2010 17:31:19 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7NHV8V8025499 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Aug 2010 13:31:09 -0400 Received: from anchor.twiddle.home (ovpn-113-59.phx2.redhat.com [10.3.113.59]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7NHV8R1007931; Mon, 23 Aug 2010 13:31:08 -0400 Message-ID: <4C72B05C.4050401@redhat.com> Date: Mon, 23 Aug 2010 10:31:08 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Thunderbird/3.1.2 MIME-Version: 1.0 To: "Joseph S. Myers" CC: Gerald Pfeifer , GCC Patches Subject: Re: [PATCH, v8] Vectorized _cpp_clean_line References: <4C702671.2090204@redhat.com> <4C72A9CB.3010109@redhat.com> <4C72AE6C.1030308@redhat.com> In-Reply-To: <4C72AE6C.1030308@redhat.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 08/23/2010 10:22 AM, Richard Henderson wrote: > On 08/23/2010 10:07 AM, Joseph S. Myers wrote: >> On Mon, 23 Aug 2010, Richard Henderson wrote: >> >>> +case $target in >>> + i.86-* | x86_64-*) >> >> I think you mean i?86, not i.86. > > Whoops, yes. ... and looking at the linux log files after the build compileted showed that the test program failed there. The "$0" in the assembler managed to get shell-expanded. Here's a new version with both problems fixed. r~ diff --git a/libcpp/config.in b/libcpp/config.in index 95606c1..29d4501 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -185,6 +185,9 @@ /* Define to 1 if you have the `putc_unlocked' function. */ #undef HAVE_PUTC_UNLOCKED +/* Define to 1 if you can assemble SSE4 insns. */ +#undef HAVE_SSE4 + /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H diff --git a/libcpp/configure b/libcpp/configure index a2ce1c3..012ee41 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -7209,6 +7209,27 @@ cat >>confdefs.h <<_ACEOF _ACEOF +case $target in + i?86-* | x86_64-*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm ("pcmpestri %0, %%xmm0, %%xmm1" : : "i"(0)) + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_SSE4 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +esac + # Output. ac_config_headers="$ac_config_headers config.h:config.in" diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 1250f49..8082117 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -184,6 +184,13 @@ AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int, [Define to the widest efficient host integer type at least as wide as the target's size_t type.]) +case $target in + i?86-* | x86_64-*) + AC_TRY_COMPILE([], [asm ("pcmpestri %0, %%xmm0, %%xmm1" : : "i"(0))], + [AC_DEFINE([HAVE_SSE4], [1], + [Define to 1 if you can assemble SSE4 insns.])]) +esac + # Output. AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1]) diff --git a/libcpp/lex.c b/libcpp/lex.c index bc0086d..147ed96 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -400,6 +400,7 @@ search_line_sse2 (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) return (const uchar *)p + found; } +#ifdef HAVE_SSE4 /* A version of the fast scanner using SSE 4.2 vectorized string insns. */ static const uchar * @@ -454,6 +455,11 @@ search_line_sse42 (const uchar *s, const uchar *end) return s + index; } +#else +/* Work around out-dated assemblers without sse4 support. */ +#define search_line_sse42 search_line_sse2 +#endif + /* Check the CPU capabilities. */ #include "../gcc/config/i386/cpuid.h"