This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about "x86 Built-in Functions" to detect cpu type


On 07/08/2018 12:36 PM, U.Mutlu wrote:
Dennis Clarke wrote on 07/08/2018 03:44 PM:

As seen at :

     https://gcc.gnu.org/onlinedocs/gcc/x86-Built-in-Functions.html


The example there seems to suggest that I could do this :


     __builtin_cpu_init ();
     if ( __builtin_cpu_is ("corei7") ){
         fprintf ( stdout, "Intel Core i7 CPU.       \n" );
     } else {
         fprintf ( stdout, " NOT Intel Core i7 CPU.       \n" );
     }


However I get an odd result from my Debian machine here when I try to
check for every possible option :

Just guessing: are you maybe calling __builtin_cpu_init() multiple times?
Though it shouldn't make a difference, IMO.

Tried that once before calling "__builtin_cpu_is" and also tried it
 every time and it makes no difference.


Dennis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]