path64/compiler — Issue #135: -march=auto / -march=nehalem issues
Author: BinaryKhaos
Created: 2012-02-25 14:52:08+00:00
State: open

[The following was tested with a less than a week old path64 compile on a x86_64 Gentoo system]

Currently it is rather difficult to figure out what to pass to -march and what it autodetects with auto. So I did some testing and digging:

1.
compiler/src/driver/opt_actions.c defines Nehalem to target Wolfdale and sets sse4_2 to false. Clearly, Nehalem supports sse4_2 and is a new microarchitecture compared to Wolfdale. And it was the first to introduce sse 4.2.

2.
> $ pathCC -show-defaults
> Optimization level and compilation target:
> -O2 -mcpu=sandy -m64 -msse -msse2 -msse3 -mno-3dnow -mno-sse4a
> Options from compiler.defaults file:

sandy should enable avx which my processor does not support. Adding -march=auto (if this is not already the default), changes nothing. Setting -march=nehalem, outputs basically the same but replaces nehalem with wolfdale. (see above)

3.
In some cases, pathCC correctly shows an error when one specifies features that the processor does not have. But as it seems, you can always set -mavx and there is no error message at all.

4.
I haven't found a single way to figure out what path64 autodetects and which features it sets. Digging through the source code gives me the impression, that I should set -march=nehalem -msse4_2 and that should be it. A normal user should not have to worry about that.

5.
Support for -march=native would be nice to have better compatibility with gcc.

By the way, here my cpuinfo:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 0
cpu cores	: 4
apicid	: 0
initial apicid	: 0
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.24
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 1
cpu cores	: 4
apicid	: 2
initial apicid	: 2
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.10
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 2
cpu cores	: 4
apicid	: 4
initial apicid	: 4
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.11
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 3
cpu cores	: 4
apicid	: 6
initial apicid	: 6
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.11
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 4
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 0
cpu cores	: 4
apicid	: 1
initial apicid	: 1
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.10
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 5
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 1
cpu cores	: 4
apicid	: 3
initial apicid	: 3
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.10
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 6
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 2
cpu cores	: 4
apicid	: 5
initial apicid	: 5
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.10
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model	: 30
model name	: Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz
stepping	: 5
microcode	: 0x4
cpu MHz	: 1197.000
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id	: 3
cpu cores	: 4
apicid	: 7
initial apicid	: 7
fpu	: yes
fpu_exception	: yes
cpuid level	: 11
wp	: yes
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5595.11
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management: