[LLVMdev] Integer factorizations in clang
Jean-Daniel Dupas
devlists at shadowlab.org
Thu Jan 5 07:35:09 PST 2012
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.
-- Jean-Daniel
More information about the llvm-dev
mailing list