-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/8c: use of prefetchnta requires SSE #4798
Labels
Milestone
Comments
Comment 1 by huseby@lindenlab.com: I just confirmed that the problem is a prefetchnta instruction in go_bootstrap: (gdb) run Starting program: /home/mannie/Projects/go/pkg/tool/openbsd_386/go_bootstrap clean -i std Program received signal SIGILL, Illegal instruction. 0x0808fc1b in ?? () (gdb) x/i $pc 0x808fc1b: prefetchnta (%eax) Not sure why/where/how this is getting generated when compiling go_bootstrap. |
@huseby, the error is happening running go_bootstrap, not compiling it. The build process builds the compilers, then the a small version of the go tool, go_bootstrap is built by hand, which is then used to produce the full go tool. To date, we don't have an openbsd/386 builder, so I'm not surprised that it ran into problems. When goarch says 386, it means 'not amd64' not 80386, the minimum requirements for 32bit intel architecture is a Pentium with MMX. +cc jsing Labels changed: added os-openbsd. Status changed to Accepted. |
Comment 4 by huseby@lindenlab.com: Yes, the error is in running go_bootstrap. It is trying to execute PREFETCHNTA which is an SSE instruction that the Geode processor doesn't support. I was able to fix this with an ugly hack. I just commented out the body of the gprefetch function in 8c/txt.c to prevent 8c from generating that instruction. Since the prefetch instruction is just there to speed things up and shouldn't change the correctness of the executable, this should work and it does. |
what does the following command say? sysctl machdep.cpufeature does it have 0x00000100 bit (CMPXCHG8B) and 0x00800000 bit (MMX) set? the definition for bits is in: http://www.openbsd.org/cgi-bin/cvsweb/src/sys/arch/i386/include/specialreg.h?rev=1.44;content-type=text%2Fplain @dave cheney, because of usage of prefetchnta, we have to raise the requirement of 386 from pentium mmx to sse. the change is introduced in rev 455b7576cd25 (not included in release yet). do we want to keep support for pentium mmx class machine and drop PREFETCH support 386 or make its use depend on GO386 setting or just document 386 port requires SSE now? FYI, pentium 3 introduced SSE while pentium 4 introduced SSE2. Labels changed: added priority-later, removed priority-triage, os-openbsd. Status changed to Thinking. |
because we've already introduced GO386, we can introduce one more possible value for it: sse. switch GO386 { case "387": //use x87 FPU and only assume pentium MMX case "sse": //use x87 FPU and enable PREFETCH support case "sse2": fallthrough default: // use SSE2 for FPU and enable PREFETCH support } what do you think? IMHO, the point of supporting 386 port is just to make Go usable on (17-year) old machines. |
Comment 7 by huseby@lindenlab.com: On my machine, I'm getting the value 0x00808131 from the machdep.cpufeature. So yes, both CMPXCHG8B and MMX are set. I like the idea of being able to set GO386=387 and have it assume pentium MMX. There are lots of embedded x86 machines that happily run *BSD/Linux but won't run go without that change. |
Comment 9 by huseby@lindenlab.com: Doesn't the GO386 environment variable already exist? It just defaults to 387/sse which ATM includes the prefetch support. Why couldn't those be separated? |
Comment 10 by huseby@lindenlab.com: It worked for the GOARM setting. If you changed the default of GO386 to be "sse" then nothing would change for default invocations. For those of us with older machines we'd have to set GO386=387 like setting GOARM=5 to get go to compile on a Raspberry Pi. Thanks for taking a look at this though. |
This issue was closed by revision 594360c. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by huseby@lindenlab.com:
Attachments:
The text was updated successfully, but these errors were encountered: