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

            Bug ID: 41182
           Summary: TargetLowering.SimplifySetCC - missing icmp eq
                    knownbits combine
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedb...@nondot.org
          Reporter: llvm-...@redking.me.uk
                CC: lebedev...@gmail.com, llvm-bugs@lists.llvm.org,
                    spatel+l...@rotateright.com

https://gcc.godbolt.org/z/JahwVe

define i32 @square(i32 %a0)  {
    %1 = and i32 %a0, 127
    %2 = icmp eq i32 %1, -2
    %3 = select i1 %2, i32 42, i32 -17
    ret i32 %3
}

square: # @square
  andl $127, %edi
  cmpl $-2, %edi
  movl $42, %ecx
  movl $-17, %eax
  cmovel %ecx, %eax
  retq


We should be able to constant fold this completely as we know that some of the
known bits will never match:

square: # @square
  movl $-17, %eax
  retq

-- 
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