Re: help with PR78809 - inline strcmp for small constant strings

2017-08-06 Thread Martin Sebor
On 08/04/2017 06:59 AM, Prathamesh Kulkarni wrote: Hi, I was having a look at PR78809. For the test-case: int t1(const char *s) { return __builtin_strcmp (s, "a"); } for aarch64, trunk with -O2 generates: t1: adrpx1, .LANCHOR0 add x1, x1, :lo12:.LANCHOR0 b s

Re: help with PR78809 - inline strcmp for small constant strings

2017-08-05 Thread Aaron Sawdey
On Fri, 2017-08-04 at 17:30 -0500, Segher Boessenkool wrote: > On Fri, Aug 04, 2017 at 08:38:11PM +, Wilco Dijkstra wrote: > > Richard Henderson wrote: > > > On 08/04/2017 05:59 AM, Prathamesh Kulkarni wrote: > > > > For i386, it seems strcmp is expanded inline via cmpstr optab > > > > by 

Re: help with PR78809 - inline strcmp for small constant strings

2017-08-04 Thread Segher Boessenkool
On Fri, Aug 04, 2017 at 08:38:11PM +, Wilco Dijkstra wrote: > Richard Henderson wrote:  > > On 08/04/2017 05:59 AM, Prathamesh Kulkarni wrote: > > > > For i386, it seems strcmp is expanded inline via cmpstr optab by > > > expand_builtin_strcmp if one of the strings is constant. Could we >

Re: help with PR78809 - inline strcmp for small constant strings

2017-08-04 Thread Richard Henderson
On 08/04/2017 01:38 PM, Wilco Dijkstra wrote: >> For constant strings of small length (upto 3?), I was wondering if it'd be a >> good idea to manually unroll strcmp loop, similar to __strcmp_* macros in >> bits/string.h?> >> For eg in gimple-fold, transform >> x = __builtin_strcmp(s, "ab") >> to >>

Re: help with PR78809 - inline strcmp for small constant strings

2017-08-04 Thread Wilco Dijkstra
Richard Henderson wrote:  > On 08/04/2017 05:59 AM, Prathamesh Kulkarni wrote: > > For i386, it seems strcmp is expanded inline via cmpstr optab by > > expand_builtin_strcmp if one of the strings is constant. Could we similarly > > define cmpstr pattern for AArch64? > > Certainly that's possi

Re: help with PR78809 - inline strcmp for small constant strings

2017-08-04 Thread Richard Henderson
On 08/04/2017 05:59 AM, Prathamesh Kulkarni wrote: > Hi, > I was having a look at PR78809. > For the test-case: > int t1(const char *s) { return __builtin_strcmp (s, "a"); } > > for aarch64, trunk with -O2 generates: > t1: > adrpx1, .LANCHOR0 > add x1, x1, :lo12:.LANCHOR0 >

help with PR78809 - inline strcmp for small constant strings

2017-08-04 Thread Prathamesh Kulkarni
Hi, I was having a look at PR78809. For the test-case: int t1(const char *s) { return __builtin_strcmp (s, "a"); } for aarch64, trunk with -O2 generates: t1: adrpx1, .LANCHOR0 add x1, x1, :lo12:.LANCHOR0 b strcmp For i386, it seems strcmp is expanded inline v