Hi,
MADD(W-form) [1] and UMADDL[2] does 32-bit multiplication and adds multiplication results to a 64-bit integer.
My question is, do these two instructions handle possible overflow (2 32-bit integers gives a 64-bit result) correctly? I think this is true based on https://godbolt.org/z/rEWd7a76q (gcc uses `umaddl`) but didn't see it mentioned explicitly in the documentation ([1] and [2]), so would like to confirm. Thank you!
[1] https://developer.arm.com/documentation/dui0802/a/A64-General-Instructions/MADD?lang=en
[2] https://developer.arm.com/documentation/dui0802/a/UMADDL
I'm not sure what you mean with correctly here since unsigned arithmetic can't overflow. If you mean does it get truncated/wrap around then yes.
FWIW, the full definition and the semantics of instructions can be found in the full Arm Architectural Reference Manual. https://developer.arm.com/documentation/ddi0487/latest you have to download the PDF and search for the instructions inside it and you'll find the pseudo-code for each.
Yes I mean truncation/wrapping --> for example, results `(numeric_limits<uint32_t>::max() - 2) * ((uint32_t) 2)` will wrap around.
Finding pseudo code is indeed the solution. Thanks!