简体   繁体   中英

tree vectorization: gcc optimization flag

I have noticed that the gcc flag -ftree-vectorize is very useful for optimizing code.

I am trying to understand better how it works, but the doc is fairly concise:

Perform vectorization on trees. This flag enables -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly specified.

Does anyone know the inner workings of this flag?

Trees are an internal code representation used by GCC, and tree vectorization happens in this stage. In this representation, it's fairly easy to spot repeated instructions. If the code generator can emit SIMD instructions, it helps to bundle these repeated instructions already in the tree stage.

See tree-vectorizer.c for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM