[Bug tree-optimization/63464] compare one character to many: faster

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 7 21:01:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464

--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> ---
The SLP version is slightly slower than the bit test in this case (at least on
my old desktop), but it can more easily handle testing for characters that are
not within 64 of each other.

  __m128i b=_mm_set1_epi8(*s);
  __m128i m=_mm_set_epi8('\n','\r',',',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ');
  __m128i e=_mm_cmpeq_epi8(b,m);
  bool found=_mm_movemask_epi8(e)!=0;

Though we are missing REDUC_TRUTH_OR_EXPR to model the last line.



More information about the Gcc-bugs mailing list