https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67014

            Bug ID: 67014
           Summary: builtin_tolower is inefficient.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neleai at seznam dot cz
  Target Milestone: ---

Hi,

When one uses __builtin_tolower it could be much slower to tolower. In this
example builtin_tolower gets just expanded to call. If one uses tolower instead 
it gets expanded to getting table with __ctype_tolower_loc and then doing 1000
table lookups instead 1000 calls.

#include <ctype.h>
int foo(char *c)
{
 int i;
 for(i=0;i<1000;i++)
   c[i]=__builtin_tolower(c[i]);
}

Reply via email to