[LLVMdev] Implementing the ARM NEON Intrinsics for PowerPC

Renato Golin renato.golin at linaro.org
Wed Oct 2 05:07:29 PDT 2013


On 2 October 2013 12:34, Stanislav Manilov <stanislav.manilov at gmail.com>wrote:

> Again, the tool you describe is exactly what I ultimately want to create.
> The translation to AltiVec would be a step towards understanding how to
> manipulate the intrinsics, but it is not a goal on its own.
>
> Do you have any ideas where in the whole LLVM structure would it fit
> (should it be implemented as a separate optional pass)?
>

I think there are two separate things:

1. A conversion tool, that will read specific SIMD-1 C files and produce
SIMD-2 C files. This will need the C back-end to be working well, or
implement its own SIMD-specific C backend, which is in itself, quite a big
task. This tool would have to use a function pass that would scan for
SIMD-1 intrinsics, and convert them to SIMD-2 in the IR level, so your tool
would read the SIMD-1 file as if it were targeting arch-2, and the pass
would convert automatically, using the function pass below.

2. A function pass, to do the conversion between SIMD-1 intrinsics to
SIMD-2, based on their original namespace inside LLVM (AVX, NEON, etc) and
the target parameter (for SIMD-2 output). This FP should be off by default,
of course, but could be turned on (say -convert-simd-intrinsics) when
compiling legacy code.

I'd start with just cataloguing all NEON and AltiVec intrinsics, and trying
to map them. You'll probably hit cases where NEON A == AltiVec A + op1 +
op2, so you'll have to take head and tail operations around the intrinsics
as possible part of an interchangeable SIMD operation.

As a first example, you could write a function pass to get only the ones
that map nicely 1-to-1 and see if the concept works, and if people are
happy with your changes. It should be able to read a (very simple) NEON C
file and produce compatible PowerPC AltiVec assembly code. After the
infrastructure is in place, you can continue incrementing it by adding
support for more intrinsics, more SIMD ISAs, and more complex patterns
(involving surrounding instructions, etc). In parallel, you could try to
create the tool that would do the source-to-source transformation, using
the pass that you have written.

Of course, adding tests for all known supported conversions to/from would
be critical to the success of your project.

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131002/354ccad1/attachment.html>


More information about the llvm-dev mailing list