Bug 18089 – AArch64: Need Quadruple float support in CTFE hashOf / core.internal.convert.parse

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2017-12-16T19:19:42Z
Last change time
2018-10-10T20:48:27Z
Assigned to
No Owner
Creator
Johannes Pfau

Comments

Comment #0 by johannespfau — 2017-12-16T19:19:42Z
The core.internal.convert.parse function does currently not support the 'Quadruple' float format, which is used for the real type on AArch64. Non-CTFE code seems to be suppoerted, but for CTFE this means that hashOf won't work for reals on AArch64 targets. AFAICS this does not cause a problem when compiling druntime / phobos, but when compiling the unittests, one test in core.internal.hash causes a compile time failure: enum raexpr = [8.99L+86i, 3.12L+99i, 5.66L+12i]; enum h29 = raexpr.hashOf(); So this blocks proper CI testing on AArch64 (as a compile failure when compiling the tests obviously prevent us from doing any kind of regression testing)
Comment #1 by schveiguy — 2017-12-16T21:52:04Z
This is out of my league, sorry!
Comment #2 by johannespfau — 2017-12-17T08:37:59Z
Yes, it's a more advanced issue. From a cursory look I'd say the algorithm / approach should work for quadruple floats as well. However, every temporary variable has to be checked whether the data type is large enough for quadruple floats. I think this is the case for everything except for the mantissa, which does not fit into an ulong. Maybe we can simply use a ulong[2] in the Float struct, then fix shiftrRound. However, I think there were efforts in phobos to introduce a generic FloatTraits type which may also be applicable here and avoids some code duplication? It is also quite sad, that 600 lines in the convert module are required for CTFE, whereas a few lines of union/cast code suffices for runtime....
Comment #3 by ibuclaw — 2017-12-17T13:07:52Z
So from a CTFE standpoint, its support cent/ucent, or support unions.
Comment #4 by n8sh.secondary — 2018-10-10T20:47:39Z