[Bug gas/29794] find_reloc_table_entry in tc-aarch64.c should be speed up

2022-11-16 Thread pinskia at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=29794

--- Comment #2 from Andrew Pinski  ---
There is another thing which could be done is do strchr up front to find the
other : and then match the length and not do the strncasecmp in that case.

That is:
static struct reloc_table_entry *
find_reloc_table_entry (char **str)
{
  unsigned int i;
  const char *relocnameinstrend = strchr(*str, ':');
  if (!relocnameinstrend)
return NULL;

  int reloclengthinstr = *str - relocnameinstrend;
  for (i = 0; i < ARRAY_SIZE (reloc_table); i++)
{
  int length = reloc_table[i].name_length;
  if (length == -1)
length = strlen (reloc_table[i].name);
  if (reloclengthinstr != length)
continue;

  if (strncasecmp (reloc_table[i].name, *str, length) == 0
  && (*str)[length] == ':')
{
  *str += (length + 1);
  return &reloc_table[i];
}
}

  return NULL;
}

- CUT 
These two should give a reasonable speed up I think. Also reording the list to
the most used first will also speed it up (I think that is the reason why lo12
is first already).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/29794] find_reloc_table_entry in tc-aarch64.c should be speed up

2022-11-16 Thread pinskia at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=29794

--- Comment #1 from Andrew Pinski  ---
Created attachment 14459
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14459&action=edit
First attempt at a patch for this

I did not test this and I am not 100% sure about the GNUC check. I need to
check other locations which use this trick (if there is others).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug gas/29794] find_reloc_table_entry in tc-aarch64.c should be speed up

2022-11-16 Thread pinskia at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=29794

Andrew Pinski  changed:

   What|Removed |Added

Summary|find_reloc_table_entry  |find_reloc_table_entry in
   |should be speed up  |tc-aarch64.c should be
   ||speed up

-- 
You are receiving this mail because:
You are on the CC list for the bug.