/[svn]/linuxsampler/trunk/src/common/Features.cpp
ViewVC logotype

Annotation of /linuxsampler/trunk/src/common/Features.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 425 - (hide annotations) (download)
Sat Mar 5 07:27:48 2005 UTC (19 years, 1 month ago) by persson
File size: 2685 byte(s)
* fixed a bug that sometimes caused clicks at the beginning of samples
* added denormal number elimination for CPUs with SSE2 support

1 schoenebeck 320 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * *
7     * This program is free software; you can redistribute it and/or modify *
8     * it under the terms of the GNU General Public License as published by *
9     * the Free Software Foundation; either version 2 of the License, or *
10     * (at your option) any later version. *
11     * *
12     * This program is distributed in the hope that it will be useful, *
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15     * GNU General Public License for more details. *
16     * *
17     * You should have received a copy of the GNU General Public License *
18     * along with this program; if not, write to the Free Software *
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20     * MA 02111-1307 USA *
21     ***************************************************************************/
22    
23     #include "Features.h"
24    
25     #if ARCH_X86
26     bool Features::bMMX(false);
27     bool Features::bSSE(false);
28 persson 425 bool Features::bSSE2(false);
29 schoenebeck 320
30     unsigned int edx = 0;
31     unsigned int eax_temp = 0;
32     unsigned int ebx_temp = 0;
33     unsigned int ecx_temp = 0;
34     unsigned int edx_temp = 0;
35    
36     void Features::detect() {
37     // we store and restore all registers modified by 'cpuid' the old fashioned way
38     __asm__ __volatile__ ("mov %eax,eax_temp\n\t"
39     "mov %ebx,ebx_temp\n\t"
40     "mov %ecx,ecx_temp\n\t"
41     "mov %edx,edx_temp\n\t"
42     "mov $1,%eax\n\t"
43     "cpuid\n\t"
44     "mov %edx,edx\n\t"
45     "mov eax_temp,%eax\n\t"
46     "mov ebx_temp,%ebx\n\t"
47     "mov ecx_temp,%ecx\n\t"
48     "mov edx_temp,%edx\n\t"
49     );
50     bMMX = (edx & 0x00800000);
51     bSSE = (edx & 0x02000000);
52 persson 425 bSSE2 = (edx & 0x04000000);
53 schoenebeck 320 }
54 schoenebeck 361 #else
55     void Features::detect() {}
56 schoenebeck 320 #endif // ARCH_X86

  ViewVC Help
Powered by ViewVC