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

            Bug ID: 82439
           Summary: [AArch64] Missing (x | y) == x simplifications
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wilco at gcc dot gnu.org
  Target Milestone: ---

The following logical simplifications are missing on targets with a bitclear
instruction:

(x | y) == x -> (y & ~x) == 0
(x & y) == y -> (y & ~x) == 0

Simple testcase (f1 should generate the same as f2):

int f1(int x, int y) { return (x | y) == x; }
int f2(int x, int y) { return (y & ~x) == 0; }

f1:
        orr     w1, w0, w1
        cmp     w1, w0
        cset    w0, eq
        ret
f2:
        bics    wzr, w1, w0
        cset    w0, eq
        ret

Reply via email to