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

            Bug ID: 109832
           Summary: aarch64: Inefficient code for logical or of two
                    booleans
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

For the following testcase:

bool f(bool x, bool y) {
    return x || y;
}

on AArch64 at -O2 we generate the rather convoluted:

f:
        and     w1, w1, 255
        tst     w0, 255
        ccmp    w1, 0, 0, eq
        cset    w0, ne
        ret

but clang gives the more optimal:

f:                                      // @f
        orr     w8, w0, w1
        and     w0, w8, #0x1
        ret

we should probably do what clang does here.

Reply via email to