Mageia Bugzilla – Attachment 9958 Details for
Bug 22525
Update request: gcc 5.5.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Program containing embedded assembler code
mmx.c (text/plain), 624 bytes, created by
Len Lawrence
on 2018-02-06 14:04:38 CET
(
hide
)
Description:
Program containing embedded assembler code
Filename:
MIME Type:
Creator:
Len Lawrence
Created:
2018-02-06 14:04:38 CET
Size:
624 bytes
patch
obsolete
>#include <stdio.h> > >int detect_mmx( void ) > >{ > int mmx_bit; > > asm( "mov %2, %%eax \n\t" // request feature flag > "cpuid \n\t" // get CPU ID flag > "and %1, %%edx \n\t" // check MMX bit (bit 23) > "mov %%edx, %0 \n\t" // move result to mmx_bit > > : "=m" (mmx_bit) // %0 > > : "i" (0x00000001), // %1 > "i" (0x00800000) // %2 > ); > > return mmx_bit; >} > >int main( int argc, char** argv ) > >{ > if ( detect_mmx() ) > printf("MMX is detected !\n"); > else > printf("MMX is NOT detected !\n"); >}
#include <stdio.h> int detect_mmx( void ) { int mmx_bit; asm( "mov %2, %%eax \n\t" // request feature flag "cpuid \n\t" // get CPU ID flag "and %1, %%edx \n\t" // check MMX bit (bit 23) "mov %%edx, %0 \n\t" // move result to mmx_bit : "=m" (mmx_bit) // %0 : "i" (0x00000001), // %1 "i" (0x00800000) // %2 ); return mmx_bit; } int main( int argc, char** argv ) { if ( detect_mmx() ) printf("MMX is detected !\n"); else printf("MMX is NOT detected !\n"); }
View Attachment As Raw
Actions:
View
Attachments on
bug 22525
:
9956
| 9958