Skip to content

SSSE3, SSE4.1, SSE4.2 not detected on non-AVX CPUs #4

Closed
@Myriachan

Description

@Myriachan

ParseCpuId is coded to require the XMM XCR0 bit in order to recognize SSSE3, SSE4.1, and SSE4.2, but this is not the right way to detect it. Machines without AVX will not have XCR0 at all, and will fail this check.

In the absence of XCR0, on x86-32, the proper way to detect SSE is to ask the operating system. (On x86-64, just assume yes.) In Windows, that's IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE). In Linux, unfortunately, it's parsing /proc/cpuinfo. In macOS and iOS (simulator), it's sysctlbyname on hw.optional.sse, though you could also just assume yes.

Something could be said that the number of x86 machines without SSE in the CPU and OS is about zero now--it depends on how far back you want your library to support.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions