This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
enable auto-vectorization
- From: chansarav <chansarav at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 22 Oct 2009 17:18:16 +0530
- Subject: enable auto-vectorization
Hi,
I am studying on enabling auto-vectorization for a port.
Auto-vectorization is done for the command line option "-O2" for flag
"-ftree-vectorize". For command line option "-O3" auto-vectorization
is enabled by default.
There is a gimple pass "pass_vectorize" that would do the job of
auto-vectorization at gimple IR level. So it is enough to define the
machine descriptions (for vectorization) to generate the rtls for
vector instructions during the rtl generation phase.
On net, I found the following references for the machine descriptions,
macros to be defined for enabling the auto-vectorization.
1. "Extending GCC with new operations: RTL, SIMD and treecodes" by
Zbigniew Chamski
Adding SIMD vectorisation support
- distinction between scalar and vector ops: operand modes
- availability of vector ops: deducted from MD file
- specify supported vector length: <target>.h
#define UNITS_PER_SIMD_WORD max_SIMD_bytes
- specify supported vector modes: <target>-modes.def
/* Vector modes. */
VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
VECTOR_MODES (INT, 16); /* V16QI V8HI V4SI V2DI */
VECTOR_MODE (INT, DI, 1);
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */
- build the compiler and invoke it with -O2 -ftree-vectorize
2. "GCC Tutorial – The compilation flow of the auto-vectorizer" by Dorit Nuzman.
Enabling vectorization for a new port
Basic features:
<target.md>
- distinction between scalar and vector ops: operand modes
- availability of vector ops: deduced from MD file
<target>.h
- specify supported vector length in bytes:
#define UNITS_PER_SIMD_WORD 16
<target>-modes.def
- specify supported vector modes:
/* Vector modes. */
VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
VECTOR_MODES (INT, 16); /* V16QI V8HI V4SI V2DI */
VECTOR_MODE (INT, DI, 1);
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */
I experimented as said above for a port. But auto-vectorization is not enabled.
Is my current understanding correct?
Is there some other references I should refer that would help to
identify the required macros, machine descriptions to enable
vectorization?
Also I searched the "gcc-help mailing list archives" regarding this. I
didn't find any references there.
Thank you.