Vectorization and ARM

Dear list,

I have several questions about the Vectorization of LLVM:

  1. As I found, -O3 have already included loop vectorization and slp vectorization (llvm3.3 and later version). So that means when I only use -O3, are both vectorizations applied?
    And when I use -O3 -fno-vectorize, means that all the optimizations are applied except loop vectorization?

  2. As in the report: http://llvm.org/devmtg/2012-04-12/Slides/Hal_Finkel.pdf
    Why did he add “-mllvm -unroll-allow-partial -mllvm -unroll-runtime -funsafe-math-optimizations -ffast-math” beyond -O3? I think this report was talking about llvm3.2, while in llvm3.3 or later version, do these options have important significance?
    Another thing is the autovectorization mentioned in this report, what’s the different between the normal vectorization and autovectorization?
    If autovectorization is important, how to use it? (Because "-mllvm -vectorize (not worked) -mllvm -bb-vectorize-aligned-only ")

  3. When I want to use vectorization on ARM (especially for neon), which option do I need to add? Just -mfpu=neon? Is some information like “-target armv7l -mfloat-abi=hard” needed?

Thanks for your attention.

Sincerely,

Hanbing

1. As I found, -O3 have already included loop vectorization and slp
vectorization (llvm3.3 and later version). So that means when I only use
-O3, are both vectorizations applied?

Yes.

And when I use -O3 -fno-vectorize, means that all the optimizations are
applied except loop vectorization?

That's possible.

2. As in the report: http://llvm.org/devmtg/2012-04-12/Slides/Hal_Finkel.pdf
Why did he add "-mllvm -unroll-allow-partial -mllvm -unroll-runtime
-funsafe-math-optimizations -ffast-math" beyond -O3? I think this report was
talking about llvm3.2, while in llvm3.3 or later version, do these options
have important significance?

The unsafe math still needs to be set if you want more aggressive NEON
vectorization, and the others you should play around to make sure they
apply to your cases. These options can change from version to version
and you should always check.

Another thing is the autovectorization mentioned in this report, what's the
different between the normal vectorization and autovectorization?
If autovectorization is important, how to use it? (Because "-mllvm
-vectorize (not worked) -mllvm -bb-vectorize-aligned-only ")

-O3 auto-vectorizes almost everything it can. I think you're reading
that wrong, I'm not sure what you mean "normal vectorization".

3. When I want to use vectorization on ARM (especially for neon), which
option do I need to add? Just -mfpu=neon? Is some information like "-target
armv7l -mfloat-abi=hard" needed?

Any core that has NEON will enable it automatically via -O3. You'll
have to use "-target armv7" or -mcpu=cortex-a... or -mpfu=neon or
something like that.

cheers,
--renato

PS: There are newer reports on the state of auto-vectorization in LLVM
from this year, do you need help getting them?