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

            Bug ID: 42207
           Summary: Missing simplification (x > y) AND (x > z) to x > MAX
                    (y,z))
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@lists.llvm.org

unsigned int max (unsigned int i, unsigned int m, unsigned int n) {
    return i > m && i > n;
}

unsigned int max2 (unsigned int i, unsigned int m, unsigned int n) {
    return i > std::max (m,n);
}

Clang -O3
max(unsigned int, unsigned int, unsigned int):
  cmp edi, esi
  seta al
  cmp edi, edx
  seta cl
  and cl, al
  movzx eax, cl
  ret
max2(unsigned int, unsigned int, unsigned int):  int, unsigned int)
  cmp esi, edx
  cmovb esi, edx
  xor eax, eax
  cmp esi, edi
  setb al
  ret

GCC generates same code for both functions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to