Debian Codegraph @

src/cpu_has_sse2.S

raw
1 # Ikarus Scheme -- A compiler for R6RS Scheme.
2 # Copyright (C) 2006,2007,2008 Abdulaziz Ghuloum
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16
17 .text
18 .globl cpu_has_sse2
19 .globl _cpu_has_sse2
20
21 .align 8
22
23 cpu_has_sse2:
24 _cpu_has_sse2:
25 # callee-save registers are $ebx, %esi, %edi, %esp, $ebp
26 # cpuid modifies %eax, %ebx, %ecx, %edx
27 # only %ebx needs to be saved/restored
28 #if __x86_64__
29 push %rbx
30 #else
31 push %ebx
32 #endif
33 movl $1, %eax
34 cpuid
35 movl %edx, %eax
36 sarl $26, %eax
37 andl $1, %eax
38 #if __x86_64__
39 pop %rbx
40 #else
41 pop %ebx
42 #endif
43 ret