On 01/13/2017 12:53 PM, Krzysztof Parzyszek wrote:> On 1/13/2017 10:52 AM, Hal Finkel wrote: >> but I think we need to discuss the use case. > > The main case for us was recognizing polynomial multiplications. > Hexagon has instructions that do that, and the goal was to replace > loops that do that with intrinsics. The problem is that these loops > often get unrolled and intertwined with other code, making the > replacement hard, or impossible. This is especially true if some of > the multiplication code is combined with instructions that were not > originally part of it (I don't remember 100% if that was happening, > but the loop optimizations were the main culprit in making it hard).This is integer multiplication or floating-point multiplication? If it is integer multiplication, I'd expect that using SCEV would be the easiest way to recognize the relevant patterns. SCEV is supposed to understand all of the unobfuscation tricks. Do these instructions contain an implicit loop (of runtime trip count) or are you trying to match loops of some fixed trip count? -Hal> > -Krzysztof >-- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory
On 1/13/2017 7:08 PM, Hal Finkel wrote:> This is integer multiplication or floating-point multiplication? If it > is integer multiplication, I'd expect that using SCEV would be the > easiest way to recognize the relevant patterns. SCEV is supposed to > understand all of the unobfuscation tricks. > > Do these instructions contain an implicit loop (of runtime trip count) > or are you trying to match loops of some fixed trip count?It's binary polynomial multiplication. The loops are usually with a compile-time constant iteration count. I posted a specific patch with that code: https://reviews.llvm.org/D28694 -Krzysztof
The result in the example I made doesn't need to be exactly like that; that is I want to recognize the inner loop and translate it into a machine instruction. I thought that translating it into an intrinsic could be easier but it seems not. What I was thinking to do is to modify the Mips backend adding a Loop Pass or a Function Pass. Do you think that this could work? 2017-01-14 23:57 GMT+01:00 Krzysztof Parzyszek via llvm-dev < llvm-dev at lists.llvm.org>:> On 1/13/2017 7:08 PM, Hal Finkel wrote: > >> This is integer multiplication or floating-point multiplication? If it >> is integer multiplication, I'd expect that using SCEV would be the >> easiest way to recognize the relevant patterns. SCEV is supposed to >> understand all of the unobfuscation tricks. >> >> Do these instructions contain an implicit loop (of runtime trip count) >> or are you trying to match loops of some fixed trip count? >> > > It's binary polynomial multiplication. The loops are usually with a > compile-time constant iteration count. > > I posted a specific patch with that code: > https://reviews.llvm.org/D28694 > > -Krzysztof > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170116/b7e169a6/attachment.html>