https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100758

            Bug ID: 100758
           Summary: __builtin_cpu_supports does not (always) detect "sse2"
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at eckner dot net
  Target Milestone: ---
              Host: i686
            Target: i686

Created attachment 50868
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50868&action=edit
test.c: probe for sse2

I use the attached snippet to detect, whether the cpu supports sse2. This works
most of the time, but fails to detect sse2 on two machines, which actually
support sse2 (according to /proc/cpuinfo).

The affected machines run archlinux32. /proc/cpuinfo shows:

processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 15
model name      : VIA Nano U3400@800MHz
stepping        : 10
cpu MHz         : 798.016
cache size      : 2048 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat clflush acpi mmx fxsr sse sse2 ss tm syscall nx lm constant_tsc
arch_perfmon rep_good cpuid pni monitor vmx est tm2 ssse3 cx16 xtpr sse4_1
popcnt rng rng_en ace ace_en ace2 phe phe_en pmm pmm_en lahf_lm tpr_shadow vnmi
vpid ida
vmx flags       : vnmi tsc_offset vtpr
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds
swapgs itlb_multihit
bogomips        : 1596.53
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 48 bits virtual
power management:

and
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 13
model name      : VIA C7-D Processor 1800MHz
stepping        : 0
cpu MHz         : 1596.326
cache size      : 128 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge cmov pat
clflush acpi mmx fxsr sse sse2 tm nx cpuid pni est tm2 xtpr rng rng_en ace
ace_en ace2 ace2_en phe phe_en pmm pmm_en
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds
swapgs itlb_multihit
bogomips        : 3193.67
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 32 bits virtual
power management:

respectively. On these machines, the output is "sse2: 0" instead of some value
unequal 0.

Regards,
Erich

P.S.: I hope, I reported this in the correct category. Please let me know, if I
did not.

Reply via email to