c - 为什么 GCC 不显示矢量化信息?

标签 c gcc

我正在为 Windows 7 上的 C 程序使用代码块。该程序正在使用 OMP 库。 GCC 版本为 4.9.2。 Mingw x86_64-w64-mingw32-gcc-4.9.2.exe.

使用的标志是:-fopenmp -O3 -mfpmath=sse -funroll-loops -ftree-loop-distribution -ftree-vectorize -ftree-vectorizer-verbose=2

程序运行正常,但问题是它没有显示有关哪些循环已矢量化或未矢量化的信息。我该如何解决?

构建日志信息:

-------------- Build: Release in **** (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-gcc-4.9.2.exe -Wall -O2 -march=corei7 -fexpensive-optimizations -O3 -fopenmp -mfpmath=sse -funroll-loops -ftree-loop-distribution -ftree-vectorize -ftree-vectorizer-verbose=2 -c C:\Users...\f.c -o obj\Release\f.o x86_64-w64-mingw32-g++.exe -o bin\Release\d.exe obj\Release\f.o obj\Release\main.o -s "C:\Program Files...\libgomp-1.dll" Output file is bin\Release\d.exe with size 21.00 KB Process terminated with status 0 (0 minute(s), 0 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

最佳答案

CodeBlocks 是一个 IDE。它不编译任何东西。海湾合作委员会确实如此。 -ftree-vectorizer-verbose 用于在以前的版本中工作。现在有 -fopt-info,它允许检索有关优化的信息(还有矢量化);你可以找到相关文档here .

它甚至展示了如何实际检索 vector 器输出到 stderr: 还有这个:

gcc -O2 -ftree-vectorize -fopt-info-vec-missed 

prints information about missed optimization opportunities from vectorization passes on stderr. Note that -fopt-info-vec-missed is equivalent to -fopt-info-missed-vec.

您可以将 missed 更改为例如optimizedall 等,如所列。

关于c - 为什么 GCC 不显示矢量化信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33758993/

相关文章:

c - 使用动态库(dlopen)时更改库文件是否可能导致段错误?

c - at&t asm 内联 C++ 问题

c++ - C/C++ 动态链接如何在不同平台上工作?

无法跳出 do while 循环

c - 从自定义系统调用生成段错误

c++ - Linux - 运行 valgrind 时不显示源文件/行

c++ - 如何强制编译器显示隐式构造函数

c - 堆栈溢出 C 变量位置

c - 如何在成对结构中可移植地保存两个内存字?

gcc - 由于不受支持的 gcc 编译器版本,Caffe 编译失败