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

            Bug ID: 87355
           Summary: missed comparison optimizations (grep DFA, x86-64)
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at cs dot ucla.edu
  Target Milestone: ---

Created attachment 44720
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44720&action=edit
source code illustrating missed optimizations

I found this when attempting to tune grep's DFA code on x86-64, and simplified
the issue to the attached source code t.c which defines two functions f and g
that are logically equivalent, and which can both be implemented via a single
machine-language comparison to THRESHOLD. However, GCC generates two
comparisons for f and three comparisons for g, as shown in the attached
assembly-language file t.s generated by 'gcc -O2 -S t.c'. I am running Fedora
28 x86-64 with 8.1.1 20180712 (Red Hat 8.1.1-5).

I'm not sure whether this problem is limited to x86-64 or is more general, and
for now am labeling its component as 'target'.

Reply via email to