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

            Bug ID: 92140
           Summary: clang vs gcc optimizing with adc/sbb
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hermantenbrugge at home dot nl
  Target Milestone: ---

The following code:

extern char table[];
extern int c, v;

void tst1 (void) { v += table[c] != 0; }
void tst2 (void) { v -= table[c] != 0; }
unsigned int tst3 (unsigned int n) { return n ? 2 : 1; }

compiled with gcc and clang see some optimizing opportunities for gcc.
Table with instruction generated:
        gcc    clang
tst1:     5        3
tst2:     5        3
tst3:     4        3

This is with:
gcc (GCC) 10.0.0 20191017 (experimental)
clang version 10.0.0 (trunk 373843)

Reply via email to