summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-18 16:21:42 +0000
committerwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-18 16:21:42 +0000
commiteb9920549e9e77ad824810dd641735e78f8a27d8 (patch)
tree2f0370e9e7b2d836fa9bd4cb064d46a8d6846278 /libcpp
parentadc69d868e92a54026298bbc55c7ea3fb3df7b2e (diff)
downloadgcc-eb9920549e9e77ad824810dd641735e78f8a27d8.tar.gz
2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* lex.c (search_line_fast): Correct for little endian. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204970 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog4
-rw-r--r--libcpp/lex.c9
2 files changed, 13 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 5e38c4b5dff..c3391b4959d 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,7 @@
+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>
* ucnid.tab: Add C11 and C11NOSTART data.
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 99c2140c357..80829d69b98 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -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
mis-alignment. The LVSR instruction pulls the exact shift we
want from the address. */
+#ifdef __BIG_ENDIAN__
mask = __builtin_vec_lvsr(0, s);
mask = __builtin_vec_perm(zero, ones, mask);
+#else
+ mask = __builtin_vec_lvsl(0, s);
+ mask = __builtin_vec_perm(ones, zero, mask);
+#endif
data &= mask;
/* 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)
/* L now contains 0xff in bytes for which we matched one of the
relevant characters. We can find the byte index by finding
its bit index and dividing by 8. */
+#ifdef __BIG_ENDIAN__
l = __builtin_clzl(l) >> 3;
+#else
+ l = __builtin_ctzl(l) >> 3;
+#endif
return s + l;
#undef N