[git] CMU Common Lisp branch master updated. begin-x87-removal-19-g87aed56
Raymond Toy
rtoy at common-lisp.net
Mon Apr 28 01:18:29 UTC 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".
The branch, master has been updated
via 87aed560fb118c488a3ea2824ed3fbddf9930cd2 (commit)
via 28455f5114df02062ea6deddb8fb47a9de8c063f (commit)
from 7fe70d3a8856058f4bb4b10602d7eadf18444791 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 87aed560fb118c488a3ea2824ed3fbddf9930cd2
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Sun Apr 27 18:18:15 2014 -0700
Remove more sse2 stuff.
* Exit if the chip doesn't support sse2.
* Treat any mode setting as being the same as sse2 and return the
sse2 core name.
diff --git a/src/lisp/x86-arch.c b/src/lisp/x86-arch.c
index c694cea..841e2cc 100644
--- a/src/lisp/x86-arch.c
+++ b/src/lisp/x86-arch.c
@@ -108,17 +108,16 @@ arch_init(fpu_mode_t mode)
have_sse2 = arch_support_sse2() && os_support_sse2();
+ if (!have_sse2) {
+ fprintf(stderr, "CMUCL requires a SSE2 support; exiting\n");
+ abort();
+ }
+
switch (mode) {
case AUTO:
- if (have_sse2) {
- return "lisp-sse2.core";
- } else {
- return "lisp-x87.core";
- }
- break;
case X87:
- return "lisp-x87.core";
- break;
+ fprintf(stderr, "fpu mode AUTO or X87 is not longer supported.\n");
+ /* Fall through and return the sse2 core */
case SSE2:
return "lisp-sse2.core";
break;
commit 28455f5114df02062ea6deddb8fb47a9de8c063f
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Sun Apr 27 18:16:45 2014 -0700
Rmove more x87 fpu mode stuff.
* Darwin-os.c:
* Linux-os.c:
* FEATURE_SSE2 is always true so remove the #ifdef's
* Don't merge the x87 fpu mode bits with the sse2 ones; we only
want sse2.
* restore_fpu doesn't need to restore the x87 fpu mode bits.
diff --git a/src/lisp/Darwin-os.c b/src/lisp/Darwin-os.c
index 693cbf6..5e8ddf9 100644
--- a/src/lisp/Darwin-os.c
+++ b/src/lisp/Darwin-os.c
@@ -22,6 +22,8 @@
#include <errno.h>
#include <dlfcn.h>
#include <string.h>
+#include <assert.h>
+
#include "os.h"
#include "arch.h"
#include "globals.h"
@@ -332,7 +334,6 @@ os_sigcontext_fpu_reg(ucontext_t *scp, int index)
return (unsigned char *) &scp->uc_mcontext->__fs.__fpu_stmm6;
case 7:
return (unsigned char *) &scp->uc_mcontext->__fs.__fpu_stmm7;
-#ifdef FEATURE_SSE2
case 8:
return (unsigned char *) &scp->uc_mcontext->__fs.__fpu_xmm0;
case 9:
@@ -348,43 +349,21 @@ os_sigcontext_fpu_reg(ucontext_t *scp, int index)
case 14:
return (unsigned char *) &scp->uc_mcontext->__fs.__fpu_xmm6;
case 15:
- return (unsigned char *) &scp->uc_mcontext->__fs.__fpu_stmm7;
-#endif
+ return (unsigned char *) &scp->uc_mcontext->__fs.__fpu_stmm7;
+ default:
+ return NULL;
}
- return NULL;
}
unsigned int
os_sigcontext_fpu_modes(ucontext_t *scp)
{
unsigned int modes;
- unsigned int mxcsr;
- unsigned short cw, sw;
-
- /*
- * Get the status word and the control word.
- */
- memcpy(&cw, &scp->uc_mcontext->__fs.__fpu_fcw, sizeof(cw));
- memcpy(&sw, &scp->uc_mcontext->__fs.__fpu_fsw, sizeof(sw));
- /*
- * Put the cw in the upper bits and the status word in the lower 6
- * bits, ignoring everything except the exception masks and the
- * exception flags.
- */
- modes = ((cw & 0x3f) << 7) | (sw & 0x3f);
+ assert(fpu_mode == SSE2);
- DPRINTF(0, (stderr, "FPU modes = %08x (sw = %4x, cw = %4x)\n",
- modes, (unsigned int) sw, (unsigned int) cw));
-
- if (fpu_mode == SSE2) {
- mxcsr = scp->uc_mcontext->__fs.__fpu_mxcsr;
- DPRINTF(0, (stderr, "SSE2 modes = %08x\n", mxcsr));
-
- modes |= mxcsr;
- }
-
- DPRINTF(0, (stderr, "modes pre mask = %08x\n", modes));
+ modes = scp->uc_mcontext->__fs.__fpu_mxcsr;
+ DPRINTF(0, (stderr, "SSE2 modes = %08x\n", modes));
/* Convert exception mask to exception enable */
modes ^= (0x3f << 7);
@@ -395,16 +374,11 @@ os_sigcontext_fpu_modes(ucontext_t *scp)
void
restore_fpu(ucontext_t *scp)
{
- unsigned short cw;
unsigned int mxcsr;
- memcpy(&cw, &scp->uc_mcontext->__fs.__fpu_fcw, sizeof(cw));
- DPRINTF(0, (stderr, "restore_fpu: FPU cw = 0x%x\n", cw));
- __asm__ __volatile__ ("fclex");
- __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
-
mxcsr = scp->uc_mcontext->__fs.__fpu_mxcsr;
DPRINTF(0, (stderr, "restore_fpu: mxcsr (raw) = %04x\n", mxcsr));
+
__asm__ __volatile__ ("ldmxcsr %0" :: "m" (*&mxcsr));
}
#endif
diff --git a/src/lisp/Linux-os.c b/src/lisp/Linux-os.c
index 7f7a4d7..2da60fb 100644
--- a/src/lisp/Linux-os.c
+++ b/src/lisp/Linux-os.c
@@ -217,16 +217,13 @@ os_sigcontext_fpu_reg(ucontext_t *scp, int offset)
if (fpregs) {
if (offset < 8) {
reg = (unsigned char *) &fpregs->_st[offset];
- }
-#ifdef FEATURE_SSE2
- else {
+ } else if (offset < 16) {
struct _fpstate *fpstate;
fpstate = (struct _fpstate*) scp->uc_mcontext.fpregs;
if (fpstate->magic != 0xffff) {
reg = (unsigned char *) &fpstate->_xmm[offset - 8];
}
}
-#endif
}
return reg;
}
@@ -234,39 +231,27 @@ os_sigcontext_fpu_reg(ucontext_t *scp, int offset)
unsigned int
os_sigcontext_fpu_modes(ucontext_t *scp)
{
- unsigned int modes;
- unsigned short cw, sw;
-
- if (scp->uc_mcontext.fpregs == NULL) {
- cw = 0;
- sw = 0x3f;
- } else {
- cw = scp->uc_mcontext.fpregs->cw & 0xffff;
- sw = scp->uc_mcontext.fpregs->sw & 0xffff;
- }
+ unsigned int modes = 0;
- modes = ((cw & 0x3f) << 7) | (sw & 0x3f);
-
-#ifdef FEATURE_SSE2
/*
- * Add in the SSE2 part, if we're running the sse2 core.
+ * Get the SSE2 modes. FIXME: What should we do if the magic
+ * value indicates that the mxcsr value is not in the context?
*/
- if (fpu_mode == SSE2) {
- struct _fpstate *fpstate;
- unsigned long mxcsr;
-
- fpstate = (struct _fpstate*) scp->uc_mcontext.fpregs;
- if (fpstate->magic == 0xffff) {
- mxcsr = 0;
- } else {
- mxcsr = fpstate->mxcsr;
- DPRINTF(0, (stderr, "SSE2 modes = %08lx\n", mxcsr));
- }
+ struct _fpstate *fpstate;
+ unsigned long mxcsr;
- modes |= mxcsr;
+ fpstate = (struct _fpstate*) scp->uc_mcontext.fpregs;
+ if (fpstate->magic == 0xffff) {
+ mxcsr = 0;
+ } else {
+ mxcsr = fpstate->mxcsr;
+ DPRINTF(0, (stderr, "SSE2 modes = %08lx\n", mxcsr));
}
-#endif
+ modes |= mxcsr;
+
+
+ /* Convert exception mask to exception enable */
modes ^= (0x3f << 7);
return modes;
}
@@ -543,25 +528,19 @@ void
restore_fpu(ucontext_t *context)
{
if (context->uc_mcontext.fpregs) {
- short cw = context->uc_mcontext.fpregs->cw;
- DPRINTF(0, (stderr, "restore_fpu: cw = %08x\n", cw));
- __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
-#ifdef FEATURE_SSE2
- if (fpu_mode == SSE2) {
- struct _fpstate *fpstate;
- unsigned int mxcsr;
+ struct _fpstate *fpstate;
+ unsigned int mxcsr;
- fpstate = (struct _fpstate*) context->uc_mcontext.fpregs;
- if (fpstate->magic != 0xffff) {
- mxcsr = fpstate->mxcsr;
- DPRINTF(0, (stderr, "restore_fpu: mxcsr (raw) = %04x\n", mxcsr));
- __asm__ __volatile__ ("ldmxcsr %0" :: "m" (*&mxcsr));
- }
+ fpstate = (struct _fpstate*) context->uc_mcontext.fpregs;
+ if (fpstate->magic != 0xffff) {
+ mxcsr = fpstate->mxcsr;
+ DPRINTF(0, (stderr, "restore_fpu: mxcsr (raw) = %04x\n", mxcsr));
+ __asm__ __volatile__ ("ldmxcsr %0" :: "m" (*&mxcsr));
}
-#endif
}
}
+
#ifdef i386
boolean
os_support_sse2()
-----------------------------------------------------------------------
Summary of changes:
src/lisp/Darwin-os.c | 44 +++++++-------------------------
src/lisp/Linux-os.c | 69 ++++++++++++++++++--------------------------------
src/lisp/x86-arch.c | 15 +++++------
3 files changed, 40 insertions(+), 88 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list