[pypy-issue] [issue1068] PyPy crashes without SSE2, an error message would be better.

Daid tracker at bugs.pypy.org
Wed Feb 22 11:56:03 CET 2012


New submission from Daid <daid303 at gmail.com>:

Currently, PyPy crashes without a proper error if you try to use it on an older
machine without SSE2 instructions. You can translate PyPy without SSE2, but I'm
providing a pre-packaged PyPy package which crashed for one of my users.

A simple check for SSE2 at startup would have saved a lot of headache on both
our sides.

For GCC you can detect SSE2 support with the following code:

#if defined(__GNUC__) and defined(__i486__)
	//Read the CPU features.
	asm("mov $1, %%eax\n"
		"cpuid\n"
		"mov %%edx, %0"
		: "=r"(features) : : "%eax", "%ebx", "%edx", "%ecx");
	
	//Check bit 26, this indicates SSE2 support
	if ((features & (1 << 26) == 0)
	{
		fprintf(strerr, "No SSE2 support, cannot continue\n");
		exit(1)
	}
#endif

For MSVC it should be similar, but I'm not familiar with MSVC inline ASM.

----------
messages: 3996
nosy: Daid, pypy-issue
priority: wish
status: unread
title: PyPy crashes without SSE2, an error message would be better.

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1068>
________________________________________


More information about the pypy-issue mailing list