new file mode 100644
@@ -0,0 +1,36 @@
+/* haszero.h -- function for zero byte detection. Alpha version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef HASZERO_H
+#define HASZERO_H 1
+
+static inline unsigned long int
+haszero(unsigned long int x)
+{
+ return __builtin_alpha_cmpbge (0, x);
+}
+
+/* Likewise, but for two words simultaneously. */
+
+static inline unsigned long int
+haszero2(unsigned long int x1, unsigned long int x2)
+{
+ return __builtin_alpha_cmpbge (0, x1) | __builtin_alpha_cmpbge (0, x2);
+}
+
+#endif /* haszero.h */
new file mode 100644
@@ -0,0 +1,55 @@
+/* whichzero.h -- functions for zero byte searching. Alpha version.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef WHICHZERO_H
+#define WHICHZERO_H 1
+
+/* A subroutine for the whichzero and whichzero2 functions. Given a
+ test word C, return the index of the first byte in memory order
+ that contains 0x80 (all other bits will be zero). */
+
+static inline unsigned int
+whichzero_ffs(unsigned long int c)
+{
+#ifdef __alpha_cix__
+ return __builtin_ctzl (c);
+#else
+ c = c & -c;
+ return (c & 0xf0 ? 4 : 0) + (c & 0xcc ? 2 : 0) + (c & 0xaa ? 1 : 0);
+#endif
+}
+
+/* Given a long that is known to contain a zero byte, return the
+ index of the first such within the long in host memory order. */
+
+static inline unsigned int
+whichzero(unsigned long int x)
+{
+ return whichzero_ffs (__builtin_alpha_cmpbge (0, x));
+}
+
+/* Similarly, but perform the test for two longs simultaneously. */
+
+static inline unsigned int
+whichzero2(unsigned long int x1, unsigned long int x2)
+{
+ return whichzero_ffs (__builtin_alpha_cmpbge (0, x1)
+ | __builtin_alpha_cmpbge (0, x2));
+}
+
+#endif /* whichzero.h */