Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] CFLAGS for 2 different cpu's (more generic)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 192
Location: Dresden

PostPosted: Tue Sep 15, 2015 11:16 am    Post subject: [SOLVED] CFLAGS for 2 different cpu's (more generic) Reply with quote

Hi
I want to build my personal rescue stick that needs to run on two (slightly) different CPU's
So using "march=native" would not be appropriate.
1.
Code:
grep -m1 -A3 "vendor_id" /proc/cpuinfo
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz

2.
Code:
 grep -m1 -A3 "vendor_id" /proc/cpuinfo
vendor_id       : GenuineIntel
cpu family      : 6
model           : 69
model name      : Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz


Then I tried to find what gcc would choose in the case of "native":
# gcc -fverbose-asm -march=native native.cc -S && grep march native.s

1.
Code:
# options passed:  -D_GNU_SOURCE native.cc -march=core-avx-i -mcx16 -msahf

2.
Code:
# options passed:  -D_GNU_SOURCE native.cc -march=core-avx2 -mcx16 -msahf


But how can I find out the most "upper/parent" generic march variable of core-avx-i and core-avx2 that I can use to build gentoo for the two processors?
Can I use march=core2 to support almost every "Intel(R) Core(TM) iX" processor? Would that have an deep impact on speed?


Last edited by dasPaul on Thu Sep 17, 2015 4:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
alinefr
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jul 2009
Posts: 112
Location: São Paulo, Brasil

PostPosted: Tue Sep 15, 2015 11:54 am    Post subject: Reply with quote

From the gcc manpage:

Code:

core-avx-i
               Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction set support.

core-avx2
               Intel Core CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction set support.


So every instruction from 'core-avx-i' is also present in 'core-avx2'. Then '-march=core-avx-i' seems to be the closest choice for both processors.


Last edited by alinefr on Tue Sep 15, 2015 12:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
massimo
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1226

PostPosted: Tue Sep 15, 2015 12:01 pm    Post subject: Reply with quote

I expect -march=core-avx-i to be working on both systems.
_________________
Hello 911? How are you?
Back to top
View user's profile Send private message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 192
Location: Dresden

PostPosted: Tue Sep 15, 2015 12:39 pm    Post subject: Reply with quote

I will use "-march=core-avx-i". Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum