]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/pixops/have_mmx.S
eb72678050482111013543b5907ebd60ec9ca212
[~andy/gtk] / gdk-pixbuf / pixops / have_mmx.S
1 /*
2  * Copyright (C) 2000 Red Hat, Inc
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19         .file   "have_mmx.S"
20         .version        "01.01"
21 gcc2_compiled.:
22 .text
23         .align 16
24
25 #if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__INTERIX)
26
27 /* Magic indicating no need for an executable stack */
28 #if !defined __powerpc64__ && !defined __ia64__
29 .section .note.GNU-stack;  .previous
30 #endif
31         
32 .globl _pixops_have_mmx
33         .type    _pixops_have_mmx,@function
34 _pixops_have_mmx:
35
36 #else
37
38 .globl __pixops_have_mmx
39 __pixops_have_mmx:
40
41 #endif
42         
43         push    %ebx
44
45 # Check if bit 21 in flags word is writeable
46
47         pushfl  
48         popl    %eax
49         movl    %eax,%ebx
50         xorl    $0x00200000, %eax
51         pushl   %eax
52         popfl
53         pushfl
54         popl    %eax
55
56         cmpl    %eax, %ebx
57
58         je .notfound
59
60 # OK, we have CPUID
61
62         movl    $1, %eax
63         cpuid
64         
65         test    $0x00800000, %edx
66         jz      .notfound
67
68         movl    $1, %eax
69         jmp     .out
70
71 .notfound:
72         movl    $0, %eax
73 .out:   
74         popl    %ebx
75         ret
76