Re: [PATCH] Inline memchr with a small constant string

2022-07-07 Thread H.J. Lu via Gcc-patches
On Thu, Jun 23, 2022 at 9:26 AM H.J. Lu wrote: > > On Wed, Jun 22, 2022 at 11:03 PM Richard Biener > wrote: > > > > On Wed, Jun 22, 2022 at 7:13 PM H.J. Lu wrote: > > > > > > On Wed, Jun 22, 2022 at 4:39 AM Richard Biener > > > wrote: > > > > > > > > On Tue, Jun 21, 2022 at 11:03 PM H.J. Lu

Re: [PATCH] Inline memchr with a small constant string

2022-06-23 Thread H.J. Lu via Gcc-patches
On Wed, Jun 22, 2022 at 11:03 PM Richard Biener wrote: > > On Wed, Jun 22, 2022 at 7:13 PM H.J. Lu wrote: > > > > On Wed, Jun 22, 2022 at 4:39 AM Richard Biener > > wrote: > > > > > > On Tue, Jun 21, 2022 at 11:03 PM H.J. Lu via Gcc-patches > > > wrote: > > > > > > > > When memchr is applied

Re: [PATCH] Inline memchr with a small constant string

2022-06-23 Thread Richard Biener via Gcc-patches
On Wed, Jun 22, 2022 at 7:13 PM H.J. Lu wrote: > > On Wed, Jun 22, 2022 at 4:39 AM Richard Biener > wrote: > > > > On Tue, Jun 21, 2022 at 11:03 PM H.J. Lu via Gcc-patches > > wrote: > > > > > > When memchr is applied on a constant string of no more than the bytes of > > > a word, inline memchr

Re: [PATCH] Inline memchr with a small constant string

2022-06-22 Thread H.J. Lu via Gcc-patches
On Wed, Jun 22, 2022 at 4:39 AM Richard Biener wrote: > > On Tue, Jun 21, 2022 at 11:03 PM H.J. Lu via Gcc-patches > wrote: > > > > When memchr is applied on a constant string of no more than the bytes of > > a word, inline memchr by checking each byte in the constant string. > > > > int f (int

Re: [PATCH] Inline memchr with a small constant string

2022-06-22 Thread Richard Biener via Gcc-patches
On Tue, Jun 21, 2022 at 11:03 PM H.J. Lu via Gcc-patches wrote: > > When memchr is applied on a constant string of no more than the bytes of > a word, inline memchr by checking each byte in the constant string. > > int f (int a) > { >return __builtin_memchr ("eE", a, 2) != 0; > } > > is

[PATCH] Inline memchr with a small constant string

2022-06-21 Thread H.J. Lu via Gcc-patches
When memchr is applied on a constant string of no more than the bytes of a word, inline memchr by checking each byte in the constant string. int f (int a) { return __builtin_memchr ("eE", a, 2) != 0; } is simplified to int f (int a) { return (char) a == 'e' || (char) a == 'E'; } gcc/