File: sse_test.c

package info (click to toggle)
darktable 2.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,236 kB
  • sloc: ansic: 200,593; cpp: 23,773; xml: 10,142; lisp: 7,084; sh: 2,489; perl: 1,701; ruby: 1,155; python: 426; makefile: 289; awk: 110; asm: 46
file content (31 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
    This file is part of darktable,
    copyright (c) 2009--2010 henrik andersson.

    darktable is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    darktable is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with darktable.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#define cpuid(func,ax,bx,cx,dx) __asm__ __volatile__ ("cpuid":"=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (func));
int main (int argc, char **argv)
{
	int eax,ebx,ecx,edx;
	cpuid(0x1,eax,ebx,ecx,edx);
	fprintf(stdout,"%s", (edx>>25)&1?"SSE ":"");
	fprintf(stdout,"%s", (edx>>26)&1?"SSE2 ":"");
	fprintf(stdout,"%s", (ecx)&1?"SSE3 ":"");
	fprintf(stdout,"%s", (ecx>>19)&1?"SSE4.1 ":"");
	fprintf(stdout,"%s", (ecx>>20)&1?"SSE4.2 ":"");
	fprintf(stdout,"\n");
}