]> gitweb.factorcode.org Git - factor.git/blob - basis/cpu/x86/features/features.factor
Merge branch 'master' into global_optimization
[factor.git] / basis / cpu / x86 / features / features.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: system kernel math alien.syntax ;
4 IN: cpu.x86.features
5
6 <PRIVATE
7
8 FUNCTION: bool check_sse2 ( ) ;
9
10 FUNCTION: longlong read_timestamp_counter ( ) ;
11
12 PRIVATE>
13
14 HOOK: sse2? cpu ( -- ? )
15
16 M: x86.32 sse2? check_sse2 ;
17
18 M: x86.64 sse2? t ;
19
20 HOOK: instruction-count cpu ( -- n )
21
22 M: x86 instruction-count read_timestamp_counter ;
23
24 : count-instructions ( quot -- n )
25     instruction-count [ call ] dip instruction-count swap - ; inline