Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement -mpc64 #37

Open
njsmith opened this issue Feb 24, 2016 · 1 comment
Open

Implement -mpc64 #37

njsmith opened this issue Feb 24, 2016 · 1 comment

Comments

@njsmith
Copy link
Contributor

njsmith commented Feb 24, 2016

As a todo-eventually item: gcc on other platforms supports -mpc32, -mpc64, -mpc80 to explicitly choose which precision mode to set the x87 FPU into. This is implemented by always shipping multiple .o files as part of the runtime library, and selecting between them using the specs file.

E.g., my Linux gcc's -dumpspecs has some code like: {mpc32:crtprec32.o%s} %{mpc64:crtprec64.o%s} %{mpc80:crtprec80.o%s}, and then there are crtprec32.o, crtprec64.o, crtprec80.o files in /usr/lib/gcc/..., so the correct one can be selected when running gcc.

The current patches in mingwpy that force the use of 64-bit precision mode can't go upstream as is, but if we implemented the standard gcc behaviour in mingw-w64 (at least the -mpc64 and -mpc80 options -- I doubt that anyone cares about -mpc32) then that could go upstream, and then instead of patching the makefiles we'd just have to arrange for our default to be -mpc64. (And possibly we could eventually roll that into some sort of -mmsvc option.)

@carlkl
Copy link
Contributor

carlkl commented Feb 24, 2016

Short summary for reference:

The latest commits https://github.com/mingwpy/mingw-builds/commits/mingwpy-dev allows to choose 80bit precision with the flag -mlong-double-80. The default precision is now 64bit for long doubles. For the standard mingw-w64 distributions this is exactly the opposite.

This change was made to stay MSVC and Windows API conformant:

  • long double has the same precision as double
  • FPU register settings are 64bit as default

The mingw-w64 libraries still allows 80bit long doubles if needed:

  • use the -mlong-double-80 flag for compiling
  • add the CRT_fp10.o object to the link command to change the FPU register to extended precision (80bit)

@njsmith, the latter could be done with an additional target as you described. I guess upstream would accept patches for such a target but with the opposite default as mingwpy needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants