简体   繁体   English

树向量化:gcc优化标志

[英]tree vectorization: gcc optimization flag

I have noticed that the gcc flag -ftree-vectorize is very useful for optimizing code. 我注意到gcc标志-ftree-vectorize对于优化代码非常有用。

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. 如果未明确指定,则此标志启用-ftree-loop-vectorize和-ftree-slp-vectorize。

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. 是GCC使用的内部代码表示形式,并且树矢量化在此阶段进行。 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. 如果代码生成器可以发出SIMD指令,则有助于在树级中捆绑这些重复的指令。

See tree-vectorizer.c for details. 有关详细信息,请参见tree-vectorizer.c。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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