[LLVMdev] Integer factorizations in clang

Ivan Llopard ivanllopard at gmail.com
Thu Jan 5 23:42:57 PST 2012


Le 05/01/2012 16:35, Jean-Daniel Dupas a écrit :
> Le 5 janv. 2012 à 15:59, Ivan Llopard a écrit :
>
>> Hello,
>>
>> I have a small test case :
>>
>> a = b * c + b * d
>>
>> and clang is fatorizing b to get only one multiplication (-O3) which is
>> normally good for most architectures. But in my case, that pattern takes
>> just one instruction and I would like to recover it as is.
>> Where can I find this particular optimization in clang ?
>> Is there a way of setting multiplications as being cheaper than
>> additions/subtracions in clang ?
> Wouldn't it be simpler to detect factorize pattern in you code and generate the appropriate instruction as it if was a decomposed form.
> It would have the benefit to properly optimize the code if the developer choose to use the factorized form directly.

Ok, I will try to match the factorized form from my back-end. Thanks you 
all.

>
> -- Jean-Daniel
>
>
>
>



More information about the llvm-dev mailing list