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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to