diff mbox

[v8] Vectorized _cpp_clean_line

Message ID 4C72A9CB.3010109@redhat.com
State New
Headers show

Commit Message

Richard Henderson Aug. 23, 2010, 5:03 p.m. UTC
On 08/22/2010 01:35 PM, Gerald Pfeifer wrote:
> On Sat, 21 Aug 2010, Richard Henderson wrote:
>> Tested on {i686,x86_64,ppc64,ia64}-linux.  On the ppc64 box, I used 
>> BOOT_CFLAGS with -mcpu=G5 in order to enable the Altivec path.
> 
> On x86_64-unknown-freebsd8.1 this causes:
> 
> /scratch/tmp/gerald/gcc-HEAD/libcpp/lex.c: Assembler messages:
> /scratch/tmp/gerald/gcc-HEAD/libcpp/lex.c:448: Error: no such instruction: `pcmpestri $0,(%rdi),%xmm0'
> /scratch/tmp/gerald/gcc-HEAD/libcpp/lex.c:432: Error: no such instruction: `pcmpestri $0,(%rdi),%xmm0'
> gmake[3]: *** [lex.o] Error 1
> gmake[3]: Leaving directory `/scratch/tmp/gerald/OBJ-0822-2002/libcpp'
> gmake[2]: *** [all-stage2-libcpp] Error 2
> 
> For various reasons, not the least GPLv3, FreeBSD is stuck with binutils 
> 2.15. :-( The GCC ports explicitly require newer binutils, but if someone 
> installs GCC directly the above is what she'll get.

Try this.


r~

Comments

Joseph Myers Aug. 23, 2010, 5:07 p.m. UTC | #1
On Mon, 23 Aug 2010, Richard Henderson wrote:

> +case $target in
> +  i.86-* | x86_64-*)

I think you mean i?86, not i.86.
Richard Henderson Aug. 23, 2010, 5:22 p.m. UTC | #2
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.


r~
diff mbox

Patch

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 <stddef.h> header file. */
 #undef HAVE_STDDEF_H
 
diff --git a/libcpp/configure b/libcpp/configure
index a2ce1c3..921de2f 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" :)
+  ;
+  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..b017380 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" :)],
+      [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"