math.floats.env.x86: split off 32 and 64-bit code into sub-vocabularies
parent
611f1572bd
commit
d84f132589
|
@ -0,0 +1,29 @@
|
||||||
|
USING: alien alien.c-types cpu.x86.assembler
|
||||||
|
cpu.x86.assembler.operands math.floats.env.x86 system ;
|
||||||
|
IN: math.floats.env.x86.32
|
||||||
|
|
||||||
|
M: x86.32 get-sse-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
EAX ESP [] MOV
|
||||||
|
EAX [] STMXCSR
|
||||||
|
] alien-assembly ;
|
||||||
|
|
||||||
|
M: x86.32 set-sse-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
EAX ESP [] MOV
|
||||||
|
EAX [] LDMXCSR
|
||||||
|
] alien-assembly ;
|
||||||
|
|
||||||
|
M: x86.32 get-x87-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
EAX ESP [] MOV
|
||||||
|
EAX [] FNSTSW
|
||||||
|
EAX 2 [+] FNSTCW
|
||||||
|
] alien-assembly ;
|
||||||
|
|
||||||
|
M: x86.32 set-x87-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
EAX ESP [] MOV
|
||||||
|
FNCLEX
|
||||||
|
EAX 2 [+] FLDCW
|
||||||
|
] alien-assembly ;
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -0,0 +1,25 @@
|
||||||
|
USING: alien alien.c-types cpu.architecture cpu.x86.assembler
|
||||||
|
cpu.x86.assembler.operands math.floats.env.x86 sequences system ;
|
||||||
|
IN: math.floats.env.x86.64
|
||||||
|
|
||||||
|
M: x86.64 get-sse-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
int-regs param-regs first [] STMXCSR
|
||||||
|
] alien-assembly ;
|
||||||
|
|
||||||
|
M: x86.64 set-sse-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
int-regs param-regs first [] LDMXCSR
|
||||||
|
] alien-assembly ;
|
||||||
|
|
||||||
|
M: x86.64 get-x87-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
int-regs param-regs first [] FNSTSW
|
||||||
|
int-regs param-regs first 2 [+] FNSTCW
|
||||||
|
] alien-assembly ;
|
||||||
|
|
||||||
|
M: x86.64 set-x87-env
|
||||||
|
void { void* } "cdecl" [
|
||||||
|
FNCLEX
|
||||||
|
int-regs param-regs first 2 [+] FLDCW
|
||||||
|
] alien-assembly ;
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -1,8 +1,7 @@
|
||||||
USING: accessors alien alien.c-types alien.syntax arrays assocs
|
USING: accessors alien.c-types arrays assocs biassocs
|
||||||
biassocs classes.struct combinators cpu.architecture
|
classes.struct combinators cpu.x86.features kernel literals
|
||||||
cpu.x86.assembler cpu.x86.assembler.operands cpu.x86.features
|
math math.bitwise math.floats.env math.floats.env.private
|
||||||
kernel literals math math.bitwise math.floats.env
|
system vocabs.loader ;
|
||||||
math.floats.env.private sequences system ;
|
|
||||||
IN: math.floats.env.x86
|
IN: math.floats.env.x86
|
||||||
|
|
||||||
STRUCT: sse-env
|
STRUCT: sse-env
|
||||||
|
@ -18,56 +17,6 @@ HOOK: set-sse-env cpu ( sse-env -- )
|
||||||
HOOK: get-x87-env cpu ( x87-env -- )
|
HOOK: get-x87-env cpu ( x87-env -- )
|
||||||
HOOK: set-x87-env cpu ( x87-env -- )
|
HOOK: set-x87-env cpu ( x87-env -- )
|
||||||
|
|
||||||
! 32-bit
|
|
||||||
M: x86.32 get-sse-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
EAX ESP [] MOV
|
|
||||||
EAX [] STMXCSR
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
M: x86.32 set-sse-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
EAX ESP [] MOV
|
|
||||||
EAX [] LDMXCSR
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
M: x86.32 get-x87-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
EAX ESP [] MOV
|
|
||||||
EAX [] FNSTSW
|
|
||||||
EAX 2 [+] FNSTCW
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
M: x86.32 set-x87-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
EAX ESP [] MOV
|
|
||||||
FNCLEX
|
|
||||||
EAX 2 [+] FLDCW
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
! 64-bit
|
|
||||||
M: x86.64 get-sse-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
int-regs param-regs first [] STMXCSR
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
M: x86.64 set-sse-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
int-regs param-regs first [] LDMXCSR
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
M: x86.64 get-x87-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
int-regs param-regs first [] FNSTSW
|
|
||||||
int-regs param-regs first 2 [+] FNSTCW
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
M: x86.64 set-x87-env
|
|
||||||
void { void* } "cdecl" [
|
|
||||||
FNCLEX
|
|
||||||
int-regs param-regs first 2 [+] FLDCW
|
|
||||||
] alien-assembly ;
|
|
||||||
|
|
||||||
: <sse-env> ( -- sse-env )
|
: <sse-env> ( -- sse-env )
|
||||||
sse-env (struct) [ get-sse-env ] keep ;
|
sse-env (struct) [ get-sse-env ] keep ;
|
||||||
|
|
||||||
|
@ -178,3 +127,7 @@ M: x87-env (get-denormal-mode) ( register -- mode )
|
||||||
M: x87-env (set-denormal-mode) ( register mode -- register' )
|
M: x87-env (set-denormal-mode) ( register mode -- register' )
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
{ x86.32 [ "math.floats.env.x86.32" ] }
|
||||||
|
{ x86.64 [ "math.floats.env.x86.64" ] }
|
||||||
|
} case require
|
||||||
|
|
Loading…
Reference in New Issue