I want to evaluate an AVX2 program written in c-intrinsics
using gcc 5.4.0
and clang 3.8
for compiling and using perf
, valgrind
and IACA
for evaluating and analysis. I Exactly want the same optimization approach so I read this related question clang optimization and this page for gcc optimization option for gcc but I still doubted .
gcc -O2
and gcc -O3
is my basis and want the same in clang since Clang do auto-vectorization in -O2
and I don't want it when comparing the results with gcc -O2
and want it when -O3
is enabled in gcc
. so the question is what command should I use in clang that is corresponded to these commands in gcc :
First:
compile :
gcc -Wall -O2 -march=native -masm=intel -c -S "%f"
build:
gcc -Wall -O2 -mavx2 -o "%e" "%f"
Second:
compile :
gcc -Wall -O3 -march=native -masm=intel -c -S "%f"
build:
gcc -Wall -O3 -mavx2 -o "%e" "%f"