[llvm-bugs] [Bug 42328] New: Missed canonicalization x / (- y) -> (-x) / y

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 19 07:44:57 PDT 2019


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

            Bug ID: 42328
           Summary: Missed canonicalization x / (- y) -> (-x) / y
           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

int div_neg (int x, int y)
{
  return x / (- y);
}

int div_negx (int x, int y)
{
  return  -x / y;
}


div_neg(int, int):  
        mov     eax, edi
        neg     esi
        cdq
        idiv    esi
        ret
div_negx(int, int):
        mov     eax, edi
        cdq
        idiv    esi
        neg     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/20190619/eabb106a/attachment-0001.html>


More information about the llvm-bugs mailing list