diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-11-26 10:46:36 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-11-27 21:27:13 +0100 |
commit | 9285e0f694969dc2d1d9257378ddf6c8ef42de3c (patch) | |
tree | 438e40733f271a6c62e4df462073b45e16cd249d /gcc/d | |
parent | 67138ea1b041fe1637da6b3568f064f172d9358c (diff) | |
download | gcc-9285e0f694969dc2d1d9257378ddf6c8ef42de3c.zip gcc-9285e0f694969dc2d1d9257378ddf6c8ef42de3c.tar.gz gcc-9285e0f694969dc2d1d9257378ddf6c8ef42de3c.tar.bz2 |
d: Add float and double overloads for all core.math intrinsics
For the math intrinsics: cos, fabs, ldexp, rint, rndtol, and sin, new
overloads have been added to the core.math module for matching float and
double types. These have been implemented in the compiler.
A recent change to dump_function_to_file started triggering some
scan-tree-dump tests to FAIL, these have been adjusted as well when
updating the test.
gcc/d/ChangeLog:
* intrinsics.cc (maybe_expand_intrinsic): Handle new intrinsics.
* intrinsics.def (INTRINSIC_COS): Add float and double overloads.
(INTRINSIC_FABS): Likewise.
(INTRINSIC_LDEXP): Likewise.
(INTRINSIC_RINT): Likewise.
(INTRINSIC_RNDTOL): Likewise.
(INTRINSIC_SIN): Likewise.
(INTRINSIC_TOPREC): Adjust signature.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 5e4492c4.
gcc/testsuite/ChangeLog:
* gdc.dg/intrinsics.d: Adjust patterns in scan-tree-dump.
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/intrinsics.cc | 12 | ||||
-rw-r--r-- | gcc/d/intrinsics.def | 20 |
2 files changed, 28 insertions, 4 deletions
diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc index a7de910..4196ed3 100644 --- a/gcc/d/intrinsics.cc +++ b/gcc/d/intrinsics.cc @@ -814,10 +814,14 @@ maybe_expand_intrinsic (tree callexp) case INTRINSIC_CEIL: case INTRINSIC_CEILF: case INTRINSIC_CEILL: + case INTRINSIC_COS: + case INTRINSIC_COSF: case INTRINSIC_COSL: case INTRINSIC_EXP: case INTRINSIC_EXP2: case INTRINSIC_EXPM1: + case INTRINSIC_FABS: + case INTRINSIC_FABSF: case INTRINSIC_FABSL: case INTRINSIC_FLOOR: case INTRINSIC_FLOORF: @@ -828,9 +832,15 @@ maybe_expand_intrinsic (tree callexp) case INTRINSIC_LOG: case INTRINSIC_LOG10: case INTRINSIC_LOG2: + case INTRINSIC_RINT: + case INTRINSIC_RINTF: case INTRINSIC_RINTL: + case INTRINSIC_RNDTOL: + case INTRINSIC_RNDTOLF: case INTRINSIC_RNDTOLL: case INTRINSIC_ROUND: + case INTRINSIC_SIN: + case INTRINSIC_SINF: case INTRINSIC_SINL: case INTRINSIC_SQRT: case INTRINSIC_SQRTF: @@ -844,6 +854,8 @@ maybe_expand_intrinsic (tree callexp) case INTRINSIC_FMAX: case INTRINSIC_FMIN: + case INTRINSIC_LDEXP: + case INTRINSIC_LDEXPF: case INTRINSIC_LDEXPL: code = intrinsic_decls[intrinsic].built_in; gcc_assert (code != BUILT_IN_NONE); diff --git a/gcc/d/intrinsics.def b/gcc/d/intrinsics.def index 5b8cb71..c05a666 100644 --- a/gcc/d/intrinsics.def +++ b/gcc/d/intrinsics.def @@ -93,22 +93,34 @@ DEF_D_BUILTIN (NEGSL, NONE, "negs", "core.checkedint", "FNaNbNiNflKbZl") /* core.math intrinsics. */ +DEF_D_BUILTIN (COSF, COSF, "cos", "core.math", "FNaNbNiNffZf") +DEF_D_BUILTIN (COS, COS, "cos", "core.math", "FNaNbNiNfdZd") DEF_D_BUILTIN (COSL, COSL, "cos", "core.math", "FNaNbNiNfeZe") +DEF_D_BUILTIN (FABSF, FABSL, "fabs", "core.math", "FNaNbNiNffZf") +DEF_D_BUILTIN (FABS, FABS, "fabs", "core.math", "FNaNbNiNfdZd") DEF_D_BUILTIN (FABSL, FABSL, "fabs", "core.math", "FNaNbNiNfeZe") +DEF_D_BUILTIN (LDEXPF, LDEXPF, "ldexp", "core.math", "FNaNbNiNffiZf") +DEF_D_BUILTIN (LDEXP, LDEXP, "ldexp", "core.math", "FNaNbNiNfdiZd") DEF_D_BUILTIN (LDEXPL, LDEXPL, "ldexp", "core.math", "FNaNbNiNfeiZe") +DEF_D_BUILTIN (RINTF, RINTF, "rint", "core.math", "FNaNbNiNffZf") +DEF_D_BUILTIN (RINT, RINT, "rint", "core.math", "FNaNbNiNfdZd") DEF_D_BUILTIN (RINTL, RINTL, "rint", "core.math", "FNaNbNiNfeZe") -/* Not sure if `llroundl' stands as a good replacement for the expected +/* Not sure if `llround{f,l}' stands as a good replacement for the expected behavior of `rndtol()'. */ +DEF_D_BUILTIN (RNDTOLF, LLROUNDF, "rndtol", "core.math", "FNaNbNiNffZl") +DEF_D_BUILTIN (RNDTOL, LLROUND, "rndtol", "core.math", "FNaNbNiNfdZl") DEF_D_BUILTIN (RNDTOLL, LLROUNDL, "rndtol", "core.math", "FNaNbNiNfeZl") +DEF_D_BUILTIN (SINF, SINF, "sin", "core.math", "FNaNbNiNffZf") +DEF_D_BUILTIN (SIN, SIN, "sin", "core.math", "FNaNbNiNfdZd") DEF_D_BUILTIN (SINL, SINL, "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, NONE, "toPrec", "core.math", "FNaNbNffZI1T") -DEF_D_BUILTIN (TOPREC, NONE, "toPrec", "core.math", "FNaNbNfdZI1T") -DEF_D_BUILTIN (TOPRECL, NONE, "toPrec", "core.math", "FNaNbNfeZI1T") +DEF_D_BUILTIN (TOPRECF, NONE, "toPrec", "core.math", "FfZI1T") +DEF_D_BUILTIN (TOPREC, NONE, "toPrec", "core.math", "FdZI1T") +DEF_D_BUILTIN (TOPRECL, NONE, "toPrec", "core.math", "FeZI1T") /* std.math intrinsics. */ |