我正在为 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
更改为例如optimized
、all
等,如所列。
关于c - 为什么 GCC 不显示矢量化信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33758993/