about summary refs log tree commit diff
path: root/iconvdata
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2014-02-10 14:45:42 +0100
committerOndřej Bílka <neleai@seznam.cz>2014-02-10 15:07:12 +0100
commita1ffb40e32741f992c743e7b16c061fefa3747ac (patch)
tree246a29a87b26cfd5d07b17070f85eb3785018de9 /iconvdata
parent1448f3244714a9dabb5240ec18b094f100887d5c (diff)
downloadglibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.gz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.tar.xz
glibc-a1ffb40e32741f992c743e7b16c061fefa3747ac.zip
Use glibc_likely instead __builtin_expect.
Diffstat (limited to 'iconvdata')
-rw-r--r--iconvdata/8bit-gap.c2
-rw-r--r--iconvdata/ansi_x3.110.c2
-rw-r--r--iconvdata/big5.c4
-rw-r--r--iconvdata/big5hkscs.c18
-rw-r--r--iconvdata/cp1255.c10
-rw-r--r--iconvdata/cp1258.c8
-rw-r--r--iconvdata/cp932.c4
-rw-r--r--iconvdata/euc-cn.c6
-rw-r--r--iconvdata/euc-jisx0213.c24
-rw-r--r--iconvdata/euc-jp-ms.c12
-rw-r--r--iconvdata/euc-jp.c8
-rw-r--r--iconvdata/euc-kr.c6
-rw-r--r--iconvdata/gb18030.c4
-rw-r--r--iconvdata/gbbig5.c14
-rw-r--r--iconvdata/gbgbk.c10
-rw-r--r--iconvdata/gbk.c2
-rw-r--r--iconvdata/ibm1364.c16
-rw-r--r--iconvdata/ibm930.c14
-rw-r--r--iconvdata/ibm932.c10
-rw-r--r--iconvdata/ibm933.c14
-rw-r--r--iconvdata/ibm935.c14
-rw-r--r--iconvdata/ibm937.c14
-rw-r--r--iconvdata/ibm939.c14
-rw-r--r--iconvdata/ibm943.c10
-rw-r--r--iconvdata/iso-2022-cn-ext.c2
-rw-r--r--iconvdata/iso-2022-cn.c16
-rw-r--r--iconvdata/iso-2022-jp-3.c40
-rw-r--r--iconvdata/iso-2022-jp.c44
-rw-r--r--iconvdata/iso-2022-kr.c12
-rw-r--r--iconvdata/iso646.c2
-rw-r--r--iconvdata/iso8859-1.c2
-rw-r--r--iconvdata/iso_11548-1.c2
-rw-r--r--iconvdata/iso_6937-2.c6
-rw-r--r--iconvdata/iso_6937.c8
-rw-r--r--iconvdata/johab.c12
-rw-r--r--iconvdata/shift_jisx0213.c20
-rw-r--r--iconvdata/sjis.c8
-rw-r--r--iconvdata/t.61.c4
-rw-r--r--iconvdata/tcvn5712-1.c6
-rw-r--r--iconvdata/tscii.c44
-rw-r--r--iconvdata/uhc.c12
-rw-r--r--iconvdata/unicode.c8
-rw-r--r--iconvdata/utf-16.c22
-rw-r--r--iconvdata/utf-32.c10
-rw-r--r--iconvdata/utf-7.c12
45 files changed, 266 insertions, 266 deletions
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index bc210260ec..b33a6eafdb 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -88,7 +88,7 @@ struct gap
     uint32_t ch = get32 (inptr);					      \
     unsigned char res;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 	rp = NULL;							      \
diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c
index 8b490d182a..9b67e62dc3 100644
--- a/iconvdata/ansi_x3.110.c
+++ b/iconvdata/ansi_x3.110.c
@@ -567,7 +567,7 @@ static const char from_ucs4[][2] =
     /* Now test for a possible second byte and write this if possible.  */    \
     if (cp[1] != '\0')							      \
       {									      \
-	if (__builtin_expect (outptr >= outend, 0))	 		      \
+	if (__glibc_unlikely (outptr >= outend))			      \
 	  {								      \
 	    /* The result does not fit into the buffer.  */		      \
 	    --outptr;							      \
diff --git a/iconvdata/big5.c b/iconvdata/big5.c
index 2a5887b1f0..4c8df8e7e0 100644
--- a/iconvdata/big5.c
+++ b/iconvdata/big5.c
@@ -8401,7 +8401,7 @@ static const char from_ucs4_tab15[][2] =
 	uint32_t ch2;							      \
 	int idx;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  */		      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
@@ -8426,7 +8426,7 @@ static const char from_ucs4_tab15[][2] =
 	ch = big5_to_ucs[idx];						      \
 									      \
 	/* Is this character defined?  */				      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (2);				      \
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
index 90a9bfcf89..6084bd81c8 100644
--- a/iconvdata/big5hkscs.c
+++ b/iconvdata/big5hkscs.c
@@ -17774,7 +17774,7 @@ static struct
     {									      \
       if (FROM_DIRECTION)						      \
 	{								      \
-	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 4 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      *((uint32_t *) outbuf) = data->__statep->__count >> 3;	      \
@@ -17787,7 +17787,7 @@ static struct
 	}								      \
       else								      \
 	{								      \
-	  if (__builtin_expect (outbuf + 2 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 2 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      uint32_t lasttwo = data->__statep->__count >> 3;		      \
@@ -17814,7 +17814,7 @@ static struct
 									      \
     /* Determine whether there is a buffered character pending.  */	      \
     ch = *statep >> 3;							      \
-    if (__builtin_expect (ch == 0, 1))					      \
+    if (__glibc_likely (ch == 0))					      \
       {									      \
 	/* No - so look at the next input byte.  */			      \
 	ch = *inptr;							      \
@@ -17826,7 +17826,7 @@ static struct
 	    uint32_t ch2;						      \
 	    int idx;							      \
 									      \
-	    if (__builtin_expect (inptr + 1 >= inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	      {								      \
 		/* The second character is not available.  */		      \
 		result = __GCONV_INCOMPLETE_INPUT;			      \
@@ -17887,7 +17887,7 @@ static struct
 									      \
 	    inptr += 2;							      \
 	  }								      \
-	else if (__builtin_expect (ch == 0xff, 0))			      \
+	else if (__glibc_unlikely (ch == 0xff))				      \
 	  {								      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	  }								      \
@@ -17937,7 +17937,7 @@ static struct
 	  goto not_combining;						      \
 									      \
 	/* Output the combined character.  */				      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -17950,7 +17950,7 @@ static struct
 									      \
       not_combining:							      \
 	/* Output the buffered character.  */				      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -17992,7 +17992,7 @@ static struct
 	else								      \
 	  {								      \
 	   /* Check for possible combining character.  */		      \
-	    if (__builtin_expect (ch == 0xca || ch == 0xea, 0))		      \
+	    if (__glibc_unlikely (ch == 0xca || ch == 0xea))		      \
 	      {								      \
 		*statep = ((cp[0] << 8) | cp[1]) << 3;			      \
 		inptr += 4;						      \
@@ -18009,7 +18009,7 @@ static struct
 	      }								      \
 									      \
 	    *outptr++ = cp[0];						      \
-	    if (__builtin_expect (cp[1] != '\0', 1))			      \
+	    if (__glibc_likely (cp[1] != '\0'))				      \
 	      *outptr++ = cp[1];					      \
 	  }								      \
       }									      \
diff --git a/iconvdata/cp1255.c b/iconvdata/cp1255.c
index 9a05d3020c..3106d2062f 100644
--- a/iconvdata/cp1255.c
+++ b/iconvdata/cp1255.c
@@ -65,7 +65,7 @@
     {									      \
       if (FROM_DIRECTION)						      \
 	{								      \
-	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 4 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      *((uint32_t *) outbuf) = data->__statep->__count >> 3;	      \
@@ -201,7 +201,7 @@ static const struct { unsigned int idx; unsigned int len; } comp_table[8] = {
     if (ch >= 0x80)							      \
       {									      \
 	ch = to_ucs4[ch - 0x80];					      \
-	if (__builtin_expect (ch == L'\0', 0))				      \
+	if (__glibc_unlikely (ch == L'\0'))				      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
@@ -463,7 +463,7 @@ static const struct {
 	    res = 0;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (res != 0, 1))				      \
+	if (__glibc_likely (res != 0))					      \
 	  {								      \
 	    *outptr++ = res;						      \
 	    inptr += 4;							      \
@@ -515,7 +515,7 @@ static const struct {
 		if (decomp_table[i].comb2 < 0)				      \
 		  {							      \
 		    /* See whether we have room for two bytes.  */	      \
-		    if (__builtin_expect (outptr + 1 >= outend, 0))	      \
+		    if (__glibc_unlikely (outptr + 1 >= outend))	      \
 		      {							      \
 			result = __GCONV_FULL_OUTPUT;			      \
 			break;						      \
@@ -527,7 +527,7 @@ static const struct {
 		else							      \
 		  {							      \
 		    /* See whether we have room for three bytes.  */	      \
-		    if (__builtin_expect (outptr + 2 >= outend, 0))	      \
+		    if (__glibc_unlikely (outptr + 2 >= outend))	      \
 		      {							      \
 			result = __GCONV_FULL_OUTPUT;			      \
 			break;						      \
diff --git a/iconvdata/cp1258.c b/iconvdata/cp1258.c
index bafa28cc18..6dc13b2bdf 100644
--- a/iconvdata/cp1258.c
+++ b/iconvdata/cp1258.c
@@ -66,7 +66,7 @@
     {									      \
       if (FROM_DIRECTION)						      \
 	{								      \
-	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 4 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      *((uint32_t *) outbuf) = data->__statep->__count >> 3;	      \
@@ -375,7 +375,7 @@ static const struct
     if (ch >= 0x80)							      \
       {									      \
 	ch = to_ucs4[ch - 0x80];					      \
-	if (__builtin_expect (ch == L'\0', 0))				      \
+	if (__glibc_unlikely (ch == L'\0'))				      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
@@ -802,7 +802,7 @@ static const struct
 	    res = 0;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (res != 0, 1))				      \
+	if (__glibc_likely (res != 0))					      \
 	  {								      \
 	    *outptr++ = res;						      \
 	    inptr += 4;							      \
@@ -845,7 +845,7 @@ static const struct
 		  }							      \
 									      \
 		/* See whether we have room for two bytes.  */		      \
-		if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 >= outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
diff --git a/iconvdata/cp932.c b/iconvdata/cp932.c
index b8269ac061..c467aaa2bb 100644
--- a/iconvdata/cp932.c
+++ b/iconvdata/cp932.c
@@ -4574,7 +4574,7 @@ static const char from_ucs4_extra[229][2] =
 	uint32_t ch2;							      \
 	uint_fast32_t idx;						      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 	       the intermediate result.  */				      \
@@ -4704,7 +4704,7 @@ static const char from_ucs4_extra[229][2] =
 	/* Now test for a possible second byte and write this if possible.  */\
 	if (cp[1] != '\0')						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		/* The result does not fit into the buffer.  */		      \
 		result = __GCONV_FULL_OUTPUT;				      \
diff --git a/iconvdata/euc-cn.c b/iconvdata/euc-cn.c
index 0b8a74b706..246ef5d70c 100644
--- a/iconvdata/euc-cn.c
+++ b/iconvdata/euc-cn.c
@@ -56,7 +56,7 @@
 	     next byte is also available.  */				      \
 	  const unsigned char *endp;					      \
 									      \
-	  if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	  if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	    {								      \
 	      /* The second character is not available.  Store		      \
 		 the intermediate result.  */				      \
@@ -67,14 +67,14 @@
 	  ch = inptr[1];						      \
 									      \
 	  /* All second bytes of a multibyte character must be >= 0xa1. */    \
-	  if (__builtin_expect (ch < 0xa1, 0))				      \
+	  if (__glibc_unlikely (ch < 0xa1))				      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 									      \
 	  /* This is code set 1: GB 2312-80.  */			      \
 	  endp = inptr;							      \
 									      \
 	  ch = gb2312_to_ucs4 (&endp, 2, 0x80);				      \
-	  if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))		      \
+	  if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	    {								      \
 	      /* This is an illegal character.  */			      \
 	      STANDARD_FROM_LOOP_ERR_HANDLER (2);			      \
diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index 2737842de1..ff4e46fdda 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -79,7 +79,7 @@
     {									      \
       if (FROM_DIRECTION)						      \
 	{								      \
-	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 4 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      *((uint32_t *) outbuf) = data->__statep->__count >> 3;	      \
@@ -92,7 +92,7 @@
 	}								      \
       else								      \
 	{								      \
-	  if (__builtin_expect (outbuf + 2 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 2 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      uint32_t lasttwo = data->__statep->__count >> 3;		      \
@@ -119,7 +119,7 @@
 									      \
     /* Determine whether there is a buffered character pending.  */	      \
     ch = *statep >> 3;							      \
-    if (__builtin_expect (ch == 0, 1))					      \
+    if (__glibc_likely (ch == 0))					      \
       {									      \
 	/* No - so look at the next input byte.  */			      \
 	ch = *inptr;							      \
@@ -132,7 +132,7 @@
 	    /* Two or three byte character.  */				      \
 	    uint32_t ch2;						      \
 									      \
-	    if (__builtin_expect (inptr + 1 >= inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	      {								      \
 		/* The second byte is not available.  */		      \
 		result = __GCONV_INCOMPLETE_INPUT;			      \
@@ -142,7 +142,7 @@
 	    ch2 = inptr[1];						      \
 									      \
 	    /* The second byte must be >= 0xa1 and <= 0xfe.  */		      \
-	    if (__builtin_expect (ch2 < 0xa1 || ch2 > 0xfe, 0))		      \
+	    if (__glibc_unlikely (ch2 < 0xa1 || ch2 > 0xfe))		      \
 	      {								      \
 		/* This is an illegal character.  */			      \
 		STANDARD_FROM_LOOP_ERR_HANDLER (1);			      \
@@ -151,7 +151,7 @@
 	    if (ch == 0x8e)						      \
 	      {								      \
 		/* Half-width katakana.  */				      \
-		if (__builtin_expect (ch2 > 0xdf, 0))			      \
+		if (__glibc_unlikely (ch2 > 0xdf))			      \
 		  STANDARD_FROM_LOOP_ERR_HANDLER (1);			      \
 									      \
 		ch = ch2 + 0xfec0;					      \
@@ -166,7 +166,7 @@
 		    /* JISX 0213 plane 2.  */				      \
 		    uint32_t ch3;					      \
 									      \
-		    if (__builtin_expect (inptr + 2 >= inend, 0))	      \
+		    if (__glibc_unlikely (inptr + 2 >= inend))		      \
 		      {							      \
 			/* The third byte is not available.  */		      \
 			result = __GCONV_INCOMPLETE_INPUT;		      \
@@ -323,7 +323,7 @@ static const struct
 	if (len > 0)							      \
 	  {								      \
 	    /* Output the combined character.  */			      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -338,7 +338,7 @@ static const struct
 									      \
       not_combining:							      \
 	/* Output the buffered character.  */				      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -355,7 +355,7 @@ static const struct
     else if (ch >= 0xff61 && ch <= 0xff9f)				      \
       {									      \
 	/* Half-width katakana.  */					      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -389,7 +389,7 @@ static const struct
 	if (jch & 0x8000)						      \
 	  {								      \
 	    /* JISX 0213 plane 2.  */					      \
-	    if (__builtin_expect (outptr + 2 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -399,7 +399,7 @@ static const struct
 	else								      \
 	  {								      \
 	    /* JISX 0213 plane 1.  */					      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
diff --git a/iconvdata/euc-jp-ms.c b/iconvdata/euc-jp-ms.c
index 5ec40ad6cc..854e3017fe 100644
--- a/iconvdata/euc-jp-ms.c
+++ b/iconvdata/euc-jp-ms.c
@@ -4673,7 +4673,7 @@ static const unsigned char from_ucs4_extra[229][2] =
 	   character is also available.  */				      \
 	unsigned char ch2;						      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result.  */					      \
@@ -4684,7 +4684,7 @@ static const unsigned char from_ucs4_extra[229][2] =
 	ch2 = (unsigned char)inptr[1];					      \
 									      \
 	/* All second bytes of a multibyte character must be >= 0xa1. */      \
-	if (__builtin_expect (ch2 < 0xa1, 0))				      \
+	if (__glibc_unlikely (ch2 < 0xa1))				      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    if (! ignore_errors_p ())					      \
@@ -4703,7 +4703,7 @@ static const unsigned char from_ucs4_extra[229][2] =
 	    /* This is code set 2: half-width katakana.  */		      \
 	    ch = jisx0201_to_ucs4 (ch2);				      \
 	    /*if (__builtin_expect (ch, 0) == __UNKNOWN_10646_CHAR)*/	      \
-	    if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))	      \
+	    if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	      {								      \
 		/* Illegal character.  */				      \
 		if (! ignore_errors_p ())				      \
@@ -4896,15 +4896,15 @@ static const unsigned char from_ucs4_extra[229][2] =
 	/* Now test for a possible second byte and write this if possible.  */\
 	if (cp[1] != '\0')						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		/* The result does not fit into the buffer.  */		      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
 	      }								      \
-	    if (__builtin_expect (cp[1] < 0x80, 0))			      \
+	    if (__glibc_unlikely (cp[1] < 0x80))			      \
 	      {								      \
-		if (__builtin_expect (outptr + 2 >= outend, 0))		      \
+		if (__glibc_unlikely (outptr + 2 >= outend))		      \
 		  {							      \
 		    /* The result does not fit into the buffer.  */	      \
 		    result = __GCONV_FULL_OUTPUT;			      \
diff --git a/iconvdata/euc-jp.c b/iconvdata/euc-jp.c
index b903091ff7..a7f2ae351c 100644
--- a/iconvdata/euc-jp.c
+++ b/iconvdata/euc-jp.c
@@ -57,7 +57,7 @@
 	   byte is also available.  */					      \
 	int ch2;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second byte is not available.  Store the		      \
 	       intermediate result.  */					      \
@@ -68,7 +68,7 @@
 	ch2 = inptr[1];							      \
 									      \
 	/* All second bytes of a multibyte character must be >= 0xa1. */      \
-	if (__builtin_expect (ch2 < 0xa1, 0))				      \
+	if (__glibc_unlikely (ch2 < 0xa1))				      \
 	  STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 									      \
 	if (ch == 0x8e)							      \
@@ -105,7 +105,7 @@
 		result = __GCONV_INCOMPLETE_INPUT;			      \
 		break;							      \
 	      }								      \
-	    if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))	      \
+	    if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	      /* Illegal character.  */					      \
 	      STANDARD_FROM_LOOP_ERR_HANDLER (1);			      \
 									      \
@@ -151,7 +151,7 @@
 	size_t found;							      \
 									      \
 	/* See whether we have room for at least two characters.  */	      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
index d4f0e00ca4..f14d989385 100644
--- a/iconvdata/euc-kr.c
+++ b/iconvdata/euc-kr.c
@@ -93,13 +93,13 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
 	/* Two-byte character.  First test whether the next byte	      \
 	   is also available.  */					      \
 	ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0x80);		      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    /* The second byte is not available.  */			      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
 	  }								      \
-	if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))		      \
+	if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  /* This is an illegal character.  */				      \
 	  STANDARD_FROM_LOOP_ERR_HANDLER (2);				      \
       }									      \
@@ -144,7 +144,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
     /* Now test for a possible second byte and write this if possible.  */    \
     if (cp[1] != '\0')							      \
       {									      \
-	if (__builtin_expect (outptr >= outend, 0))			      \
+	if (__glibc_unlikely (outptr >= outend))			      \
 	  {								      \
 	    /* The result does not fit into the buffer.  */		      \
 	    --outptr;							      \
diff --git a/iconvdata/gb18030.c b/iconvdata/gb18030.c
index 4302fbf817..4eaa8b5e65 100644
--- a/iconvdata/gb18030.c
+++ b/iconvdata/gb18030.c
@@ -24212,7 +24212,7 @@ static const unsigned char __ucs_to_gb18030_tab2[][2] =
 									      \
 	      inptr += 4;						      \
 	    }								      \
-	  else if (__builtin_expect (ch2 >= 0x40, 1))			      \
+	  else if (__glibc_likely (ch2 >= 0x40))			      \
 	    {								      \
 	      /* A two-byte character */				      \
 	      idx = (ch - 0x81) * 192 + (ch2 - 0x40);			      \
@@ -24375,7 +24375,7 @@ static const unsigned char __ucs_to_gb18030_tab2[][2] =
 	  {								      \
 	    /* See whether there is enough room for all four bytes we	      \
 	       write.  */						      \
-	    if (__builtin_expect (outptr + 3 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 3 >= outend))		      \
 	      {								      \
 		/* We have not enough room.  */				      \
 		result = __GCONV_FULL_OUTPUT;				      \
diff --git a/iconvdata/gbbig5.c b/iconvdata/gbbig5.c
index 9a68c5cc7d..1eb1067bb1 100644
--- a/iconvdata/gbbig5.c
+++ b/iconvdata/gbbig5.c
@@ -4805,7 +4805,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 	const char *cp;							      \
 	int idx;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 	       the intermediate result.  */				      \
@@ -4817,7 +4817,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 	ch = inptr[1];						     	      \
 									      \
 	/* All second bytes of a multibyte character must be >= 0xa1. */      \
-	if (__builtin_expect (ch < 0xa1, 0))			  	      \
+	if (__glibc_unlikely (ch < 0xa1))				      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
@@ -4827,7 +4827,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 									      \
 	/* Get the value from the table.  */				      \
 	cp = __from_gb2312_to_big5[idx];				      \
-	if (__builtin_expect (cp[0] == '\0', 0))			      \
+	if (__glibc_unlikely (cp[0] == '\0'))				      \
 	  {								      \
 	    /* We do not have a mapping for this character.		      \
 	       If ignore errors, map it to 0xa1bc - big5 box character */     \
@@ -4836,7 +4836,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 	      break;							      \
 									      \
 	    /* See if there is enough room to write the second byte. */	      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 	        break;							      \
@@ -4894,7 +4894,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 	const char *cp;							      \
 	int idx;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 	       the intermediate result.  */				      \
@@ -4918,7 +4918,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 									      \
 	/* Get the value from the table.  */				      \
 	cp = __from_big5_to_gb2312 [idx];				      \
-	if (__builtin_expect (cp[0] == '\0', 0))			      \
+	if (__glibc_unlikely (cp[0] == '\0'))				      \
 	  {								      \
 	    /* We do not have a mapping for this character.		      \
 	       If ignore errors, map it to 0xa1f5 - gb box character */       \
@@ -4927,7 +4927,7 @@ const char __from_big5_to_gb2312 [13973][2] =
 	      break;							      \
 									      \
 	    /* See if there is enough room to write the second byte. */	      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 	        break;							      \
diff --git a/iconvdata/gbgbk.c b/iconvdata/gbgbk.c
index b870d9d8fb..88f9cd994e 100644
--- a/iconvdata/gbgbk.c
+++ b/iconvdata/gbgbk.c
@@ -73,7 +73,7 @@
 		UCS4 -> GB2312 -> GBK -> UCS4				      \
 									      \
 	   might not produce identical text.  */			      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 	       the intermediate result.  */				      \
@@ -81,7 +81,7 @@
 	    break;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (outend - outptr < 2, 0))			      \
+	if (__glibc_unlikely (outend - outptr < 2))			      \
 	  {								      \
 	    /* We ran out of space.  */					      \
 	    result = __GCONV_FULL_OUTPUT;				      \
@@ -91,7 +91,7 @@
 	ch = (ch << 8) | inptr[1];					      \
 									      \
 	/* Map 0xA844 (U2015 in GBK) to 0xA1AA (U2015 in GB2312).  */	      \
-	if (__builtin_expect (ch == 0xa844, 0))				      \
+	if (__glibc_unlikely (ch == 0xa844))				      \
 	  ch = 0xa1aa;							      \
 									      \
 	/* Now determine whether the character is valid.  */		      \
@@ -134,7 +134,7 @@
 									      \
     if (ch > 0x7f)							      \
       {									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 		 the intermediate result.  */				      \
@@ -142,7 +142,7 @@
 	    break;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (outend - outptr < 2, 0))			      \
+	if (__glibc_unlikely (outend - outptr < 2))			      \
 	  {								      \
 	    /* We ran out of space.  */					      \
 	    result = __GCONV_FULL_OUTPUT;				      \
diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c
index 2f7d7fb886..05d7eb8114 100644
--- a/iconvdata/gbk.c
+++ b/iconvdata/gbk.c
@@ -13157,7 +13157,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
 	  uint32_t ch2;							      \
 	  int idx;							      \
 									      \
-	  if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	  if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	    {								      \
 	      /* The second character is not available.  Store		      \
 		 the intermediate result.  */				      \
diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c
index 373d49a743..9de32c576a 100644
--- a/iconvdata/ibm1364.c
+++ b/iconvdata/ibm1364.c
@@ -77,7 +77,7 @@
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf >= outend, 0))			      \
+	  if (__glibc_unlikely (outbuf >= outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -120,7 +120,7 @@ enum
     else								      \
       {									      \
 	/* This is a combined character.  Make sure we have room.  */	      \
-	if (__builtin_expect (outptr + 8 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 8 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -204,7 +204,7 @@ enum
       {									      \
 	assert (curcs == db);						      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result.  */					      \
@@ -274,7 +274,7 @@ enum
 	    curcs = db;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (outptr + 2 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 2 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -301,7 +301,7 @@ enum
   {									      \
     uint32_t ch = get32 (inptr);					      \
 									      \
-    if (__builtin_expect (ch >= UCS_LIMIT, 0))				      \
+    if (__glibc_unlikely (ch >= UCS_LIMIT))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
@@ -353,7 +353,7 @@ enum
 		curcs = db;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -364,13 +364,13 @@ enum
       }									      \
     else								      \
       {									      \
-	if (__builtin_expect (curcs == db, 0))				      \
+	if (__glibc_unlikely (curcs == db))				      \
 	  {								      \
 	    /* We know there is room for at least one byte.  */		      \
 	    *outptr++ = SI;						      \
 	    curcs = sb;							      \
 									      \
-	    if (__builtin_expect (outptr >= outend, 0))			      \
+	    if (__glibc_unlikely (outptr >= outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 83276905a0..1c50f1f3ac 100644
--- a/iconvdata/ibm930.c
+++ b/iconvdata/ibm930.c
@@ -61,7 +61,7 @@
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf >= outend, 0))			      \
+	  if (__glibc_unlikely (outbuf >= outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -150,7 +150,7 @@ enum
 									      \
 	assert (curcs == db);						      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result. */					      \
@@ -197,7 +197,7 @@ enum
     const struct gap *rp2 = __ucs4_to_ibm930db_idx;			      \
     const char *cp;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
@@ -227,7 +227,7 @@ enum
 	  {								      \
 	    if (curcs == sb)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 1 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -236,7 +236,7 @@ enum
 		curcs = db;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -249,7 +249,7 @@ enum
       {									      \
 	if (curcs == db)						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -257,7 +257,7 @@ enum
 	    *outptr++ = SI;						      \
 	  }								      \
 									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/ibm932.c b/iconvdata/ibm932.c
index 4ceeaae5b9..cd43619963 100644
--- a/iconvdata/ibm932.c
+++ b/iconvdata/ibm932.c
@@ -64,7 +64,7 @@
     if (__builtin_expect (res == 0, 0) && ch != 0)			      \
       {									      \
 	/* Use the IBM932 table for double byte.  */			      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.			      \
 	       Store the intermediate result.  */			      \
@@ -134,7 +134,7 @@
     uint32_t high;							      \
     uint16_t pccode;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 	rp = NULL;							      \
@@ -156,7 +156,7 @@
 	high = (sizeof (__ucs4_to_ibm932db) >> 1)			      \
 		/ sizeof (__ucs4_to_ibm932db[0][FROM]);			      \
 	pccode = ch;							      \
-	if (__builtin_expect (rp != NULL, 1))				      \
+	if (__glibc_likely (rp != NULL))				      \
 	  while (low < high)						      \
 	    {								      \
 	      i = (low + high) >> 1;					      \
@@ -173,7 +173,7 @@
 	    }								      \
 	if (found) 							      \
 	  {								      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -189,7 +189,7 @@
       }									      \
     else								      \
       {									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/ibm933.c b/iconvdata/ibm933.c
index 4723df4890..149902b42c 100644
--- a/iconvdata/ibm933.c
+++ b/iconvdata/ibm933.c
@@ -61,7 +61,7 @@
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf >= outend, 0))			      \
+	  if (__glibc_unlikely (outbuf >= outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -149,7 +149,7 @@ enum
 	assert (curcs == db);						      \
 									      \
 	/* Use the IBM933 table for double byte.  */			      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result. */					      \
@@ -196,7 +196,7 @@ enum
     const struct gap *rp2 = __ucs4_to_ibm933db_idx;			      \
     const char *cp;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
@@ -226,7 +226,7 @@ enum
 	  {								      \
 	    if (curcs == sb)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 1 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -235,7 +235,7 @@ enum
 		curcs = db;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -248,7 +248,7 @@ enum
       {									      \
 	if (curcs == db)						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -256,7 +256,7 @@ enum
 	    *outptr++ = SI;						      \
 	  }								      \
 									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/ibm935.c b/iconvdata/ibm935.c
index 1ed311b01f..9a7a862ef2 100644
--- a/iconvdata/ibm935.c
+++ b/iconvdata/ibm935.c
@@ -61,7 +61,7 @@
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf >= outend, 0))			      \
+	  if (__glibc_unlikely (outbuf >= outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -149,7 +149,7 @@ enum
 	assert (curcs == db);						      \
 									      \
 	/* Use the IBM935 table for double byte.  */			      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.			      \
 	       Store the intermediate result. */			      \
@@ -196,7 +196,7 @@ enum
     const struct gap *rp2 = __ucs4_to_ibm935db_idx;			      \
     const char *cp;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
@@ -226,7 +226,7 @@ enum
 	  {								      \
 	    if (curcs == sb)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 1 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -235,7 +235,7 @@ enum
 		curcs = db;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -248,7 +248,7 @@ enum
       {									      \
 	if (curcs == db)						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -256,7 +256,7 @@ enum
 	    *outptr++ = SI;						      \
 	  }								      \
 									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/ibm937.c b/iconvdata/ibm937.c
index 1edaf624d0..5a4ab92131 100644
--- a/iconvdata/ibm937.c
+++ b/iconvdata/ibm937.c
@@ -61,7 +61,7 @@
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf >= outend, 0))			      \
+	  if (__glibc_unlikely (outbuf >= outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -149,7 +149,7 @@ enum
 	assert (curcs == db);						      \
 									      \
 	/* Use the IBM937 table for double byte.  */			      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.			      \
 	       Store the intermediate result. */			      \
@@ -196,7 +196,7 @@ enum
     const struct gap *rp2 = __ucs4_to_ibm937db_idx;			      \
     const char *cp;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
@@ -226,7 +226,7 @@ enum
 	  {								      \
 	    if (curcs == sb)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 1 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -235,7 +235,7 @@ enum
 		curcs = db;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -248,7 +248,7 @@ enum
       {									      \
 	if (curcs == db)						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -256,7 +256,7 @@ enum
 	    *outptr++ = SI;						      \
 	  }								      \
 									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/ibm939.c b/iconvdata/ibm939.c
index b40c486540..b50792879c 100644
--- a/iconvdata/ibm939.c
+++ b/iconvdata/ibm939.c
@@ -61,7 +61,7 @@
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf >= outend, 0))			      \
+	  if (__glibc_unlikely (outbuf >= outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -149,7 +149,7 @@ enum
 									      \
 	assert (curcs == db);						      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result. */					      \
@@ -196,7 +196,7 @@ enum
     const struct gap *rp2 = __ucs4_to_ibm939db_idx;			      \
     const char *cp;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 	goto ibm939_invalid_char;					      \
@@ -226,7 +226,7 @@ enum
 	  {								      \
 	    if (curcs == sb)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 1 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -235,7 +235,7 @@ enum
 		curcs = db;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -248,7 +248,7 @@ enum
       {									      \
 	if (curcs == db)						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -256,7 +256,7 @@ enum
 	    *outptr++ = SI;						      \
 	  }								      \
 									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/ibm943.c b/iconvdata/ibm943.c
index 495e37909e..0ca3327f29 100644
--- a/iconvdata/ibm943.c
+++ b/iconvdata/ibm943.c
@@ -65,7 +65,7 @@
 	    __builtin_expect (res == 0, 0) && ch != 0))			      \
       {									      \
 	/* Use the IBM943 table for double byte.  */			      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.			      \
 	       Store the intermediate result.  */			      \
@@ -135,7 +135,7 @@
     uint32_t high;							      \
     uint16_t pccode;							      \
 									      \
-    if (__builtin_expect (ch >= 0xffff, 0))				      \
+    if (__glibc_unlikely (ch >= 0xffff))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 	rp = NULL;							      \
@@ -157,7 +157,7 @@
 	high = (sizeof (__ucs4_to_ibm943db) >> 1)			      \
 		/ sizeof (__ucs4_to_ibm943db[0][FROM]);			      \
 	pccode = ch;							      \
-	if (__builtin_expect (rp != NULL, 1))				      \
+	if (__glibc_likely (rp != NULL))				      \
 	  while (low < high)						      \
 	    {								      \
 	      i = (low + high) >> 1;					      \
@@ -174,7 +174,7 @@
 	    }								      \
 	if (found) 							      \
 	  {								      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -190,7 +190,7 @@
       }									      \
     else								      \
       {									      \
-	if (__builtin_expect (outptr + 1 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/iso-2022-cn-ext.c b/iconvdata/iso-2022-cn-ext.c
index 64196ac792..147f869158 100644
--- a/iconvdata/iso-2022-cn-ext.c
+++ b/iconvdata/iso-2022-cn-ext.c
@@ -137,7 +137,7 @@ enum
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf == outend, 0))			      \
+	  if (__glibc_unlikely (outbuf == outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
diff --git a/iconvdata/iso-2022-cn.c b/iconvdata/iso-2022-cn.c
index 0e5a6aabe7..a282806809 100644
--- a/iconvdata/iso-2022-cn.c
+++ b/iconvdata/iso-2022-cn.c
@@ -88,7 +88,7 @@ enum
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf == outend, 0))			      \
+	  if (__glibc_unlikely (outbuf == outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -121,7 +121,7 @@ enum
     uint32_t ch = *inptr;						      \
 									      \
     /* This is a 7bit character set, disallow all 8bit characters.  */	      \
-    if (__builtin_expect (ch >= 0x7f, 0))				      \
+    if (__glibc_unlikely (ch >= 0x7f))					      \
       STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 									      \
     /* Recognize escape sequences.  */					      \
@@ -246,7 +246,7 @@ enum
 	  {								      \
 	    *outptr++ = SI;						      \
 	    set = ASCII_set;						      \
-	    if (__builtin_expect (outptr == outend, 0))			      \
+	    if (__glibc_unlikely (outptr == outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -319,7 +319,7 @@ enum
 	      {								      \
 		const char *escseq;					      \
 									      \
-		if (__builtin_expect (outptr + 4 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 4 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -342,7 +342,7 @@ enum
 									      \
 	    if (used == CNS11643_2_set)					      \
 	      {								      \
-		if (__builtin_expect (outptr + 2 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 2 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -357,7 +357,7 @@ enum
 		   SO charset.  */					      \
 		if (set == ASCII_set)					      \
 		  {							      \
-		    if (__builtin_expect (outptr + 1 > outend, 0))	      \
+		    if (__glibc_unlikely (outptr + 1 > outend))		      \
 		      {							      \
 			result = __GCONV_FULL_OUTPUT;			      \
 			break;						      \
@@ -368,13 +368,13 @@ enum
 									      \
 	    /* Always test the length here since we have used up all the      \
 	       guaranteed output buffer slots.  */			      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
 	      }								      \
 	  }								      \
-	else if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	else if (__glibc_unlikely (outptr + 2 > outend))		      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c
index e90d68a444..b676aa19a4 100644
--- a/iconvdata/iso-2022-jp-3.c
+++ b/iconvdata/iso-2022-jp-3.c
@@ -96,7 +96,7 @@ enum
 	    + ((data->__statep->__count & CURRENT_SEL_MASK) != ASCII_set      \
 	       ? 3 : 0);						      \
 									      \
-	  if (__builtin_expect (outbuf + need > outend, 0))		      \
+	  if (__glibc_unlikely (outbuf + need > outend))		      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -153,7 +153,7 @@ enum
     uint32_t ch = *inptr;						      \
 									      \
     /* Recognize escape sequences.  */					      \
-    if (__builtin_expect (ch == ESC, 0))				      \
+    if (__glibc_unlikely (ch == ESC))					      \
       {									      \
 	/* We now must be prepared to read two to three more bytes.	      \
 	   If we have a match in the first byte but then the input buffer     \
@@ -242,7 +242,7 @@ enum
       {									      \
 	/* Use the JIS X 0201 table.  */				      \
 	ch = jisx0201_to_ucs4 (ch);					      \
-	if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))		      \
+	if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  {								      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	  }								      \
@@ -252,7 +252,7 @@ enum
       {									      \
 	/* Use the JIS X 0201 table.  */				      \
 	ch = jisx0201_to_ucs4 (ch + 0x80);				      \
-	if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))		      \
+	if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  {								      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	  }								      \
@@ -266,19 +266,19 @@ enum
 	   provide the appropriate tables.  */				      \
 	ch = jisx0208_to_ucs4 (&inptr, inend - inptr, 0);		      \
 									      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
 	  }								      \
-	else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))	      \
+	else if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  {								      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	  }								      \
       }									      \
     else /* (set == JISX0213_1_2004_set || set == JISX0213_2_set) */	      \
       {									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
@@ -416,7 +416,7 @@ static const struct
 	       || (set != JISX0213_1_2000_set && set != JISX0213_1_2004_set)  \
 	       ? 4 : 0);						      \
 									      \
-	    if (__builtin_expect (outptr + need + 2 > outend, 0))	      \
+	    if (__glibc_unlikely (outptr + need + 2 > outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -444,7 +444,7 @@ static const struct
 	{								      \
 	  size_t need = (lasttwo >> 16 ? 3 : 0);			      \
 									      \
-	  if (__builtin_expect (outptr + need + 2 > outend, 0))		      \
+	  if (__glibc_unlikely (outptr + need + 2 > outend))		      \
 	    {								      \
 	      result = __GCONV_FULL_OUTPUT;				      \
 	      break;							      \
@@ -520,7 +520,7 @@ static const struct
 		inptr += 4;						      \
 		continue;						      \
 	      }								      \
-	    if (__builtin_expect (written == 0, 0))			      \
+	    if (__glibc_unlikely (written == 0))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -558,7 +558,7 @@ static const struct
 		continue;						      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -578,7 +578,7 @@ static const struct
       {									      \
 	/* We must encode using ASCII.  First write out the escape	      \
 	   sequence.  */						      \
-	if (__builtin_expect (outptr + 3 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 3 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -589,7 +589,7 @@ static const struct
 	*outptr++ = 'B';						      \
 	set = ASCII_set;						      \
 									      \
-	if (__builtin_expect (outptr >= outend, 0))			      \
+	if (__glibc_unlikely (outptr >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -606,7 +606,7 @@ static const struct
 	  {								      \
 	    if (set != JISX0201_Roman_set)				      \
 	      {								      \
-		if (__builtin_expect (outptr + 3 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 3 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -617,7 +617,7 @@ static const struct
 		set = JISX0201_Roman_set;				      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr >= outend, 0))			      \
+	    if (__glibc_unlikely (outptr >= outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -644,7 +644,7 @@ static const struct
 									      \
 		if (set != JISX0208_1983_set)				      \
 		  {							      \
-		    if (__builtin_expect (outptr + 3 > outend, 0))	      \
+		    if (__glibc_unlikely (outptr + 3 > outend))		      \
 		      {							      \
 			result = __GCONV_FULL_OUTPUT;			      \
 			break;						      \
@@ -655,7 +655,7 @@ static const struct
 		    set = JISX0208_1983_set;				      \
 		  }							      \
 									      \
-		if (__builtin_expect (outptr + 2 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 2 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -677,7 +677,7 @@ static const struct
 									      \
 		    if (set != new_set)					      \
 		      {							      \
-			if (__builtin_expect (outptr + 4 > outend, 0))	      \
+			if (__glibc_unlikely (outptr + 4 > outend))	      \
 			  {						      \
 			    result = __GCONV_FULL_OUTPUT;		      \
 			    break;					      \
@@ -703,7 +703,7 @@ static const struct
 			continue;					      \
 		      }							      \
 									      \
-		    if (__builtin_expect (outptr + 1 >= outend, 0))	      \
+		    if (__glibc_unlikely (outptr + 1 >= outend))	      \
 		      {							      \
 			result = __GCONV_FULL_OUTPUT;			      \
 			break;						      \
@@ -732,7 +732,7 @@ static const struct
 			    set = JISX0201_Kana_set;			      \
 			  }						      \
 									      \
-			if (__builtin_expect (outptr >= outend, 0))	      \
+			if (__glibc_unlikely (outptr >= outend))	      \
 			  {						      \
 			    result = __GCONV_FULL_OUTPUT;		      \
 			    break;					      \
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index e9d5db4b68..3428c3211e 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -231,7 +231,7 @@ gconv_end (struct __gconv_step *data)
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit the sequence `Esc ( B'.  */			      \
-	  if (__builtin_expect (outbuf + 3 > outend, 0))		      \
+	  if (__glibc_unlikely (outbuf + 3 > outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -404,7 +404,7 @@ gconv_end (struct __gconv_step *data)
       {									      \
 	/* Use the JIS X 0201 table.  */				      \
 	ch = jisx0201_to_ucs4 (ch);					      \
-	if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))		      \
+	if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	++inptr;							      \
       }									      \
@@ -412,7 +412,7 @@ gconv_end (struct __gconv_step *data)
       {									      \
 	/* Use the JIS X 0201 table.  */				      \
 	ch = jisx0201_to_ucs4 (ch + 0x80);				      \
-	if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))		      \
+	if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	++inptr;							      \
       }									      \
@@ -438,12 +438,12 @@ gconv_end (struct __gconv_step *data)
 	    ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0);		      \
 	  }								      \
 									      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
 	  }								      \
-	else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))	      \
+	else if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  {								      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	  }								      \
@@ -493,7 +493,7 @@ static const cvlist_t conversion_lists[4] =
     if (var == iso2022jp2)						      \
       {									      \
 	/* Handle Unicode tag characters (range U+E0000..U+E007F).  */	      \
-	if (__builtin_expect ((ch >> 7) == (0xe0000 >> 7), 0))		      \
+	if (__glibc_unlikely ((ch >> 7) == (0xe0000 >> 7)))		      \
 	  {								      \
 	    ch &= 0x7f;							      \
 	    if (ch >= 'A' && ch <= 'Z')					      \
@@ -529,7 +529,7 @@ static const cvlist_t conversion_lists[4] =
 									      \
 	/* Non-tag characters reset the tag parsing state, if the current     \
 	   state is a temporary state.  */				      \
-	if (__builtin_expect (tag >= TAG_language, 0))			      \
+	if (__glibc_unlikely (tag >= TAG_language))			      \
 	  tag = TAG_none;						      \
       }									      \
 									      \
@@ -613,7 +613,7 @@ static const cvlist_t conversion_lists[4] =
 	else								      \
 	  written = __UNKNOWN_10646_CHAR;				      \
 									      \
-	if (__builtin_expect (written == 0, 0))				      \
+	if (__glibc_unlikely (written == 0))				      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -629,7 +629,7 @@ static const cvlist_t conversion_lists[4] =
 	  {								      \
 	    if (ch >= 0x80 && ch <= 0xff)				      \
 	      {								      \
-		if (__builtin_expect (outptr + 3 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 3 > outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
@@ -643,7 +643,7 @@ static const cvlist_t conversion_lists[4] =
 	  }								      \
 	else if (set2 == ISO88597_set)					      \
 	  {								      \
-	    if (__builtin_expect (ch < 0xffff, 1))			      \
+	    if (__glibc_likely (ch < 0xffff))				      \
 	      {								      \
 		const struct gap *rp = from_idx;			      \
 									      \
@@ -655,7 +655,7 @@ static const cvlist_t conversion_lists[4] =
 		      iso88597_from_ucs4[ch - 0xa0 + rp->idx];		      \
 		    if (res != '\0')					      \
 		      {							      \
-			if (__builtin_expect (outptr + 3 > outend, 0))	      \
+			if (__glibc_unlikely (outptr + 3 > outend))	      \
 			  {						      \
 			    result = __GCONV_FULL_OUTPUT;		      \
 			    break;					      \
@@ -685,7 +685,7 @@ static const cvlist_t conversion_lists[4] =
 	  {								      \
 	    /* We must encode using ASCII.  First write out the		      \
 	       escape sequence.  */					      \
-	    if (__builtin_expect (outptr + 3 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 3 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -696,7 +696,7 @@ static const cvlist_t conversion_lists[4] =
 	    *outptr++ = 'B';						      \
 	    set = ASCII_set;						      \
 									      \
-	    if (__builtin_expect (outptr + 1 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -742,7 +742,7 @@ static const cvlist_t conversion_lists[4] =
 			  set2 = ISO88591_set;				      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 3 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 3 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
@@ -755,7 +755,7 @@ static const cvlist_t conversion_lists[4] =
 		    }							      \
 									      \
 		  /* Try ISO 8859-7 upper half.  */			      \
-		  if (__builtin_expect (ch < 0xffff, 1))		      \
+		  if (__glibc_likely (ch < 0xffff))			      \
 		    {							      \
 		      const struct gap *rp = from_idx;			      \
 									      \
@@ -817,7 +817,7 @@ static const cvlist_t conversion_lists[4] =
 			  set = JISX0201_Roman_set;			      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 1 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 1 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
@@ -844,7 +844,7 @@ static const cvlist_t conversion_lists[4] =
 			  set = JISX0208_1983_set;			      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 2 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
@@ -855,7 +855,7 @@ static const cvlist_t conversion_lists[4] =
 		      break;						      \
 		    }							      \
 									      \
-		  if (__builtin_expect (var == iso2022jp, 0))		      \
+		  if (__glibc_unlikely (var == iso2022jp))		      \
 		    /* Don't use the other Japanese character sets.  */	      \
 		    break;						      \
 									      \
@@ -877,7 +877,7 @@ static const cvlist_t conversion_lists[4] =
 			  set = JISX0212_set;				      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 2 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
@@ -910,7 +910,7 @@ static const cvlist_t conversion_lists[4] =
 			  set = GB2312_set;				      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 2 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
@@ -944,7 +944,7 @@ static const cvlist_t conversion_lists[4] =
 			  set = KSC5601_set;				      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 2 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 2 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
@@ -979,7 +979,7 @@ static const cvlist_t conversion_lists[4] =
 			  set = JISX0201_Kana_set;			      \
 			}						      \
 									      \
-		      if (__builtin_expect (outptr + 1 > outend, 0))	      \
+		      if (__glibc_unlikely (outptr + 1 > outend))	      \
 			{						      \
 			  res = __GCONV_FULL_OUTPUT;			      \
 			  break;					      \
diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c
index 2377ae5f2a..14080c10c4 100644
--- a/iconvdata/iso-2022-kr.c
+++ b/iconvdata/iso-2022-kr.c
@@ -86,7 +86,7 @@ enum
 	{								      \
 	  /* We are not in the initial state.  To switch back we have	      \
 	     to emit `SI'.  */						      \
-	  if (__builtin_expect (outbuf == outend, 0))			      \
+	  if (__glibc_unlikely (outbuf == outend))			      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \
@@ -118,7 +118,7 @@ enum
     uint32_t ch = *inptr;						      \
 									      \
     /* This is a 7bit character set, disallow all 8bit characters.  */	      \
-    if (__builtin_expect (ch > 0x7f, 0))				      \
+    if (__glibc_unlikely (ch > 0x7f))					      \
       STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 									      \
     /* Recognize escape sequences.  */					      \
@@ -171,12 +171,12 @@ enum
 	/* Use the KSC 5601 table.  */					      \
 	ch = ksc5601_to_ucs4 (&inptr, inend - inptr, 0);		      \
 									      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
 	  }								      \
-	else if (__builtin_expect (ch == __UNKNOWN_10646_CHAR, 0))	      \
+	else if (__glibc_unlikely (ch == __UNKNOWN_10646_CHAR))		      \
 	  {								      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
 	  }								      \
@@ -209,7 +209,7 @@ enum
 	  {								      \
 	    *outptr++ = SI;						      \
 	    set = ASCII_set;						      \
-	    if (__builtin_expect (outptr == outend, 0))			      \
+	    if (__glibc_unlikely (outptr == outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -243,7 +243,7 @@ enum
 		set = KSC5601_set;					      \
 	      }								      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c
index 35fe93d880..b450fcc962 100644
--- a/iconvdata/iso646.c
+++ b/iconvdata/iso646.c
@@ -870,7 +870,7 @@ gconv_end (struct __gconv_step *data)
 	ch = 0x5d;							      \
 	break;								      \
       default:								      \
-	if (__builtin_expect (ch > 0x7f, 0))				      \
+	if (__glibc_unlikely (ch > 0x7f))				      \
 	  {								      \
 	    UNICODE_TAG_HANDLER (ch, 4);				      \
 	    failure = __GCONV_ILLEGAL_INPUT;				      \
diff --git a/iconvdata/iso8859-1.c b/iconvdata/iso8859-1.c
index 6aa6e3550c..6610cae415 100644
--- a/iconvdata/iso8859-1.c
+++ b/iconvdata/iso8859-1.c
@@ -50,7 +50,7 @@
 #define BODY \
   {									      \
     uint32_t ch = *((const uint32_t *) inptr);				      \
-    if (__builtin_expect (ch > 0xff, 0))				      \
+    if (__glibc_unlikely (ch > 0xff))					      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
diff --git a/iconvdata/iso_11548-1.c b/iconvdata/iso_11548-1.c
index 51aed763e8..37f55c0d42 100644
--- a/iconvdata/iso_11548-1.c
+++ b/iconvdata/iso_11548-1.c
@@ -53,7 +53,7 @@
 #define BODY \
   {									      \
     uint32_t ch = *((const uint32_t *) inptr);				      \
-    if (__builtin_expect ((ch & 0xffffff00u) != BRAILLE_UCS_BASE, 0))	      \
+    if (__glibc_unlikely ((ch & 0xffffff00u) != BRAILLE_UCS_BASE))	      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
 									      \
diff --git a/iconvdata/iso_6937-2.c b/iconvdata/iso_6937-2.c
index d5e09a3795..03f08734e9 100644
--- a/iconvdata/iso_6937-2.c
+++ b/iconvdata/iso_6937-2.c
@@ -397,7 +397,7 @@ static const char from_ucs4[][2] =
 	   is also available.  */					      \
 	int ch2;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result.  */					      \
@@ -416,7 +416,7 @@ static const char from_ucs4[][2] =
 									      \
 	ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20];			      \
 									      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    /* Illegal character.  */					      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (2);				      \
@@ -536,7 +536,7 @@ static const char from_ucs4[][2] =
     /* Now test for a possible second byte and write this if possible.  */    \
     if (cp[1] != '\0')							      \
       {									      \
-	if (__builtin_expect (outptr >= outend, 0))			      \
+	if (__glibc_unlikely (outptr >= outend))			      \
 	  {								      \
 	    /* The result does not fit into the buffer.  */		      \
 	    --outptr;							      \
diff --git a/iconvdata/iso_6937.c b/iconvdata/iso_6937.c
index 66d86b1dce..71a829a71b 100644
--- a/iconvdata/iso_6937.c
+++ b/iconvdata/iso_6937.c
@@ -397,7 +397,7 @@ static const char from_ucs4[][2] =
 	   is also available.  */					      \
 	int ch2;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store the	      \
 	       intermediate result.  */					      \
@@ -416,7 +416,7 @@ static const char from_ucs4[][2] =
 									      \
 	ch = to_ucs4_comb[ch - 0xc1][ch2 - 0x20];			      \
 									      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    /* Illegal character.  */					      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (2);				      \
@@ -520,7 +520,7 @@ static const char from_ucs4[][2] =
 	    fail = 1;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (fail, 0))					      \
+	if (__glibc_unlikely (fail))					      \
 	  {								      \
 	    /* Illegal characters.  */					      \
 	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
@@ -538,7 +538,7 @@ static const char from_ucs4[][2] =
     /* Now test for a possible second byte and write this if possible.  */    \
     if (cp[1] != '\0')							      \
       {									      \
-	if (__builtin_expect (outptr >= outend, 0))			      \
+	if (__glibc_unlikely (outptr >= outend))			      \
 	  {								      \
 	    /* The result does not fit into the buffer.  */		      \
 	    --outptr;							      \
diff --git a/iconvdata/johab.c b/iconvdata/johab.c
index fb280a368f..07d6b6d9f8 100644
--- a/iconvdata/johab.c
+++ b/iconvdata/johab.c
@@ -192,7 +192,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 	    uint32_t ch2;						      \
 	    uint_fast32_t idx;						      \
 									      \
-	    if (__builtin_expect (inptr + 1 >= inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	      {								      \
 		/* The second character is not available.  Store the	      \
 		   intermediate result.  */				      \
@@ -202,7 +202,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 									      \
 	    ch2 = inptr[1];						      \
 	    idx = ch * 256 + ch2;					      \
-	    if (__builtin_expect (ch <= 0xd3, 1))			      \
+	    if (__glibc_likely (ch <= 0xd3))				      \
 	      {								      \
 		/* Hangul */						      \
 		int_fast32_t i, m, f;					      \
@@ -262,7 +262,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 	      }								      \
 	  }								      \
 									      \
-	if (__builtin_expect (ch == 0, 0))				      \
+	if (__glibc_unlikely (ch == 0))					      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (2);				      \
@@ -313,7 +313,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
       {									      \
 	if (ch >= 0xac00 && ch <= 0xd7a3)				      \
 	  {								      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -334,7 +334,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 	  {								      \
 	    ch = jamo_from_ucs_table[ch - 0x3131];			      \
 									      \
-	    if (__builtin_expect (outptr + 2 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 2 > outend))			      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -355,7 +355,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
 	      }								      \
-	    if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0))	      \
+	    if (__glibc_unlikely (written == __UNKNOWN_10646_CHAR))	      \
 	      {								      \
 		STANDARD_TO_LOOP_ERR_HANDLER (4);			      \
 	      }								      \
diff --git a/iconvdata/shift_jisx0213.c b/iconvdata/shift_jisx0213.c
index 94a2d155d6..a6c19acf3c 100644
--- a/iconvdata/shift_jisx0213.c
+++ b/iconvdata/shift_jisx0213.c
@@ -79,7 +79,7 @@
     {									      \
       if (FROM_DIRECTION)						      \
 	{								      \
-	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 4 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      *((uint32_t *) outbuf) = data->__statep->__count >> 3;	      \
@@ -92,7 +92,7 @@
 	}								      \
       else								      \
 	{								      \
-	  if (__builtin_expect (outbuf + 2 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 2 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      uint32_t lasttwo = data->__statep->__count >> 3;		      \
@@ -119,7 +119,7 @@
 									      \
     /* Determine whether there is a buffered character pending.  */	      \
     ch = *statep >> 3;							      \
-    if (__builtin_expect (ch == 0, 1))					      \
+    if (__glibc_likely (ch == 0))					      \
       {									      \
 	/* No - so look at the next input byte.  */			      \
 	ch = *inptr;							      \
@@ -127,9 +127,9 @@
 	if (ch < 0x80)							      \
 	  {								      \
 	    /* Plain ISO646-JP character.  */				      \
-	    if (__builtin_expect (ch == 0x5c, 0))			      \
+	    if (__glibc_unlikely (ch == 0x5c))				      \
 	      ch = 0xa5;						      \
-	    else if (__builtin_expect (ch == 0x7e, 0))			      \
+	    else if (__glibc_unlikely (ch == 0x7e))			      \
 	      ch = 0x203e;						      \
 	    ++inptr;							      \
 	  }								      \
@@ -144,7 +144,7 @@
 	    /* Two byte character.  */					      \
 	    uint32_t ch2;						      \
 									      \
-	    if (__builtin_expect (inptr + 1 >= inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	      {								      \
 		/* The second byte is not available.  */		      \
 		result = __GCONV_INCOMPLETE_INPUT;			      \
@@ -154,7 +154,7 @@
 	    ch2 = inptr[1];						      \
 									      \
 	    /* The second byte must be in the range 0x{40..7E,80..FC}.  */    \
-	    if (__builtin_expect (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc, 0))\
+	    if (__glibc_unlikely (ch2 < 0x40 || ch2 == 0x7f || ch2 > 0xfc))   \
 	      {								      \
 		/* This is an illegal character.  */			      \
 		STANDARD_FROM_LOOP_ERR_HANDLER (1);			      \
@@ -332,7 +332,7 @@ static const struct
 	if (len > 0)							      \
 	  {								      \
 	    /* Output the combined character.  */			      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -347,7 +347,7 @@ static const struct
 									      \
       not_combining:							      \
 	/* Output the buffered character.  */				      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -421,7 +421,7 @@ static const struct
 	  }								      \
 									      \
 	/* Output the shifted representation.  */			      \
-	if (__builtin_expect (outptr + 1 >= outend, 0))			      \
+	if (__glibc_unlikely (outptr + 1 >= outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c
index 34df564201..b0eacd112a 100644
--- a/iconvdata/sjis.c
+++ b/iconvdata/sjis.c
@@ -4361,7 +4361,7 @@ static const char from_ucs4_extra[0x100][2] =
 	uint32_t ch2;							      \
 	uint_fast32_t idx;						      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second byte is not available.  Store			      \
 	       the intermediate result.  */				      \
@@ -4371,7 +4371,7 @@ static const char from_ucs4_extra[0x100][2] =
 									      \
 	ch2 = inptr[1];							      \
 	idx = ch * 256 + ch2;						      \
-	if (__builtin_expect (ch2 < 0x40, 0))				      \
+	if (__glibc_unlikely (ch2 < 0x40))				      \
 	  {								      \
 	    /* This is illegal.  */					      \
 	    STANDARD_FROM_LOOP_ERR_HANDLER (1);				      \
@@ -4398,7 +4398,7 @@ static const char from_ucs4_extra[0x100][2] =
 	    else							      \
 	      ch = cjk_block4[(ch - 0xe0) * 192 + ch2 - 0x40];		      \
 									      \
-	    if (__builtin_expect (ch == 0, 0))				      \
+	    if (__glibc_unlikely (ch == 0))				      \
 	      {								      \
 		/* This is an illegal character.  */			      \
 		STANDARD_FROM_LOOP_ERR_HANDLER (2);			      \
@@ -4469,7 +4469,7 @@ static const char from_ucs4_extra[0x100][2] =
 	/* Now test for a possible second byte and write this if possible.  */\
 	if (cp[1] != '\0')						      \
 	  {								      \
-	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 1 >= outend))		      \
 	      {								      \
 		/* The result does not fit into the buffer.  */		      \
 		result = __GCONV_FULL_OUTPUT;				      \
diff --git a/iconvdata/t.61.c b/iconvdata/t.61.c
index e820eb907c..e20ff863ff 100644
--- a/iconvdata/t.61.c
+++ b/iconvdata/t.61.c
@@ -390,7 +390,7 @@ static const char from_ucs4[][2] =
 	   is also available.  */					      \
 	uint32_t ch2;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  */		      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
@@ -487,7 +487,7 @@ static const char from_ucs4[][2] =
     /* Now test for a possible second byte and write this if possible.  */    \
     if (cp[1] != '\0')							      \
       {									      \
-	if (__builtin_expect (outptr >= outend, 0))			      \
+	if (__glibc_unlikely (outptr >= outend))			      \
 	  {								      \
 	    /* The result does not fit into the buffer.  */		      \
 	    --outptr;							      \
diff --git a/iconvdata/tcvn5712-1.c b/iconvdata/tcvn5712-1.c
index 7a3ab455fa..21e1d4540a 100644
--- a/iconvdata/tcvn5712-1.c
+++ b/iconvdata/tcvn5712-1.c
@@ -64,7 +64,7 @@
     {									      \
       if (FROM_DIRECTION)						      \
 	{								      \
-	  if (__builtin_expect (outbuf + 4 <= outend, 1))		      \
+	  if (__glibc_likely (outbuf + 4 <= outend))			      \
 	    {								      \
 	      /* Write out the last character.  */			      \
 	      *((uint32_t *) outbuf) = data->__statep->__count >> 3;	      \
@@ -652,7 +652,7 @@ static const struct
 	    res = 0;							      \
 	  }								      \
 									      \
-	if (__builtin_expect (res != 0, 1))				      \
+	if (__glibc_likely (res != 0))					      \
 	  {								      \
 	    *outptr++ = res;						      \
 	    inptr += 4;							      \
@@ -696,7 +696,7 @@ static const struct
 		  }							      \
 									      \
 		/* See whether we have room for two bytes.  */		      \
-		if (__builtin_expect (outptr + 1 >= outend, 0))		      \
+		if (__glibc_unlikely (outptr + 1 >= outend))		      \
 		  {							      \
 		    result = __GCONV_FULL_OUTPUT;			      \
 		    break;						      \
diff --git a/iconvdata/tscii.c b/iconvdata/tscii.c
index e8363d12c9..8b98a0eaa2 100644
--- a/iconvdata/tscii.c
+++ b/iconvdata/tscii.c
@@ -90,7 +90,7 @@
 	{								      \
 	  do								      \
 	    {								      \
-	      if (__builtin_expect (outbuf + 4 > outend, 0))		      \
+	      if (__glibc_unlikely (outbuf + 4 > outend))		      \
 		{							      \
 		  /* We don't have enough room in the output buffer.  */      \
 		  status = __GCONV_FULL_OUTPUT;				      \
@@ -108,10 +108,10 @@
       else								      \
 	{								      \
 	  uint32_t last = data->__statep->__count >> 3;			      \
-	  if (__builtin_expect (last >> 8, 0))				      \
+	  if (__glibc_unlikely (last >> 8))				      \
 	    {								      \
 	      /* Write out the last character, two bytes.  */		      \
-	      if (__builtin_expect (outbuf + 2 <= outend, 1))		      \
+	      if (__glibc_likely (outbuf + 2 <= outend))		      \
 		{							      \
 		  *outbuf++ = last & 0xff;				      \
 		  *outbuf++ = (last >> 8) & 0xff;			      \
@@ -124,7 +124,7 @@
 	  else								      \
 	    {								      \
 	      /* Write out the last character, a single byte.  */	      \
-	      if (__builtin_expect (outbuf < outend, 1))		      \
+	      if (__glibc_likely (outbuf < outend))			      \
 		{							      \
 		  *outbuf++ = last & 0xff;				      \
 		  data->__statep->__count = 0;				      \
@@ -384,7 +384,7 @@ static const uint32_t tscii_next_state[6] =
 		/* See whether we have room for two characters.  Otherwise    \
 		   store only the first character now, and put the second     \
 		   one into the queue.  */				      \
-		if (__builtin_expect (outptr + 4 > outend, 0))		      \
+		if (__glibc_unlikely (outptr + 4 > outend))		      \
 		  {							      \
 		    *statep = u2 << 8;					      \
 		    result = __GCONV_FULL_OUTPUT;			      \
@@ -421,7 +421,7 @@ static const uint32_t tscii_next_state[6] =
 	    inptr++;							      \
 	    put32 (outptr, 0x0BB8);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BCD << 8) + (4 << 4);			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -429,7 +429,7 @@ static const uint32_t tscii_next_state[6] =
 	      }								      \
 	    put32 (outptr, 0x0BCD);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BB0 << 8) + (2 << 4);			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -437,7 +437,7 @@ static const uint32_t tscii_next_state[6] =
 	      }								      \
 	    put32 (outptr, 0x0BB0);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BC0 << 8);				      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -454,7 +454,7 @@ static const uint32_t tscii_next_state[6] =
 	    inptr++;							      \
 	    put32 (outptr, 0x0B95);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BCD << 8) + (1 << 4);			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -462,7 +462,7 @@ static const uint32_t tscii_next_state[6] =
 	      }								      \
 	    put32 (outptr, 0x0BCD);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BB7 << 8);				      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -479,7 +479,7 @@ static const uint32_t tscii_next_state[6] =
 	    inptr++;							      \
 	    put32 (outptr, 0x0B95);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BCD << 8) + (5 << 4);			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -487,7 +487,7 @@ static const uint32_t tscii_next_state[6] =
 	      }								      \
 	    put32 (outptr, 0x0BCD);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BB7 << 8) + (3 << 4);			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -495,7 +495,7 @@ static const uint32_t tscii_next_state[6] =
 	      }								      \
 	    put32 (outptr, 0x0BB7);					      \
 	    outptr += 4;						      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		*statep = (0x0BCD << 8);				      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -592,7 +592,7 @@ static const uint8_t consonant_with_virama[18] =
 	      }								      \
 	    if (ch == 0x0BC6)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 2 <= outend, 1))		      \
+		if (__glibc_likely (outptr + 2 <= outend))		      \
 		  {							      \
 		    *outptr++ = 0xa6;					      \
 		    *outptr++ = last;					      \
@@ -608,7 +608,7 @@ static const uint8_t consonant_with_virama[18] =
 	      }								      \
 	    if (ch == 0x0BC7)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 2 <= outend, 1))		      \
+		if (__glibc_likely (outptr + 2 <= outend))		      \
 		  {							      \
 		    *outptr++ = 0xa7;					      \
 		    *outptr++ = last;					      \
@@ -624,7 +624,7 @@ static const uint8_t consonant_with_virama[18] =
 	      }								      \
 	    if (ch == 0x0BC8)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 2 <= outend, 1))		      \
+		if (__glibc_likely (outptr + 2 <= outend))		      \
 		  {							      \
 		    *outptr++ = 0xa8;					      \
 		    *outptr++ = last;					      \
@@ -640,7 +640,7 @@ static const uint8_t consonant_with_virama[18] =
 	      }								      \
 	    if (ch == 0x0BCA)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 3 <= outend, 1))		      \
+		if (__glibc_likely (outptr + 3 <= outend))		      \
 		  {							      \
 		    *outptr++ = 0xa6;					      \
 		    *outptr++ = last;					      \
@@ -657,7 +657,7 @@ static const uint8_t consonant_with_virama[18] =
 	      }								      \
 	    if (ch == 0x0BCB)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 3 <= outend, 1))		      \
+		if (__glibc_likely (outptr + 3 <= outend))		      \
 		  {							      \
 		    *outptr++ = 0xa7;					      \
 		    *outptr++ = last;					      \
@@ -674,7 +674,7 @@ static const uint8_t consonant_with_virama[18] =
 	      }								      \
 	    if (ch == 0x0BCC)						      \
 	      {								      \
-		if (__builtin_expect (outptr + 3 <= outend, 1))		      \
+		if (__glibc_likely (outptr + 3 <= outend))		      \
 		  {							      \
 		    *outptr++ = 0xa7;					      \
 		    *outptr++ = last;					      \
@@ -771,9 +771,9 @@ static const uint8_t consonant_with_virama[18] =
 	  }								      \
 									      \
 	/* Output the buffered character.  */				      \
-	if (__builtin_expect (last >> 8, 0))				      \
+	if (__glibc_unlikely (last >> 8))				      \
 	  {								      \
-	    if (__builtin_expect (outptr + 2 <= outend, 1))		      \
+	    if (__glibc_likely (outptr + 2 <= outend))			      \
 	      {								      \
 		*outptr++ = last & 0xff;				      \
 		*outptr++ = (last >> 8) & 0xff;				      \
@@ -808,7 +808,7 @@ static const uint8_t consonant_with_virama[18] =
 	else if (ch >= 0x0BCA && ch <= 0x0BCC)				      \
 	  {								      \
 	    /* See whether we have room for two bytes.  */		      \
-	    if (__builtin_expect (outptr + 2 <= outend, 1))		      \
+	    if (__glibc_likely (outptr + 2 <= outend))			      \
 	      {								      \
 		*outptr++ = (ch == 0x0BCA ? 0xa6 : 0xa7);		      \
 		*outptr++ = (ch != 0x0BCC ? 0xa1 : 0xaa);		      \
diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c
index 4f5e71486d..318c3492b3 100644
--- a/iconvdata/uhc.c
+++ b/iconvdata/uhc.c
@@ -3076,7 +3076,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
 	   is also available.  */					      \
 	uint32_t ch2;							      \
 									      \
-	if (__builtin_expect (inptr + 1 >= inend, 0))			      \
+	if (__glibc_unlikely (inptr + 1 >= inend))			      \
 	  {								      \
 	    /* The second character is not available.  Store		      \
 	       the intermediate result.  */				      \
@@ -3123,7 +3123,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
 				     ? (ch - 0x81) * 178		      \
 				     : 5696 + (ch - 0xa1) * 84)];	      \
 									      \
-	    if (__builtin_expect (ch == 0, 0))				      \
+	    if (__glibc_unlikely (ch == 0))				      \
 	      {								      \
 		/* This is an illegal character.  */			      \
 		STANDARD_FROM_LOOP_ERR_HANDLER (2);			      \
@@ -3173,7 +3173,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
       {									      \
 	const char *s = uhc_hangul_from_ucs[ch - 0xac00];		      \
 									      \
-	if (__builtin_expect (outptr + 2 > outend, 0))			      \
+	if (__glibc_unlikely (outptr + 2 > outend))			      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
@@ -3186,12 +3186,12 @@ static const char uhc_hangul_from_ucs[11172][2] =
       {									      \
 	size_t written = ucs4_to_ksc5601_hanja (ch, outptr, outend - outptr); \
 									      \
-	if (__builtin_expect (written == 0, 0))				      \
+	if (__glibc_unlikely (written == 0))				      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
 	  }								      \
-	if (__builtin_expect (written == __UNKNOWN_10646_CHAR, 0))	      \
+	if (__glibc_unlikely (written == __UNKNOWN_10646_CHAR))		      \
 	  {								      \
 	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 	  }								      \
@@ -3213,7 +3213,7 @@ static const char uhc_hangul_from_ucs[11172][2] =
 	    UNICODE_TAG_HANDLER (ch, 4);				      \
 	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 	  }								      \
-	if (__builtin_expect (written == 0, 0))				      \
+	if (__glibc_unlikely (written == 0))				      \
 	  {								      \
 	    result = __GCONV_FULL_OUTPUT;				      \
 	    break;							      \
diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c
index 00d63ef338..ed74582bad 100644
--- a/iconvdata/unicode.c
+++ b/iconvdata/unicode.c
@@ -64,7 +64,7 @@
   else if (!data->__internal_use && data->__invocation_counter == 0)	      \
     {									      \
       /* Emit the Byte Order Mark.  */					      \
-      if (__builtin_expect (outbuf + 2 > outend, 0))			      \
+      if (__glibc_unlikely (outbuf + 2 > outend))			      \
 	return __GCONV_FULL_OUTPUT;					      \
 									      \
       put16u (outbuf, BOM);						      \
@@ -150,12 +150,12 @@ gconv_end (struct __gconv_step *data)
   {									      \
     uint32_t c = get32 (inptr);						      \
 									      \
-    if (__builtin_expect (c >= 0x10000, 0))				      \
+    if (__glibc_unlikely (c >= 0x10000))				      \
       {									      \
 	UNICODE_TAG_HANDLER (c, 4);					      \
 	STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
       }									      \
-    else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0))		      \
+    else if (__glibc_unlikely (c >= 0xd800 && c < 0xe000))		      \
       {									      \
 	/* Surrogate characters in UCS-4 input are not valid.		      \
 	   We must catch this, because the UCS-2 output might be	      \
@@ -195,7 +195,7 @@ gconv_end (struct __gconv_step *data)
     if (swap)								      \
       u1 = bswap_16 (u1);						      \
 									      \
-    if (__builtin_expect (u1 >= 0xd800 && u1 < 0xe000, 0))		      \
+    if (__glibc_unlikely (u1 >= 0xd800 && u1 < 0xe000))			      \
       {									      \
 	/* Surrogate characters in UCS-2 input are not valid.  Reject	      \
 	   them.  (Catching this here is not security relevant.)  */	      \
diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c
index 43be4be9c1..48edfa35f3 100644
--- a/iconvdata/utf-16.c
+++ b/iconvdata/utf-16.c
@@ -43,7 +43,7 @@
 #define PREPARE_LOOP \
   enum direction dir = ((struct utf16_data *) step->__data)->dir;	      \
   enum variant var = ((struct utf16_data *) step->__data)->var;		      \
-  if (__builtin_expect (data->__invocation_counter == 0, 0))		      \
+  if (__glibc_unlikely (data->__invocation_counter == 0))		      \
     {									      \
       if (var == UTF_16)						      \
 	{								      \
@@ -67,7 +67,7 @@
 	  else if (!FROM_DIRECTION && !data->__internal_use)		      \
 	    {								      \
 	      /* Emit the Byte Order Mark.  */				      \
-	      if (__builtin_expect (outbuf + 2 > outend, 0))		      \
+	      if (__glibc_unlikely (outbuf + 2 > outend))		      \
 		return __GCONV_FULL_OUTPUT;				      \
 									      \
 	      put16u (outbuf, BOM);					      \
@@ -200,7 +200,7 @@ gconv_end (struct __gconv_step *data)
   {									      \
     uint32_t c = get32 (inptr);						      \
 									      \
-    if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0))		      \
+    if (__glibc_unlikely (c >= 0xd800 && c < 0xe000))			      \
       {									      \
 	/* Surrogate characters in UCS-4 input are not valid.		      \
 	   We must catch this.  If we let surrogates pass through,	      \
@@ -216,15 +216,15 @@ gconv_end (struct __gconv_step *data)
 									      \
     if (swap)								      \
       {									      \
-	if (__builtin_expect (c >= 0x10000, 0))				      \
+	if (__glibc_unlikely (c >= 0x10000))				      \
 	  {								      \
-	    if (__builtin_expect (c >= 0x110000, 0))			      \
+	    if (__glibc_unlikely (c >= 0x110000))			      \
 	      {								      \
 		STANDARD_TO_LOOP_ERR_HANDLER (4);			      \
 	      }								      \
 									      \
 	    /* Generate a surrogate character.  */			      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		/* Overflow in the output buffer.  */			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -240,15 +240,15 @@ gconv_end (struct __gconv_step *data)
       }									      \
     else								      \
       {									      \
-	if (__builtin_expect (c >= 0x10000, 0))				      \
+	if (__glibc_unlikely (c >= 0x10000))				      \
 	  {								      \
-	    if (__builtin_expect (c >= 0x110000, 0))			      \
+	    if (__glibc_unlikely (c >= 0x110000))			      \
 	      {								      \
 		STANDARD_TO_LOOP_ERR_HANDLER (4);			      \
 	      }								      \
 									      \
 	    /* Generate a surrogate character.  */			      \
-	    if (__builtin_expect (outptr + 4 > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + 4 > outend))			      \
 	      {								      \
 		/* Overflow in the output buffer.  */			      \
 		result = __GCONV_FULL_OUTPUT;				      \
@@ -296,7 +296,7 @@ gconv_end (struct __gconv_step *data)
 									      \
 	    /* It's a surrogate character.  At least the first word says      \
 	       it is.  */						      \
-	    if (__builtin_expect (inptr + 4 > inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 4 > inend))			      \
 	      {								      \
 		/* We don't have enough input for another complete input      \
 		   character.  */					      \
@@ -330,7 +330,7 @@ gconv_end (struct __gconv_step *data)
 	  {								      \
 	    /* It's a surrogate character.  At least the first word says      \
 	       it is.  */						      \
-	    if (__builtin_expect (inptr + 4 > inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 4 > inend))			      \
 	      {								      \
 		/* We don't have enough input for another complete input      \
 		   character.  */					      \
diff --git a/iconvdata/utf-32.c b/iconvdata/utf-32.c
index f21f2be041..7705d47265 100644
--- a/iconvdata/utf-32.c
+++ b/iconvdata/utf-32.c
@@ -44,7 +44,7 @@
   int swap;								      \
   if (FROM_DIRECTION && var == UTF_32)					      \
     {									      \
-      if (__builtin_expect (data->__invocation_counter == 0, 0))	      \
+      if (__glibc_unlikely (data->__invocation_counter == 0))		      \
 	{								      \
 	  /* We have to find out which byte order the file is encoded in.  */ \
 	  if (inptr + 4 > inend)					      \
@@ -65,7 +65,7 @@
 	   && data->__invocation_counter == 0)				      \
     {									      \
       /* Emit the Byte Order Mark.  */					      \
-      if (__builtin_expect (outbuf + 4 > outend, 0))			      \
+      if (__glibc_unlikely (outbuf + 4 > outend))			      \
 	return __GCONV_FULL_OUTPUT;					      \
 									      \
       put32u (outbuf, BOM);						      \
@@ -196,11 +196,11 @@ gconv_end (struct __gconv_step *data)
   {									      \
     uint32_t c = get32 (inptr);						      \
 									      \
-    if (__builtin_expect (c >= 0x110000, 0))				      \
+    if (__glibc_unlikely (c >= 0x110000))				      \
       {									      \
 	STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
       }									      \
-    else if (__builtin_expect (c >= 0xd800 && c < 0xe000, 0))		      \
+    else if (__glibc_unlikely (c >= 0xd800 && c < 0xe000))		      \
       {									      \
 	/* Surrogate characters in UCS-4 input are not valid.		      \
 	   We must catch this.  If we let surrogates pass through,	      \
@@ -238,7 +238,7 @@ gconv_end (struct __gconv_step *data)
     if (swap)								      \
       u1 = bswap_32 (u1);						      \
 									      \
-    if (__builtin_expect (u1 >= 0x110000, 0))				      \
+    if (__glibc_unlikely (u1 >= 0x110000))				      \
       {									      \
 	/* This is illegal.  */						      \
 	STANDARD_FROM_LOOP_ERR_HANDLER (4);				      \
diff --git a/iconvdata/utf-7.c b/iconvdata/utf-7.c
index 17a9fea656..99c255e4cb 100644
--- a/iconvdata/utf-7.c
+++ b/iconvdata/utf-7.c
@@ -167,9 +167,9 @@ base64 (unsigned int i)
 	    put32 (outptr, ch);						      \
 	    outptr += 4;						      \
 	  }								      \
-	else if (__builtin_expect (ch == '+', 1))			      \
+	else if (__glibc_likely (ch == '+'))				      \
 	  {								      \
-	    if (__builtin_expect (inptr + 2 > inend, 0))		      \
+	    if (__glibc_unlikely (inptr + 2 > inend))			      \
 	      {								      \
 		/* Not enough input available.  */			      \
 		result = __GCONV_INCOMPLETE_INPUT;			      \
@@ -340,7 +340,7 @@ base64 (unsigned int i)
 	    else							      \
 	      STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 									      \
-	    if (__builtin_expect (outptr + count > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + count > outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -381,7 +381,7 @@ base64 (unsigned int i)
 	    size_t count;						      \
 									      \
 	    count = ((statep->__count & 0x18) >= 0x10) + isxbase64 (ch) + 1;  \
-	    if (__builtin_expect (outptr + count > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + count > outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -405,7 +405,7 @@ base64 (unsigned int i)
 	    else							      \
 	      STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 									      \
-	    if (__builtin_expect (outptr + count > outend, 0))		      \
+	    if (__glibc_unlikely (outptr + count > outend))		      \
 	      {								      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
@@ -509,7 +509,7 @@ base64 (unsigned int i)
 	  /* Deactivate base64 encoding.  */				      \
 	  size_t count = ((state & 0x18) >= 0x10) + 1;			      \
 									      \
-	  if (__builtin_expect (outbuf + count > outend, 0))		      \
+	  if (__glibc_unlikely (outbuf + count > outend))		      \
 	    /* We don't have enough room in the output buffer.  */	      \
 	    status = __GCONV_FULL_OUTPUT;				      \
 	  else								      \