Inconsistency in CPU version symbols

Johannes Pfau nospam at example.com
Sun Jan 27 01:42:46 PST 2013


I started implementing all the CPU based version symbols shown on
http://dlang.org/version.html for GDC
(https://gist.github.com/4647493), but I found some things to be
strange:

Floating point:
* Why do we have PPC_SoftFP but MIPS_SoftFloat? I'd say we should use
  *_SoftFloat everywhere for consistency. (Except for arm where
  SoftFP has a different meaning)
* Do we need the arch specific SoftFloat/HardFloat if a target only has
  those two? Why PPC_SoftFP and PPC_HardFP, doesn't
  version(PPC){version(D_SoftFloat) else version(D_HardFloat)} work?
* Even for ARM, which has a third mode, we could get rid of
  ARM_Soft and ARM_HardFP, keeping only ARM_SoftFP. Then you can do
  this:

version(ARM)
{
    version(D_SoftFloat)
    {//ARM_SoftFloat
    }
    else version(D_HardFloat)
    {
        version(ARM_SoftFP){}//ARM_SoftFP, special case of D_HardFloat
        else {}//ARM_HardFP
    }
    else
    {//NoFloat
    }
}

* Why do we have MIPS_NoFloat? This can be replaced by
  version(D_SoftFloat) else version(D_HardFloat) else()
  (looks a little ugly, but a convenience version can be defined in user
  code)

* Why do we have MIPS32? No other architecture has a 32 version?


Questions:
* D_LP64 docs say it means 64bit pointers. GDC currently checks for
  "INT_SIZE == 32 && LONG_INT_SIZE == 64 && POINTER_SIZE == 64" which
  matches the C definition of LP64. This would not match ILP64/SILP64
  for example, so what is D_LP64 supposed to mean?	

* ARM64 always has a FPU. I guess it should not set any of the
  ARM_*Float versions?

* Are D_X32 and X86_64 exclusive or does a X32 system define both?

* What about an ARM_Thumb2 version?

* Does Cygwin also define Windows, Win32, Win64? Posix?

Minor doc problems:
ARM: the docs should say AArch32 not AArch32:A32, that's my fault, I'll
file a pull request.
ARM64: AArch64 instead of AArch64:A64


More information about the Digitalmars-d mailing list