Bug 38749 - native and core2 differ on core2 hardware
Summary: native and core2 differ on core2 hardware
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-06 21:42 UTC by Peter
Modified: 2009-08-27 16:02 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter 2009-01-06 21:42:33 UTC
For some reason on core2 Duo hardware there is difference between gcc -march=native and -march=core2. -mcx16 and -msahf do not exist in -march=core2, I've googled but failed to find why. Probably it's good idea to add it?

 # cat /proc/cpuinfo  | egrep '(model name|flags)' | head -n2
model name      : Intel(R) Core(TM)2 Duo CPU     L7500  @ 1.60GHz
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm ida tpr_shadow vnmi flexpriority

 # LC_ALL=C gcc -Q --help=target  -march=native > march-native
 # LC_ALL=C gcc -Q --help=target  -march=core2 > march-core2
 # diff -u march-core2 march-native
--- march-core2 2009-01-07 00:28:58.000000000 +0300
+++ march-native        2009-01-07 00:28:49.000000000 +0300
@@ -18,7 +18,7 @@
   -mbranch-cost=
   -mcld                                [disabled]
   -mcmodel=
-  -mcx16                               [disabled]
+  -mcx16                               [enabled]
   -mfancy-math-387                     [enabled]
   -mfp-ret-in-387                      [enabled]
   -mfpmath=
@@ -46,7 +46,7 @@
   -mred-zone                           [enabled]
   -mregparm=
   -mrtd                                [disabled]
-  -msahf                               [disabled]
+  -msahf                               [enabled]
   -msoft-float                         [disabled]
   -msse                                [disabled]
   -msse2                               [disabled]
@@ -63,7 +63,7 @@
   -mstringop-strategy=
   -mtls-dialect=
   -mtls-direct-seg-refs                [enabled]
-  -mtune=
+  -mtune=                              core2
   -muclibc                             [disabled]
   -mveclibabi=

Thank you for your time.
Comment 1 Andrew Pinski 2009-01-06 21:48:12 UTC
      {"core2", PROCESSOR_CORE2, CPU_CORE2,
        PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
        | PTA_SSSE3 | PTA_CX16},

Comment 2 Peter 2009-01-06 22:34:14 UTC
Andrew, ah, right. But then, why output differs? Gentoo does not modifies this bits...
Comment 3 Uroš Bizjak 2009-01-07 07:21:47 UTC
(In reply to comment #2)
> Andrew, ah, right. But then, why output differs? Gentoo does not modifies this
> bits...

gcc driver has separate checks for CPUID features. So, it first determines CPU model and then adds appropriate flags, derived from CPUID.