This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to define multiple processor families?


On 2018-05-07 18:30 +0800, Feng Longda wrote:
> If we set -march/tune to define processor, we can obtain some extra
> performance improvement.
> 
> I want to run my application on different intel processor family, for
> example: broadwell, skylake, haswell, skylake-avx512.
> 
> What should I set? Does It like the following ?
> 
> -march=broadwell   -mtune=intel -mmmx -msse -msse -msse2 -msse3 -mavx
> -mavx2 -mavx=512f -mavx512pf ...

No.  Then GCC would use AVX-512, and the program can't run on processors
without AVX-512.  (You'll see "Illegal Instruction - Core Dumped").

You should use target_clone attribute.
c.f. https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Common-Function-Attributes.html
-- 
Xi Ruoyao <ryxi@stu.xidian.edu.cn>
School of Aerospace Science and Technology, Xidian University


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]