[llvm-bugs] [Bug 38002] New: Missed opportunity for SETE for 2-cases switch

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 30 06:16:47 PDT 2018


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

            Bug ID: 38002
           Summary: Missed opportunity for SETE for 2-cases switch
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hello,

Code:
bool sw1(int x) {
    switch(x) {
        case 3:
        case 5:
            return true;

        default:
            return false;
    }
}

Clang trunk -03/Os:
sw1(int): # @sw1(int)
  mov al, 1
  cmp edi, 3
  je .LBB0_3
  cmp edi, 5
  jne .LBB0_2        <----------- avoid jump, use "sete al"?
.LBB0_3:
  ret
.LBB0_2:
  xor eax, eax
  ret

-- 
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/20180630/097a9cd5/attachment.html>


More information about the llvm-bugs mailing list