On Fri, 15 Nov 2019 at 09:49, Cameron Fletcher (CF) <circumflex@xxxxxxxxxxx> wrote: > > On 14/11/19 9:12 pm, Xi Ruoyao wrote: > > 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. > > I am trying to build GCC to support AVX, > not building the application with AVX which I will be doing later. You shouldn't need to do anything special to get a GCC that can generate AVX instructions, that happens automatically if your assembler supports them. There's probably no benefit to compiling GCC itself with AVX instructions, as it's not likely to benefit from them.