[PATCH] InstCombine: Recognize an unsigned mul with overflow idiom into umul.
Erik Verbruggen
erik.verbruggen at me.com
Tue Mar 25 12:11:04 PDT 2014
On 25 Mar 2014, at 16:23, Benjamin Kramer <benny.kra at gmail.com> wrote:
>
> On 19.03.2014, at 17:47, Erik Verbruggen <erik.verbruggen at me.com> wrote:
>
>> [PATCH] InstCombine: Recognize an unsigned mul with overflow idiom into umul.
>>
>> (a*b) <u a --> llvm.umul.with.overflow.
>> (a*b) <u b --> llvm.umul.with.overflow.
>> a >u (a*b) --> llvm.umul.with.overflow.
>> b >u (a*b) --> llvm.umul.with.overflow.
>>
>> This resolves a README entry and technically resolves PR4917.
>>
>> <0001-InstCombine-Recognize-an-unsigned-mul-with-overflow-.patch>
>
> The patch looks good to me. I'm just a bit nervous about feeding the backend umul.with.overflow with arbitrary integer types. Can you do some testing, esp. with strange types on a range of backends (e.g. ARM, PPC, …) so we don't get crash regressions there?
I ran a test on x86_64 for i14-i18 for both signed and unsigned, comparing it to a (u)int64_t multiplication done in C. I'll repeat it on ARM. If anyone has an idea how I can turn that into a somewhat useful and repeatable auto-test, let me know.
-- Erik.
More information about the llvm-commits
mailing list