]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Refactor matching and lowering of intrinsic functions.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 14 Jul 2020 16:45:42 +0000 (18:45 +0200)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 16:20:14 +0000 (13:20 -0300)
commit923c002fff919b276754f01fc5f67a59ef74c5b1
tree1240540ee8678b73531faf0e441378b0088c422e
parent3a32156e513aed2d90e3e5e5fe43cf7433be2bc6
d: Refactor matching and lowering of intrinsic functions.

Intrinsics are now matched explicitly, rather than through a common
alias where there are multiple overrides for a common intrinsic.
Where there is a corresponding DECL_FUNCTION_CODE, that is now stored in
the D intrinsic array.  All run-time std.math intrinsics have been
removed, as the library implementation already forwards to core.math.

gcc/d/ChangeLog:

* d-tree.h (DEF_D_INTRINSIC): Rename second argument from A to B.
* intrinsics.cc (intrinsic_decl): Add built_in field.
(DEF_D_INTRINSIC): Rename second argument from ALIAS to BUILTIN.
(maybe_set_intrinsic): Handle new intrinsic codes.
(expand_intrinsic_bt): Likewise.
(expand_intrinsic_checkedint): Likewise.
(expand_intrinsic_bswap): Remove.
(expand_intrinsic_sqrt): Remove.
(maybe_expand_intrinsic): Group together intrinsic cases that map
directly to gcc built-ins.
* intrinsics.def (DEF_D_BUILTIN): Rename second argument from A to B.
Update all callers to pass equivalent DECL_FUNCTION_CODE.
(DEF_CTFE_BUILTIN): Likewise.
(STD_COS): Remove intrinsic.
(STD_FABS): Remove intrinsic.
(STD_LDEXP): Remove intrinsic.
(STD_RINT): Remove intrinsic.
(STD_RNDTOL): Remove intrinsic.
(STD_SIN): Remove intrinsic.
(STD_SQRTF): Remove intrinsic.
(STD_SQRT): Remove intrinsic.
(STD_SQRTL): Remove intrinsic.

gcc/testsuite/ChangeLog:

* gdc.dg/intrinsics.d: New test.
gcc/d/d-tree.h
gcc/d/intrinsics.cc
gcc/d/intrinsics.def
gcc/testsuite/gdc.dg/intrinsics.d [new file with mode: 0644]