[llvm-bugs] [Bug 51014] Failure to merge div(x, y) with sub(x, mul(div(x, y), y)) to divrem(x, y)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 24 10:08:21 PDT 2021


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

Simon Pilgrim <llvm-dev at redking.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #4 from Simon Pilgrim <llvm-dev at redking.me.uk> ---
int sdivrem(int x, int y) {
    int d = x / y;
    int r = d - (d * y);
    return r;
}

This isn't actually a srem, that would be:

int sdivrem(int x, int y) {
    int d = x / y;
    int r = x - (d * y);
    return r;
}

Which works fine.

I'm rather annoyed with myself.............

-- 
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/20210724/ab2aa3d4/attachment.html>


More information about the llvm-bugs mailing list