Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
806505a4
Commit
806505a4
authored
Aug 25, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_CPU_init: factorize altivec check by using asm input
also simplify arm neon preprocessor checks
parent
e155b93a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
38 deletions
+25
-38
src/misc/cpu.c
src/misc/cpu.c
+25
-38
No files found.
src/misc/cpu.c
View file @
806505a4
...
...
@@ -73,13 +73,13 @@ static bool check_OS_capability( const char *psz_capability, pid_t pid )
return
false
;
}
# define check_capability(name, flag, code
)
\
# define check_capability(name, flag, code
, input)
\
do { \
pid_t pid = fork(); \
if( pid == 0 ) \
{ \
signal(SIGILL, SIG_DFL); \
__asm__ __volatile__ ( code : :
);
\
__asm__ __volatile__ ( code : :
input );
\
_exit(0); \
} \
if( check_OS_capability((name), pid )) \
...
...
@@ -87,7 +87,7 @@ static bool check_OS_capability( const char *psz_capability, pid_t pid )
} while(0)
# else
/* WIN32 */
# define check_capability(name, flag, code) \
# define check_capability(name, flag, code
, input
) \
i_capabilities |= (flag);
# endif
#endif
...
...
@@ -184,7 +184,7 @@ void vlc_CPU_init (void)
# ifdef CAN_COMPILE_SSE
check_capability
(
"SSE"
,
CPU_CAPABILITY_SSE
,
"xorps %%xmm0,%%xmm0
\n
"
);
"xorps %%xmm0,%%xmm0
\n
"
,
);
# endif
}
# endif
...
...
@@ -194,7 +194,7 @@ void vlc_CPU_init (void)
# elif defined (CAN_COMPILE_SSE2)
if
(
i_edx
&
0x04000000
)
check_capability
(
"SSE2"
,
CPU_CAPABILITY_SSE2
,
"movupd %%xmm0, %%xmm0
\n
"
);
"movupd %%xmm0, %%xmm0
\n
"
,
);
# endif
# if defined (__SSE3__)
...
...
@@ -202,7 +202,7 @@ void vlc_CPU_init (void)
# elif defined (CAN_COMPILE_SSE3)
if
(
i_ecx
&
0x00000001
)
check_capability
(
"SSE3"
,
CPU_CAPABILITY_SSE3
,
"movsldup %%xmm1, %%xmm0
\n
"
);
"movsldup %%xmm1, %%xmm0
\n
"
,
);
# endif
# if defined (__SSSE3__)
...
...
@@ -210,7 +210,7 @@ void vlc_CPU_init (void)
# elif defined (CAN_COMPILE_SSSE3)
if
(
i_ecx
&
0x00000200
)
check_capability
(
"SSSE3"
,
CPU_CAPABILITY_SSSE3
,
"pabsw %%xmm1, %%xmm0
\n
"
);
"pabsw %%xmm1, %%xmm0
\n
"
,
);
# endif
# if defined (__SSE4_1__)
...
...
@@ -218,7 +218,7 @@ void vlc_CPU_init (void)
# elif defined (CAN_COMPILE_SSE4_1)
if
(
i_ecx
&
0x00080000
)
check_capability
(
"SSE4.1"
,
CPU_CAPABILITY_SSE4_1
,
"pmaxsb %%xmm1, %%xmm0
\n
"
);
"pmaxsb %%xmm1, %%xmm0
\n
"
,
);
# endif
# if defined (__SSE4_2__)
...
...
@@ -226,7 +226,7 @@ void vlc_CPU_init (void)
# elif defined (CAN_COMPILE_SSE4_2)
if
(
i_ecx
&
0x00100000
)
check_capability
(
"SSE4.2"
,
CPU_CAPABILITY_SSE4_2
,
"pcmpgtq %%xmm1, %%xmm0
\n
"
);
"pcmpgtq %%xmm1, %%xmm0
\n
"
,
);
# endif
/* test for additional capabilities */
...
...
@@ -243,7 +243,7 @@ void vlc_CPU_init (void)
# elif defined (CAN_COMPILE_3DNOW)
if
(
i_edx
&
0x80000000
)
check_capability
(
"3D Now!"
,
CPU_CAPABILITY_3DNOW
,
"pfadd %%mm0,%%mm0
\n
"
"femms
\n
"
);
"pfadd %%mm0,%%mm0
\n
"
"femms
\n
"
,
);
# endif
if
(
b_amd
&&
(
i_edx
&
0x00400000
)
)
...
...
@@ -257,10 +257,6 @@ out:
# if defined (__ARM_NEON__)
i_capabilities
|=
CPU_CAPABILITY_NEON
;
# elif defined (CAN_COMPILE_NEON)
# define NEED_RUNTIME_CPU_CHECK 1
# endif
# ifdef NEED_RUNTIME_CPU_CHECK
# if defined (__linux__)
FILE
*
info
=
fopen
(
"/proc/cpuinfo"
,
"rt"
);
if
(
info
!=
NULL
)
...
...
@@ -274,11 +270,11 @@ out:
if
(
strncmp
(
line
,
"Features
\t
:"
,
10
))
continue
;
# if defined (CAN_COMPILE_NEON) && !defined (__ARM_NEON__)
cap
=
strstr
(
line
+
10
,
" neon"
);
if
(
cap
!=
NULL
&&
(
cap
[
5
]
==
'\0'
||
cap
[
5
]
==
' '
))
i_capabilities
|=
CPU_CAPABILITY_NEON
;
# endif
break
;
}
fclose
(
info
);
...
...
@@ -306,19 +302,10 @@ out:
i_capabilities
|=
CPU_CAPABILITY_ALTIVEC
;
# elif defined( CAN_COMPILE_ALTIVEC )
pid_t
pid
=
fork
();
if
(
pid
==
0
)
{
signal
(
SIGILL
,
SIG_DFL
);
asm
volatile
(
"mtspr 256, %0
\n\t
"
"vand %%v0, %%v0, %%v0"
:
:
"r"
(
-
1
));
_exit
(
0
);
}
if
(
check_OS_capability
(
"Altivec"
,
pid
)
)
i_capabilities
|=
CPU_CAPABILITY_ALTIVEC
;
check_capability
(
"Altivec"
,
CPU_CAPABILITY_ALTIVEC
,
"mtspr 256, %0
\n\t
"
"vand %%v0, %%v0, %%v0"
,
"r"
(
-
1
));
# endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment