On 2019-11-14 14:46 +0530, Cameron Fletcher (CF) wrote: > On 14/11/19 1:41 pm, Stefan Ring wrote: > > On Thu, Nov 14, 2019 at 6:31 AM Cameron Fletcher (CF) > > <circumflex@xxxxxxxxxxx> wrote: > > > I am trying to build gcc 8.3 with using --with-fpmath=avx but it > > > only builds gcc with AVX1. > > > > > > Can someone help me on how to build gcc with avx512 support? > > > > Do you mean you want a compiler that understands the avx512 > > instruction set and can generate code for it? > > > Yes. I have a cascade lake xeon on which I am building gcc. You'll need `-march=cascadelake` to tell GCC your CPU is a Cascade Lake, and `-ftree-vectorize` to tell GCC to vectorize some loops into AVX/AVX2/AVX512 instructions. If you want to fully utilize AVX512 `-mprefer-vector-width=512` may be necessary. Without this option GCC will use AVX512 instructions (with `-march=cascadelake`) but only the 256-bit and 128-bit variants. And we shoule notice that using AVX512 may slow down the system (due to downclocking). Daniel Lemire wrote a nice article discussing these issues: https://lemire.me/blog/2018/09/07/avx-512-when-and-how-to-use-these-new-instructions/