[PATCH, v8] Vectorized _cpp_clean_line

Andi Kleen ak@linux.intel.com
Sun Aug 22 11:20:00 GMT 2010


On Sat, Aug 21, 2010 at 12:18:09PM -0700, Richard Henderson wrote:
> Changes since last:
> 
> Added Altivec and MMX2 alternatives.

Thanks. To be honest I'm not sure there are enough non SSE2 x86 boxes
around used for compiling that makes the MMX variant worth keeping around.
Perhaps with only three alternatives the if would work again.
But it's nice that you wrote it.

> +  /* Check for unaligned input.  */
> +  if (si & 15)
> +    {
> +      if (__builtin_expect (end - s < 16, 0)
> +	  && __builtin_expect ((si & 0xfff) > 0xff0, 0))

OT but I thought __builtin_expect supported &&. Not true?

> +	{
> +	  /* There are less than 16 bytes left in the buffer, and less
> +	     than 16 bytes left on the page.  Reading 16 bytes at this
> +	     point might generate a spurious page fault.  Defer to the
> +	     SSE2 implementation, which already handles alignment.  */
> +	  return search_line_sse2 (s, end);
> +	}
> +
> +      /* ??? The builtin doesn't understand that the PCMPESTRI read from

Can we fix the builtin?

> +
> +  /* Main loop, processing 16 bytes at a time.  By doing the whole loop
> +     in inline assembly, we can make proper use of the flags set.  */
> +  __asm (      "sub $16, %1\n"
> +	"	.balign 16\n"
> +	"0:	add $16, %1\n"
> +	"	%vpcmpestri $0, (%1), %2\n"
> +	"	jnc 0b"
> +	: "=&c"(index), "+r"(s)
> +	: "x"(search), "a"(4), "d"(16));

I'm wondering, could we add a new builtin that supports returning 
the flags directly? 

-Andi



More information about the Gcc-patches mailing list