[llvm-bugs] [Bug 47432] New: Optimization for a * 10 == b * 10
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Sat Sep  5 08:11:37 PDT 2020
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=47432
            Bug ID: 47432
           Summary: Optimization for a * 10 == b * 10
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org
bool f(int a, int b)
{
  return a * 9 == b * 9;
}
bool g(int a, int b)
{
  return a * 10 == b * 10;
}
bool h(int a, int b)
{
  return a * 11 == b * 11;
}
Clang:
f(int, int):                                 # @f(int, int)
        cmp     edi, esi
        sete    al
        ret
g(int, int):                                 # @g(int, int)
        xor     edi, esi
        test    edi, 2147483647
        sete    al
        ret
h(int, int):                                 # @h(int, int)
        cmp     edi, esi
        sete    al
        ret
Why 10 is so special here?
https://godbolt.org/z/jdPhf5
-- 
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/20200905/63097231/attachment.html>
    
    
More information about the llvm-bugs
mailing list