[llvm-dev] How to handle UMULO?

Bruce Hoult via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 28 05:42:59 PST 2018

I think your users will be very upset if you don't set the boolean return
value correctly :-)

Whatever work it takes to determine the correct value for it, if the user
code doesn't need/use that value then the dead code will be eliminated
later. But if they need that return flag then they will want it to be

You may need to use a multiply instruction that returns a double-register
result, or an instruction that returns only the upper half of the result.
Or you might need to widen the operands and do a full double-width
multiply. Or you might need to narrow the operands into two halves, do four
(or three) multiplies and some shifts and adds (again detecting
carry/overflow, but that's easier for addition).

It all depends on what instructions your target has.

On Wed, Feb 28, 2018 at 4:31 PM, 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org>

> Hi All,
>   While compiling libgcc, I find I have to deal with UMULO (overflow-aware
> unsigned multiplication) SDNode. UMULO returns the result of
> multiplication, and a boolean indicating overflow occurred or not. Our
> target's multiply instruction doesn't care (detect) overflow. I am
> wondering if I can always set the boolean to false. I am not sure about
> this as I see AArch64 [1] seems trying to emulate the overflow behavior.
>   Thanks.
> [1] https://github.com/llvm-mirror/llvm/blob/master/lib/Target/AArch64/
> AArch64ISelLowering.cpp
> ​Regards,
> chenwj​
> --
> Wei-Ren Chen (陳韋任)
> Homepage: https://people.cs.nctu.edu.tw/~chenwj
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180228/7c3cd70b/attachment.html>

More information about the llvm-dev mailing list