[PATCH] cpu detection for core2
The configure code to detect core2 in 64bit mode was different from 32bit mode, and didn't work on my core2. This changes it to be the same as 32-bit mode, which works. Also, -march=k8 is faster than -march=nocona when run on a core2. Or should it be -mtune=k8 with no -march, to avoid amd-specific instructions? -march=k8 works for me, but that doesn't mean it's theoretically correct. (Of course -march=core2 is the most appropriate, but that's only in gcc
=4.2)
--Loren Merritt
Hi, 2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
The configure code to detect core2 in 64bit mode was different from 32bit mode, and didn't work on my core2. This changes it to be the same as 32-bit mode, which works.
A simpler way to fix core2 detection is: @@ -1845,7 +1845,7 @@ AuthenticAMD) proc=k8;; GenuineIntel) - case "$pmodel" in + case "$pfamily" in 6) proc=core2;; *) # 64-bit prescotts exist, but as far as GCC is concerned they
Also, -march=k8 is faster than -march=nocona when run on a core2. Or should it be -mtune=k8 with no -march, to avoid amd-specific instructions? -march=k8 works for me, but that doesn't mean it's theoretically correct. (Of course -march=core2 is the most appropriate, but that's only in gcc
=4.2)
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
On Sun, 3 Jun 2007, Zuxy Meng wrote:
2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
The configure code to detect core2 in 64bit mode was different from 32bit mode, and didn't work on my core2. This changes it to be the same as 32-bit mode, which works.
A simpler way to fix core2 detection is: @@ -1845,7 +1845,7 @@ AuthenticAMD) proc=k8;; GenuineIntel) - case "$pmodel" in + case "$pfamily" in 6) proc=core2;; *) # 64-bit prescotts exist, but as far as GCC is concerned they
ok
Also, -march=k8 is faster than -march=nocona when run on a core2. Or should it be -mtune=k8 with no -march, to avoid amd-specific instructions? -march=k8 works for me, but that doesn't mean it's theoretically correct. (Of course -march=core2 is the most appropriate, but that's only in gcc
=4.2)
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster?
pentium-m isn't x86_64, so it would be meaningless to tune x86_64 code for it, so gcc refuses to compile with -mtune=pentium-m. --Loren Merritt
Hi, 2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
On Sun, 3 Jun 2007, Zuxy Meng wrote:
2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
The configure code to detect core2 in 64bit mode was different from 32bit mode, and didn't work on my core2. This changes it to be the same as 32-bit mode, which works.
A simpler way to fix core2 detection is: @@ -1845,7 +1845,7 @@ AuthenticAMD) proc=k8;; GenuineIntel) - case "$pmodel" in + case "$pfamily" in 6) proc=core2;; *) # 64-bit prescotts exist, but as far as GCC is concerned they
ok
Also, -march=k8 is faster than -march=nocona when run on a core2. Or should it be -mtune=k8 with no -march, to avoid amd-specific instructions? -march=k8 works for me, but that doesn't mean it's theoretically correct. (Of course -march=core2 is the most appropriate, but that's only in gcc
=4.2)
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster?
pentium-m isn't x86_64, so it would be meaningless to tune x86_64 code for it, so gcc refuses to compile with -mtune=pentium-m.
Then we're left with no choice but k8... -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi Zuxy Meng! On 2007.06.03 at 15:39:31 +0800, Zuxy Meng wrote next:
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster?
pentium-m isn't x86_64, so it would be meaningless to tune x86_64 code for it, so gcc refuses to compile with -mtune=pentium-m.
Then we're left with no choice but k8...
actually simplest -march=x86-64 works good ;) haven't compared with k8 though. -- Vladimir
Hi, 2007/6/4, Vladimir Mosgalin <mosgalin@vm10124.spb.edu>:
Hi Zuxy Meng!
On 2007.06.03 at 15:39:31 +0800, Zuxy Meng wrote next:
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster?
pentium-m isn't x86_64, so it would be meaningless to tune x86_64 code for it, so gcc refuses to compile with -mtune=pentium-m.
Then we're left with no choice but k8...
actually simplest -march=x86-64 works good ;) haven't compared with k8 though.
They should yield identical code. Actually for march, x86-64 = k8 - 3dnow!, and for mtune, x86-64 == k8. (gcc manual didn't even mention x86-64 but it's in the source.) Fore Core 2, maybe -march=nocona -mtune=x86-64 is the best but for simplicity setting both to x86-64 is just fine. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
On Sun, 3 Jun 2007, Zuxy Meng wrote:
2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
The configure code to detect core2 in 64bit mode was different from 32bit mode, and didn't work on my core2. This changes it to be the same as 32-bit mode, which works.
A simpler way to fix core2 detection is: @@ -1845,7 +1845,7 @@ AuthenticAMD) proc=k8;; GenuineIntel) - case "$pmodel" in + case "$pfamily" in 6) proc=core2;; *) # 64-bit prescotts exist, but as far as GCC is concerned they
ok
Also, -march=k8 is faster than -march=nocona when run on a core2. Or should it be -mtune=k8 with no -march, to avoid amd-specific instructions? -march=k8 works for me, but that doesn't mean it's theoretically correct. (Of course -march=core2 is the most appropriate, but that's only in gcc
=4.2)
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster?
pentium-m isn't x86_64, so it would be meaningless to tune x86_64 code for it, so gcc refuses to compile with -mtune=pentium-m.
How about this patch? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
On Sun, 3 Jun 2007, Zuxy Meng wrote:
2007/6/3, Loren Merritt <lorenm@u.washington.edu>:
The configure code to detect core2 in 64bit mode was different from 32bit mode, and didn't work on my core2. This changes it to be the same as 32-bit mode, which works.
A simpler way to fix core2 detection is: @@ -1845,7 +1845,7 @@ AuthenticAMD) proc=k8;; GenuineIntel) - case "$pmodel" in + case "$pfamily" in 6) proc=core2;; *) # 64-bit prescotts exist, but as far as GCC is concerned they
ok
I applied this part since there's no doubt about it.
Also, -march=k8 is faster than -march=nocona when run on a core2. Or should it be -mtune=k8 with no -march, to avoid amd-specific instructions? -march=k8 works for me, but that doesn't mean it's theoretically correct. (Of course -march=core2 is the most appropriate, but that's only in gcc
=4.2)
-march=k8 should work because without -fprefetch-loop-arrays, gcc isn't able to generate any AMD specific instructions. But I can't guarantee this :-) But as for Core2, isn't '-march=nocona -mtune=pentium-m' faster?
pentium-m isn't x86_64, so it would be meaningless to tune x86_64 code for it, so gcc refuses to compile with -mtune=pentium-m.
I'm still unsure which is the best march for core2 for gcc <= 4.2. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
participants (3)
-
Loren Merritt -
Vladimir Mosgalin -
Zuxy Meng