diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-25 02:19:04 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-04-25 02:19:04 +0200 |
commit | 018730326d878d98b85b1256ff220e76665ed97e (patch) | |
tree | 39976b0fbb3c7afa4583d54d0be78c63ec5ff351 /gcc/d | |
parent | 873878bb82443ce738f35b1ad3c9ef98f6aeb6da (diff) | |
download | gcc-018730326d878d98b85b1256ff220e76665ed97e.zip gcc-018730326d878d98b85b1256ff220e76665ed97e.tar.gz gcc-018730326d878d98b85b1256ff220e76665ed97e.tar.bz2 |
d: Merge upstream dmd 09db0c41e, druntime e68a5ae3.
* New core.math.toPrec templates have been added as an intrinsic.
Some floating point algorithms, such as Kahan-Babuska-Neumaier
Summation, require rounding to specific precisions. Rounding to
precision after every operation, however, loses overall precision in
the general case and is a runtime performance problem.
Adding these functions guarantee the rounding at required points in
the code, and document where in the algorithm the requirement exists.
* Support IBM long double types in core.internal.convert.
* Add missing aliases for 64-bit vectors in core.simd.
* RUNNABLE_PHOBOS_TEST directive has been properly integrated into the
D2 language testsuite.
Reviewed-on: https://github.com/dlang/druntime/pull/3063
https://github.com/dlang/dmd/pull/11054
gcc/d/ChangeLog:
* intrinsics.cc (expand_intrinsic_toprec): New function.
(maybe_expand_intrinsic): Handle toPrec intrinsics.
* intrinsics.def (TOPRECF, TOPREC, TOPRECL): Add toPrec intrinsics.
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/d/dmd/MERGE | 2 | ||||
-rw-r--r-- | gcc/d/intrinsics.cc | 22 | ||||
-rw-r--r-- | gcc/d/intrinsics.def | 3 |
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index b96f0ff..7bb38a8 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,9 @@ +2020-04-25 Iain Buclaw <ibuclaw@gdcproject.org> + + * intrinsics.cc (expand_intrinsic_toprec): New function. + (maybe_expand_intrinsic): Handle toPrec intrinsics. + * intrinsics.def (TOPRECF, TOPREC, TOPRECL): Add toPrec intrinsics. + 2020-04-24 Iain Buclaw <ibuclaw@gdcproject.org> * d-spec.cc (need_phobos): Remove. diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 155286d..a878cb9 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -62ce36f3737de691217c21f0173f411734eb1d43 +09db0c41ee922502fa0966bde24c1cb9b15ad436 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc index 9a9fd41..c7bde88e 100644 --- a/gcc/d/intrinsics.cc +++ b/gcc/d/intrinsics.cc @@ -467,6 +467,25 @@ expand_intrinsic_pow (tree callexp) base, exponent); } +/* Expand a front-end intrinsic call to toPrec(). This takes one argument, the + signature to which can be either: + + T toPrec(T)(float f); + T toPrec(T)(double f); + T toPrec(T)(real f); + + This rounds the argument F to the precision of the specified floating + point type T. The original call expression is held in CALLEXP. */ + +static tree +expand_intrinsic_toprec (tree callexp) +{ + tree f = CALL_EXPR_ARG (callexp, 0); + tree type = TREE_TYPE (callexp); + + return convert (type, f); +} + /* Expand a front-end intrinsic call to va_arg(). This takes either one or two arguments, the signature to which can be either: @@ -818,6 +837,9 @@ maybe_expand_intrinsic (tree callexp) CALL_EXPR_ARG (callexp, 1), CALL_EXPR_ARG (callexp, 2)); + case INTRINSIC_TOPREC: + return expand_intrinsic_toprec (callexp); + case INTRINSIC_VA_ARG: case INTRINSIC_C_VA_ARG: return expand_intrinsic_vaarg (callexp); diff --git a/gcc/d/intrinsics.def b/gcc/d/intrinsics.def index 3c8ed10..1782cd7 100644 --- a/gcc/d/intrinsics.def +++ b/gcc/d/intrinsics.def @@ -95,6 +95,9 @@ DEF_D_BUILTIN (SIN, SIN, "sin", "core.math", "FNaNbNiNfeZe") DEF_D_BUILTIN (SQRTF, SQRTF, "sqrt", "core.math", "FNaNbNiNffZf") DEF_D_BUILTIN (SQRT, SQRT, "sqrt", "core.math", "FNaNbNiNfdZd") DEF_D_BUILTIN (SQRTL, SQRTL, "sqrt", "core.math", "FNaNbNiNfeZe") +DEF_D_BUILTIN (TOPRECF, TOPREC, "toPrec", "core.math", "FNaNbNffZI1T") +DEF_D_BUILTIN (TOPREC, TOPREC, "toPrec", "core.math", "FNaNbNfdZI1T") +DEF_D_BUILTIN (TOPRECL, TOPREC, "toPrec", "core.math", "FNaNbNfeZI1T") /* std.math intrinsics. */ |