Menu

#101 Next refinement of _M_IX86

closed-fixed
nobody
None
5
2009-06-24
2009-06-21
No

You asked a question but closed the post for comments.

> thanks for the patch. I applied it at revision 954. Why the default is set
to 300 for x86? As I read in msdn the default should be 600, but well if it
solves your issues, I am fine. On older cpu's then i386 it is pretty
unlikely that somebody is using our CRT :)

MSDN docs say 600 is currently default value if /GB options is used.
I've taken the code from MinGW Win32 headers (windows.h) but now I can see it's broken (as if I specify -march=pentium4 then it gives only 300). And this is bad for GC lib as it uses some asm lock commands (like cmpandxchg).

On the other hand, I don't known how to fix it. The situation is follows:
__i386__ is always defined (means any 32-bit system);
__i486__ is defined if -march=i486 or no -march;
same for __i586__ and __i686__;
other pre-defined macros like __pentium__, __geode__, __k6__, __pentium4__, _nocona__, etc are defined respectively if -march is specified with the corresponding value.

So, the code should check only for __i486__ (400) and __i586__ (500) and, otherwise, gives 600. The code would be broken for i386 systems but I think it's better than be broken for modern and future processors.

The suggested patch attached.

PS. If You know the MinGW folks let them know this bug.

Discussion

  • Ivan Maidanski

    Ivan Maidanski - 2009-06-21
     
  • NightStrike

    NightStrike - 2009-06-21

    We could probably fix this in the GCC specs file if it's based off of command line options. Or at least test to see which option is passed.

     
  • Kai Tietz

    Kai Tietz - 2009-06-21

    Yes, I agree that we should default here to 600. As we have no real possibility to check the proper CPU specified, we should assume here modern CPUs. Of course, if somebody uses still a i386 system, the detection is wrong, but this is at least for our runtime pretty unlikely.

    So I commit you patch at revision 955.

    NightStrike if you suggest, how we could express this here by gcc's CPU defines in a common and general way, I would be happy.

    Cheers,
    Kai

     
  • Kai Tietz

    Kai Tietz - 2009-06-21
    • status: open --> open-fixed
     
  • Kai Tietz

    Kai Tietz - 2009-06-21
    • status: open-fixed --> pending-fixed
     
  • Kai Tietz

    Kai Tietz - 2009-06-24
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.