[llvm-dev] specify dag pattern for an instructions

Rail Shafigulin via llvm-dev llvm-dev at lists.llvm.org
Thu May 12 16:05:30 PDT 2016

I'd like to apologize in advance if the question seems dumb, but I've never
specified a DAG pattern for an instruction a don't know how it looks in

My target has an instruction which is similar to X86 horizontal add. The
instruction, let's call is sumreduce, sums up all the elements in a vector
and stores a result in GPR. What I'm trying to do is to replace a specific
DAG pattern (it is given below) with this instruction (DAG node).

Here is the pattern I need to replace:

           r0 r1
             \ /
            add  r2
               \    /
               add  r3
                  \    /

            r4 = sumreduce r0 r1 r2 r3

For now assume that the vector has 4 elements in it and all of them are i32.

I would appreciate any pointers on how to do it. If someone could point me
to an example code that converts a DAG pattern to a DAG node I would
greatly appreciate it.

Rail Shafigulin
Software Engineer
Esencia Technologies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160512/affdc137/attachment-0001.html>

More information about the llvm-dev mailing list