Commit aadce585 by Bill Schmidt Committed by William Schmidt

lex.c (search_line_fast): Correct for little endian.

2013-11-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* lex.c (search_line_fast): Correct for little endian.

From-SVN: r204970
parent ddf05af2
2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* lex.c (search_line_fast): Correct for little endian.
2013-11-15 Joseph Myers <joseph@codesourcery.com> 2013-11-15 Joseph Myers <joseph@codesourcery.com>
* ucnid.tab: Add C11 and C11NOSTART data. * ucnid.tab: Add C11 and C11NOSTART data.
......
...@@ -559,8 +559,13 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) ...@@ -559,8 +559,13 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
beginning with all ones and shifting in zeros according to the beginning with all ones and shifting in zeros according to the
mis-alignment. The LVSR instruction pulls the exact shift we mis-alignment. The LVSR instruction pulls the exact shift we
want from the address. */ want from the address. */
#ifdef __BIG_ENDIAN__
mask = __builtin_vec_lvsr(0, s); mask = __builtin_vec_lvsr(0, s);
mask = __builtin_vec_perm(zero, ones, mask); mask = __builtin_vec_perm(zero, ones, mask);
#else
mask = __builtin_vec_lvsl(0, s);
mask = __builtin_vec_perm(ones, zero, mask);
#endif
data &= mask; data &= mask;
/* While altivec loads mask addresses, we still need to align S so /* While altivec loads mask addresses, we still need to align S so
...@@ -624,7 +629,11 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) ...@@ -624,7 +629,11 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
/* L now contains 0xff in bytes for which we matched one of the /* L now contains 0xff in bytes for which we matched one of the
relevant characters. We can find the byte index by finding relevant characters. We can find the byte index by finding
its bit index and dividing by 8. */ its bit index and dividing by 8. */
#ifdef __BIG_ENDIAN__
l = __builtin_clzl(l) >> 3; l = __builtin_clzl(l) >> 3;
#else
l = __builtin_ctzl(l) >> 3;
#endif
return s + l; return s + l;
#undef N #undef N
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment