[llvm-dev] Semantics of Generic MIR overflowing operations?
Cassie Jones via llvm-dev
llvm-dev at lists.llvm.org
Sun Jan 17 22:11:14 PST 2021
Hi,
I was looking at the overflowing operations because I was trying to deal with the legalization and selection of wide adds, and I wasn’t sure on the finer points of some of the semantics.
I’m specifically looking at the addition/subtraction operations:
G_UADDO, G_SADDO, G_USUBO, G_SSUBO
G_UADDE, G_SADDE, G_USUBE, G_SSUBE
Is it correct that the S* operations set the carry-out value when they have a signed overflow, and the U* operations when they have an unsigned overflow?
Particularly, is there any difference between them if the carry-out isn’t used by anything?
I would expect that a decomposed wide add would have a sequence like the following:
G_UADDO
G_UADDE
...
Would that just need to end with a G_SADDE when implementing an operation like Rust's i128::checked_add()?
Finally, Is there a reason that G_SADDE and G_SSUBE aren’t legal in the AArch64 backend? (Particularly while G_SADDO and G_SSUBO are.)
They seem like they have the potential to produce bad code if used in the middle of a sequence like that, but I don’t know if that’s a reason to make them illegal so I was wondering if there was something else I was missing.
Thanks,
— Cassie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210118/14b6e5de/attachment.html>
More information about the llvm-dev
mailing list