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

Data type real not implemented correctly on architectures different from x86 / x86_64 #259

Open
redstar opened this issue Dec 28, 2012 · 3 comments

Comments

@redstar
Copy link
Member

redstar commented Dec 28, 2012

TDPL states that real is the floating point type "largest in hardware". On x86 / x86_64 this is 80bit. On PPC/PPC64 there are only 32bit and 64bit floating point types. Such real is equal to double. There is also a long double type with 128bit but this is a software implementation using 2 double values.

The LDC IR code gets it right. Sadly, the front end uses hard-coded constants for floating point attributes like mant_dig. This has the following bad effects on PPC64:

  • LDC chooses double as the LLVM type (64bit)
  • the frontend uses the compile time constants (default with gcc: 128bit; default with xlC: 64bit)
  • modules like std.mathdo not compile (no support for doubledouble type with 106bit mantissa)

A quick fix for a native compiler is to change the definitions in longdouble.h.
Clearly, this prevents cross-compiling floating point code across different cpu architectures.

@redstar
Copy link
Member Author

redstar commented Dec 30, 2012

With commit 2898e5c I map datatype real to PPC 128bit doubledouble.
Native compilation works now but cross-compiling is still broken.

@redstar
Copy link
Member Author

redstar commented Mar 20, 2013

To enable true cross compilation we have to create a real_t replacement. My first thought is to create a thin wrapper around llvm::APFloat.

redstar added a commit to redstar/ldc that referenced this issue Mar 12, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Mar 30, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jun 25, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jun 26, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jun 28, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jun 29, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jun 29, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 15, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 15, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 16, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 16, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 18, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 18, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 19, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 19, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 19, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 19, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 19, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Jul 21, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit that referenced this issue Aug 28, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue #259.
redstar added a commit to redstar/ldc that referenced this issue Sep 26, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar pushed a commit that referenced this issue Sep 27, 2014
Add atomicFence() function to core.atomic.
redstar added a commit to redstar/ldc that referenced this issue Oct 12, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Oct 19, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Oct 20, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Nov 3, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Nov 11, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Dec 26, 2014
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Mar 6, 2015
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue May 1, 2015
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue May 17, 2015
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Sep 23, 2015
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Sep 25, 2015
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Mar 5, 2016
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Mar 5, 2016
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
redstar added a commit to redstar/ldc that referenced this issue Mar 5, 2016
This commit introduces a new class ldc::longdouble which provides real_t
semantics based on the target. It uses llvm::APFloat as base implementation.

This fixes issue ldc-developers#259.
@kinke
Copy link
Member

kinke commented Jun 27, 2021

The main remaining obstacle here is a software real_t type for hosts with a native real (exception for Windows hosts: x87) with less precision than the target. The constants in dmd.root.ctfloat should be good for all formats; the real format selection still needs to be adapted for exotic targets (e.g., IBM z, and PowerPC with their various formats), by someone who knows or reads up on these archs.

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

No branches or pull requests

2 participants