[llvm-bugs] [Bug 44136] New: Missed optimization: bitwise OR

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 25 08:21:58 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44136

            Bug ID: 44136
           Summary: Missed optimization: bitwise OR
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zamazan4ik at tut.by
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

For the following code:

bool foo(int A, int B) {
    return (A | B) == A;
}

clang(trunk) with '-O3 -march=haswell' produces:

foo(int, int): # @foo(int, int)
  or esi, edi
  cmp esi, edi
  sete al
  ret

but GCC(trunk) with '-O3 -march=haswell' produces:

foo(int, int):
  andn eax, edi, esi
  sete al
  ret

Godbolt playground: https://godbolt.org/z/MZNdWW

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191125/317d080d/attachment.html>


More information about the llvm-bugs mailing list