cpu.x86: Fix the popcnt? word alien-assembly. XOR the return-reg RAX before calling BT/BSET because XOR clears the CF and the whole thing becomes a no-op. Change popcnt instruction to opt-out rather than opt-in. Fixes #663.
parent
cfa87365e3
commit
9ebd6c11ad
|
@ -88,13 +88,13 @@ MEMO: sse-version ( -- n )
|
|||
bool { } cdecl [
|
||||
return-reg 1 MOV
|
||||
CPUID
|
||||
ECX 23 BT
|
||||
return-reg dup XOR
|
||||
ECX 23 BT
|
||||
return-reg SETB
|
||||
] alien-assembly ;
|
||||
|
||||
MEMO: enable-popcnt? ( -- ? )
|
||||
popcnt? "enable-popcnt" get and ;
|
||||
popcnt? "disable-popcnt" get not and ;
|
||||
|
||||
[ { sse-version enable-popcnt? } [ reset-memoized ] each ]
|
||||
"cpu.x86.features" add-startup-hook
|
||||
|
|
Loading…
Reference in New Issue